1. Michael Bayer
  2. alembic
  3. Issues

Issues

Issue #33 resolved

Support of schemas is absent for most of operations

Dmitriy Bogomolov
created an issue

No description provided.

Comments (6)

  1. Michael Bayer repo owner

    somewhat intentional. I typically run migrations for a remote schema in terms of that schema, i.e. set the "search_path" as needed. That would be your workaround for now.

    Anyway, can you list out areas where "schema" specification is needed along with links to correct format ? I gather we're just talking about Postgresql here as well.

  2. Anonymous

    For example, in _produce_net_changes (in autogenerate) there is this line:

    metadata_table_names = OrderedSet([table.name for table in metadata.sorted_tables])
    

    the items from this operation are then compared (in _compare_tables) via these lines:

    for tname in metadata_table_names.difference(conn_table_names):
            diffs.append(("add_table", metadata.tables[tname]))
    

    metadata.tables is keyed using "<schema>.<name>" if schema exists, so the lookup for metadata.tables[tname] will fail on any result with a schema specified.

    The problems run deeper than that though, as I patched that function to fix the lookup issue, and the autogenerated revision omits all schema info, so all tables are created in the default schema for the connection.

  3. Log in to comment