Skip to content

Commit

Permalink
use inspection mkleehammer/pyodbc#1312
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-schick committed Dec 15, 2023
1 parent 2752f78 commit 729f719
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mara_catalog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def create_schema_if_not_exist(db_alias: str, schema_name: str) -> bool:
eng = mara_db.sqlalchemy_engine.engine(db_alias)

with eng.connect() as conn:
if eng.dialect.has_schema(connection=conn, schema_name=schema_name):
insp = sqlalchemy.inspect(eng)
if insp.has_schema(schema_name=schema_name, connection=conn):
print(f'Schema {schema_name} already exists')
else:
create_schema = sqlalchemy.schema.CreateSchema(schema_name)
Expand Down

0 comments on commit 729f719

Please sign in to comment.