automatic revison delects same changes when 'include_name' param of context.configure() set. #1582
Replies: 1 comment 1 reply
-
this is not reproducible information and there is no general issue with the include_name callable, since you are using PostgreSQL and I see you mentioning the "public" schema, the recommended use for PostgreSQL is that "public" should never be named explicitly. best practices for PostgreSQL search_path are at https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#remote-schema-table-introspection-and-postgresql-search-path , i.e. dont name "public" in your metadata models and ensure search_path does not contain other schemas inside of it. for further assistance would need to see example models that you are using as well as what your search_path is set to. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
alembic revision --autogenerate -m "something1"keeps detecting previously migrated changes when applied:
def include_name(name, type_, parent_names):
if type_ == "schema":
return name in ["schema_one", "schema_two"]
else:
return True
context.configure(
# ...
include_schemas = True,
include_name = include_name
)
according to the documentation.
Expected behavior
to focus automatic script generation on selected schema, i.e. 'public':
def include_name(name, type_, parent_names):
if type_ == "schema":
return name in ["public"]
else:
return True
alembic revision --autogenerate -m "something2" should not detect changes detected at something1 moment that were already migrated with alembic upgrade head.
To Reproduce
Error
Versions.
Additional context
the solution to limit alembic down to selected db schema works as expected, however, it has bad side effect I was not able to debug any further.
Have a nice day!
Beta Was this translation helpful? Give feedback.
All reactions