Use quoted SQL identifiers in convert --dry-run, closes #829

This commit is contained in:
Simon Willison 2026-08-12 14:14:27 -07:00
commit c5063f67b1
2 changed files with 33 additions and 5 deletions

View file

@ -3283,12 +3283,12 @@ def convert(
db.conn.create_function("preview_transform", 1, preview)
sql = """
select
[{column}] as value,
preview_transform([{column}]) as preview
from [{table}]{where} limit 10
{column} as value,
preview_transform({column}) as preview
from {table}{where} limit 10
""".format(
column=columns[0],
table=table,
column=quote_identifier(columns[0]),
table=quote_identifier(table),
where=f" where {where}" if where is not None else "",
)
for row in db.conn.execute(sql, where_args).fetchall():