Re: Autogenerate with Multi-Tenant

2020-03-20 Thread Brian Hill
same > thing. > > > On Fri, Mar 20, 2020, at 10:48 AM, Brian Hill wrote: > > this is what i tried but it generated the whole schema: > . > with connectable.connect() as connection: > > connection.execute(f'create schema if not exists {DB_SCHEMA}') > connection.e

Re: Autogenerate with Multi-Tenant

2020-03-20 Thread Brian Hill
set > it for the alembic version table.Postgresql will also CREATE/ ALTER in > that schema as well.As long as your environment runs completely in just > one schema at a time, this can be set up entirely at the connection level. > > > On Thu, Mar 19, 2020, at 9:15 PM, Bria

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Brian Hill
On Thursday, March 19, 2020 at 8:20:06 PM UTC-4, Mike Bayer wrote: > > > > On Thu, Mar 19, 2020, at 7:41 PM, Brian Hill wrote: > > > > On Thursday, March 19, 2020 at 7:19:08 PM UTC-4, Mike Bayer wrote: > > so let me get this straight: > > 1. you have many sch

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Brian Hill
and the db. thanks, brian On Thursday, March 19, 2020 at 7:41:54 PM UTC-4, Brian Hill wrote: > > > > On Thursday, March 19, 2020 at 7:19:08 PM UTC-4, Mike Bayer wrote: >> >> so let me get this straight: >> >> 1. you have many schemas >> >> >

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Brian Hill
re( connection=connection, include_schemas=True, target_metadata=metadata, version_table_schema=DB_SCHEMA, ) with context.begin_transaction(): context.run_migrations() > > > On Thu, Mar 19, 2020, at 7:09 PM, Brian Hill wrote: > > Here's my env.py. Thanks for the help. > Brian > >

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Brian Hill
Here's my env.py. Thanks for the help. Brian On 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)? &

Autogenerate with Multi-Tenant

2020-03-19 Thread Brian Hill
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.

Re: Migrate alembic_version table from Public to tenant schema

2020-02-18 Thread Brian Hill
: > > > > On Tue, Feb 18, 2020, at 1:17 PM, Brian Hill wrote: > > Is there a way to move the alembic_version table in the Public schema > (postgres) to a specific schema (mult-tenant) as part of a migration? > > > I highly doubt this is possible in the general case without

Migrate alembic_version table from Public to tenant schema

2020-02-18 Thread Brian Hill
Is there a way to move the alembic_version table in the Public schema (postgres) to a specific schema (mult-tenant) as part of a migration? I want alembic to read the inital version from Public.alembic_version and then write the new upgraded version to the specific schema.alembic_version. The

Re: Using enums with schema_translate_map

2020-02-17 Thread Brian Hill
; you will need to fill in the "schema" parameter explicitly when you call > upon op.create_table() > > > > On Mon, Feb 17, 2020, at 12:47 PM, Brian Hill wrote: > > I'm having trouble using enums in conjunction with schema_translate_map > for postgres migration

Using enums with schema_translate_map

2020-02-17 Thread Brian Hill
I'm having trouble using enums in conjunction with schema_translate_map for postgres migrations. My model, single table, single enum. import enum from sqlalchemy import MetaData, Enum, Column, Integer from sqlalchemy.ext.declarative import declarative_base metadata = MetaData() Base =