-
-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Not sure why this has only just started failing, but I'm getting this: https://github.com/simonw/sqlite-utils/runs/4488687639
E sqlite3.DatabaseError: database disk image is malformed
sqlite_utils/db.py:425: DatabaseError
_______________________ test_rebuild_fts[searchable_fts] _______________________
fresh_db = <Database <sqlite3.Connection object at 0x1084ea9d0>>
table_to_fix = 'searchable_fts'
@pytest.mark.parametrize("table_to_fix", ["searchable", "searchable_fts"])
def test_rebuild_fts(fresh_db, table_to_fix):
table = fresh_db["searchable"]
table.insert(search_records[0])
table.enable_fts(["text", "country"])
# Run a search
rows = list(table.search("tanuki"))
assert len(rows) == 1
assert {
"rowid": 1,
"text": "tanuki are running tricksters",
"country": "Japan",
"not_searchable": "foo",
}.items() <= rows[0].items()
# Delete from searchable_fts_data
fresh_db["searchable_fts_data"].delete_where()
# This should have broken the index
with pytest.raises(sqlite3.DatabaseError):
list(table.search("tanuki"))
# Running rebuild_fts() should fix it
> fresh_db[table_to_fix].rebuild_fts()
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working