mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-07 17:14:09 +02:00
Compare commits
2 commits
main
...
fix/conver
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc2dcfca36 | ||
|
|
b8f0cb5a6c |
1 changed files with 7 additions and 5 deletions
|
|
@ -3281,14 +3281,16 @@ def convert(
|
||||||
return fn(v) if v else v
|
return fn(v) if v else v
|
||||||
|
|
||||||
db.conn.create_function("preview_transform", 1, preview)
|
db.conn.create_function("preview_transform", 1, preview)
|
||||||
|
col_quoted = quote_identifier(columns[0])
|
||||||
|
tbl_quoted = quote_identifier(table)
|
||||||
sql = """
|
sql = """
|
||||||
select
|
select
|
||||||
[{column}] as value,
|
{col} as value,
|
||||||
preview_transform([{column}]) as preview
|
preview_transform({col}) as preview
|
||||||
from [{table}]{where} limit 10
|
from {tbl}{where} limit 10
|
||||||
""".format(
|
""".format(
|
||||||
column=columns[0],
|
col=col_quoted,
|
||||||
table=table,
|
tbl=tbl_quoted,
|
||||||
where=f" where {where}" if where is not None else "",
|
where=f" where {where}" if where is not None else "",
|
||||||
)
|
)
|
||||||
for row in db.conn.execute(sql, where_args).fetchall():
|
for row in db.conn.execute(sql, where_args).fetchall():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue