Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sqlite_utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4034,6 +4034,7 @@ def search_sql(
original_quoted = quote_identifier(original)
columns_sql = "*"
columns_with_prefix_sql = f"{original_quoted}.*"
columns = list(columns) if columns is not None else None
if columns:
columns_sql = ",\n ".join(quote_identifier(c) for c in columns)
columns_with_prefix_sql = ",\n ".join(
Expand Down
10 changes: 10 additions & 0 deletions tests/test_fts.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ def test_search_duplicate_columns_are_deduped(fresh_db):
]


def test_search_columns_accepts_iterator(fresh_db):
# https://github.com/simonw/sqlite-utils/issues/942
table = fresh_db.table("t")
table.insert_all(search_records)
table.enable_fts(["text", "country"])
assert list(table.search("tanuki", columns=iter(["text", "country"]))) == [
{"text": "tanuki are running tricksters", "country": "Japan"}
]


def test_search_limit_offset(fresh_db):
table = fresh_db.table("t")
table.insert_all(search_records)
Expand Down
Loading