Thanks. Maybe it would be better that I explain the whole scenario so everyone reading can have better overview of what I want to achieve.
We have some "general" tables (like users, permissions, roles and similar) that are referenced from multi-tenant client schemes ("client_1", "client_2", etc). Atm, we have some simple "migration" Python script that runs given *.sql migration file on general and all client schemes; so we are considering using a better tool (Alembic) to do this for us, but we have to customize it (not yet sure how exactly). Second issue is polymorphic related. We are using plain IntEnum to store "discriminator" field. During alembic migration, this is imported as Python IntEnum, but I would like it to become plain sa.Integer(). Third one is the originally posted. I guess it would be easier to change env.py programatically, or use some of the techniques mentioned in previous response. It seems that I will have to use target_metadata on another places anyway, so just wanted to see how to actually do this. I can debug (and probably will) how Alembic itself handles context creation and calls commands, but was not sure is this the right path or there are better ones. (We use declarative_base - I forgot to mention that) Thank you all. Kindest regards -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/91ca675f-79e6-43c6-8e28-bed0ce62ed72n%40googlegroups.com.