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