I've found some example at 
https://stackoverflow.com/questions/21109218/alembic-support-for-multiple-postgres-schemas

But when I run alembic revision --autogenerate -m "Initial upgrade" at 
alembic/versions/24648f118be9_initial_upgrade.py I've got no schema='myschema' 
keywords on table, indexes, columns items ((


def run_migrations_online():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

    """
    connectable = engine_from_config(
        config.get_section(config.config_ini_section),
        prefix='sqlalchemy.',
        poolclass=pool.NullPool)

    with connectable.connect() as connection:
        for schema_name in schema_names.split():
            conn = connection.execution_options(schema_translate_map={None: 
schema_name})

            print("Migrating schema %s" % schema_name)

            context.configure(
                connection=conn,
                target_metadata=target_metadata
            )

            with context.begin_transaction():
                context.run_migrations()



среда, 29 августа 2018 г., 12:12:19 UTC+3 пользователь sector119 написал:
>
> Hello
>
> I have N schemas with the same set of tables, 1 system schema with users, 
> groups, ... tables and 6 schemas with streets, organizations, transactions, 
> ... tables. 
> On those schemas tables I don't set __table_args__ = ({'schema': SCHEMA},)
> I just call dbsession.execute('SET search_path TO system, %s' % SCHEMA) 
> before sql queries.
>
> When I make some changes in my model structures I want to refactor table 
> in all schemas using Alembic, how can I do that?
> Maybe I can make some loop over my schemas somewhere? 
>
>
> Thanks
>

-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to