We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0d7f23 commit 3730743Copy full SHA for 3730743
src/server/_db.py
@@ -7,7 +7,6 @@
7
8
engine: Engine = create_engine(SQLALCHEMY_DATABASE_URI, **SQLALCHEMY_ENGINE_OPTIONS)
9
metadata = MetaData(bind=engine)
10
-inspector: Inspector = inspect(engine)
11
12
TABLE_OPTIONS = dict(
13
mysql_engine="InnoDB",
@@ -21,6 +20,7 @@ def sql_table_has_columns(table: str, columns: List[str]) -> bool:
21
20
"""
22
checks whether the given table has all the given columns defined
23
+ inspector: Inspector = inspect(engine)
24
table_columns: List[Dict] = inspector.get_columns(table)
25
table_column_names = set(str(d.get("name", "")).lower() for d in table_columns)
26
return all(c.lower() in table_column_names for c in columns)
0 commit comments