diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index c90c137..deaa0c5 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -3281,14 +3281,16 @@ def convert( return fn(v) if v else v db.conn.create_function("preview_transform", 1, preview) + col_quoted = quote_identifier(columns[0]) + tbl_quoted = quote_identifier(table) sql = """ select - [{column}] as value, - preview_transform([{column}]) as preview - from [{table}]{where} limit 10 + {col} as value, + preview_transform({col}) as preview + from {tbl}{where} limit 10 """.format( - column=columns[0], - table=table, + col=col_quoted, + tbl=tbl_quoted, where=f" where {where}" if where is not None else "", ) for row in db.conn.execute(sql, where_args).fetchall():