-
The code is not problematic yet. I just googled long and hard to get it working.
I inherit a class to be able to access all its inherited attributes. I change its
__tablename__
and set it to__abstract__
to get around how sqlalchemy want to inherit classes. I also allow overriding attributes of the new class.I then copy all the
__table__
columns from mysrc_table
to my newdst_table
and use the sqlamapper()
function to change class attributes to use columns for the newdst_table
.So there a lot of monkey patching. While in the tests Im running everything seems fine and I maybe want to later copy more then
columns
I still feel I might be missing something that is going to hurt real bad, sooner then later.So I need input.
EDIT: meh, found a lot of issues with the code and not using it any more. But I did update it and will use it in the future if I want to create dynamic classes for sharding, table_name change etc.
/monologue
Please register or sign in to comment