Are there known issues with using autogenerate with multi-tenant (schema_translate_map)?
My metadata doesn't have a schema and I my schema_translate_map={None:'my_schema'}.This works for migrations but when I use autogenerate the generated revision file is the full schema and not the diff.It's detecting the alembic version table in the tenant schema. If I run the autogenerate a second time with the new revision file it fails saying Taget database is not up to date.
Thanks,Brian
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/5011240c-ba09-4423-9a05-0e6d2481dadf%40googlegroups.com.
On Thu, Mar 19, 2020, at 5:30 PM, Brian Hill wrote:Are there known issues with using autogenerate with multi-tenant (schema_translate_map)?it's complicated and not one-size-fits-all, if you consider that to be an issueMy metadata doesn't have a schema and I my schema_translate_map={None:'my_schema'}.This works for migrations but when I use autogenerate the generated revision file is the full schema and not the diff.It's detecting the alembic version table in the tenant schema. If I run the autogenerate a second time with the new revision file it fails saying Taget database is not up to date.are you setting include_schemas=True in your environment? I'd probably not do this. Can't help much more without a complete and concise working example of your env.py, please remove all extraneous details.
Thanks,Brian
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/fe6fddb4-25d6-4dd1-be3a-c1a174548bb4%40googlegroups.com.Attachments:
- env.py
so let me get this straight:1. you have many schemas
2. you want to run autogenerate only once
3. you want your mirations genrated with None for schema
4. *HOWEVER*, when you run autogenerate, you are picking *one* (random? arbitrary?) schema to use as the target, is that right?
As it stands, your autogenerate is not going to look in any schema except "public", assuming default PG search path, because you did not set "include_schemas=True".
If you truly want autogenerate to look at one schema and only that schema, and generate everything as non-schema qualified, then I would simply set the default schema in PG to that schema name using search_path:connection.execute("SET search_path TO my_schema")that way everything Alembic reflects will be from "my_schema" and it will see the schema as blank, and it should generate as such. you might need to disable the schema translate map when autogenerate runs but try it without doing that first.
On Thu, Mar 19, 2020, at 7:09 PM, Brian Hill wrote:
Here's my env.py. Thanks for the help.BrianOn Thursday, March 19, 2020 at 5:37:38 PM UTC-4, Mike Bayer wrote:On Thu, Mar 19, 2020, at 5:30 PM, Brian Hill wrote:Are there known issues with using autogenerate with multi-tenant (schema_translate_map)?it's complicated and not one-size-fits-all, if you consider that to be an issueMy metadata doesn't have a schema and I my schema_translate_map={None:'my_schema'}.This works for migrations but when I use autogenerate the generated revision file is the full schema and not the diff.It's detecting the alembic version table in the tenant schema. If I run the autogenerate a second time with the new revision file it fails saying Taget database is not up to date.are you setting include_schemas=True in your environment? I'd probably not do this. Can't help much more without a complete and concise working example of your env.py, please remove all extraneous details.Thanks,Brian
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsub...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/5011240c-ba09-4423-9a05-0e6d2481dadf%40googlegroups.com.
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/fe6fddb4-25d6-4dd1-be3a-c1a174548bb4%40googlegroups.com.Attachments:
- env.py
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/f6dcb50d-368c-4f8d-8e0b-af6f80d10084%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/f6dcb50d-368c-4f8d-8e0b-af6f80d10084%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/ef68d038-2452-4b29-960d-923df0ae844b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/ef68d038-2452-4b29-960d-923df0ae844b%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/894af588-f022-4a96-9cfb-a5152b819af4%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/894af588-f022-4a96-9cfb-a5152b819af4%40googlegroups.com.