Getting Model/Table at the state of a revision #818
-
Hello, I am using Alembic not only to perform DB upgrades but also content migrations and I was wondering if it's possible, WITHIN a migration to get the state of a table or a model using the Alembic state and not my codebase. Scenario:
I want to get the User model at the state at which it was before that particular migration ran. Is it something that's built into alembic or a third-party plugin? My goal is to avoid having to re-write my model inside the migration file, which is kinda messy. Thanks, Phil |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
you can reflect tables within a migration, you can use op.get_bind() wtih any reflection-related operation:
to have them in the form of "models" you'd need to use automap. |
Beta Was this translation helpful? Give feedback.
you can reflect tables within a migration, you can use op.get_bind() wtih any reflection-related operation:
to have them in the form of "models" you'd need to use automap.