mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-03 07:54:22 +02:00
delete_where(analyze=True), closes #378
This commit is contained in:
parent
131ed27ab0
commit
cf73818136
3 changed files with 31 additions and 2 deletions
|
|
@ -30,3 +30,17 @@ def test_delete_where_all(fresh_db):
|
|||
assert 10 == table.count
|
||||
table.delete_where()
|
||||
assert 0 == table.count
|
||||
|
||||
|
||||
def test_delete_where_analyze(fresh_db):
|
||||
table = fresh_db["table"]
|
||||
table.insert_all(({"id": i, "i": i} for i in range(10)), pk="id")
|
||||
table.create_index(["i"], analyze=True)
|
||||
assert "sqlite_stat1" in fresh_db.table_names()
|
||||
assert list(fresh_db["sqlite_stat1"].rows) == [
|
||||
{"tbl": "table", "idx": "idx_table_i", "stat": "10 1"}
|
||||
]
|
||||
table.delete_where("id > ?", [5], analyze=True)
|
||||
assert list(fresh_db["sqlite_stat1"].rows) == [
|
||||
{"tbl": "table", "idx": "idx_table_i", "stat": "6 1"}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue