Skip to content
  • 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 my src_table to my new dst_table and use the sqla mapper() function to change class attributes to use columns for the new dst_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

    Edited by OpenHazel
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment