1
0
Fork 0
mirror of https://github.com/qurator-spk/modstool.git synced 2025-09-06 15:29:54 +02:00

🐛 Don't use bare except, check for existence of index column instead

This commit is contained in:
Mike Gerber 2025-08-21 15:54:13 +02:00
parent 1e5cfcc0e5
commit 664900635d
2 changed files with 13 additions and 4 deletions

View file

@ -452,3 +452,12 @@ def convert_db_to_parquet(con, table, index_col, output_file):
)
df.to_parquet(output_file)
def sqlite3_column_exists(con, table, col):
"""Check if column col exists in table."""
cur = con.execute(
"SELECT 1 FROM pragma_table_info(?) WHERE name = ? LIMIT 1",
(table, col)
)
return cur.fetchone() is not None