Skip to content

Commit

Permalink
Ignore several views in alembic env script
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyMcCormick committed Nov 15, 2024
1 parent 68d1694 commit 4b50e96
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ def include_name(name, type_, parent_names):
return True


def include_object(object, name, type_, reflected, compare_to):
if type_ == "table" and name in ["ccdvisit1", "visit1"]:
logger.info(f"Excluding table {object.schema}.{name}")
return False
else:
return True


# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
Expand Down Expand Up @@ -80,6 +88,7 @@ def run_migrations_offline() -> None:
dialect_opts={"paramstyle": "named"},
include_schemas=True,
include_name=include_name,
include_object=include_object,
version_table=f"{schema_name}_version",
version_table_schema="cdb",
)
Expand Down Expand Up @@ -107,6 +116,7 @@ def run_migrations_online() -> None:
target_metadata=target_metadata,
include_schemas=True,
include_name=include_name,
include_object=include_object,
version_table=f"{schema_name}_version",
version_table_schema="cdb",
)
Expand Down

0 comments on commit 4b50e96

Please sign in to comment.