diff --git a/app/utils/db_migrate.py b/app/utils/db_migrate.py index 3424009d..c84da88d 100644 --- a/app/utils/db_migrate.py +++ b/app/utils/db_migrate.py @@ -85,7 +85,8 @@ def preview_migration(source_url: str) -> dict[str, Any]: with src_engine.connect() as conn: for table_name in tables: # table_name is safe — sourced from inspect().get_table_names(), not user input - row = conn.execute(text(f'SELECT COUNT(*) FROM "{table_name}"')).fetchone() # noqa: S608 + quoted_table = conn.dialect.identifier_preparer.quote(table_name) + row = conn.execute(text(f"SELECT COUNT(*) FROM {quoted_table}")).fetchone() # noqa: S608 count = row[0] if row else 0 result.append({"name": table_name, "row_count": count}) total += count