Skip to content

Commit 3730743

Browse files
committed
fix: load inspector on the fly
1 parent c0d7f23 commit 3730743

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/server/_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
engine: Engine = create_engine(SQLALCHEMY_DATABASE_URI, **SQLALCHEMY_ENGINE_OPTIONS)
99
metadata = MetaData(bind=engine)
10-
inspector: Inspector = inspect(engine)
1110

1211
TABLE_OPTIONS = dict(
1312
mysql_engine="InnoDB",
@@ -21,6 +20,7 @@ def sql_table_has_columns(table: str, columns: List[str]) -> bool:
2120
"""
2221
checks whether the given table has all the given columns defined
2322
"""
23+
inspector: Inspector = inspect(engine)
2424
table_columns: List[Dict] = inspector.get_columns(table)
2525
table_column_names = set(str(d.get("name", "")).lower() for d in table_columns)
2626
return all(c.lower() in table_column_names for c in columns)

0 commit comments

Comments
 (0)