Re: [sqlalchemy] how to set target_metadata programatically ?

2021-01-06 Thread Mike Bayer
the reason Alembic puts env.py into your project, rather than having this just be part of Alembic, is so that you can customize it as needed, so it sounds like for everything you're doing you want to be inside of env.py making those changes. On Wed, Jan 6, 2021, at 1:43 AM, Nikola Radovanovic

Re: [sqlalchemy] how to set target_metadata programatically ?

2021-01-05 Thread Nikola Radovanovic
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",

Re: [sqlalchemy] how to set target_metadata programatically ?

2021-01-05 Thread Mike Bayer
hi there - usually programmatic customization of Alembic is done via the env.py script directly, that is, you would run "alembic revision" normally and it's within your local env.py that you can control how target_metadata is achieved. you can also pass custom options to "alembic revision"

[sqlalchemy] how to set target_metadata programatically ?

2021-01-05 Thread Nikola Radovanovic
Hi, I would like to create set of thin wrappers on top of the alembic since we need some customization. So first thing for me to solve is how to set *target_metadata* programatically. What I realized by reading documentation and code is that I need something like: alembic_cfg =