rows_where() and delete_where() fail to throw errors against non-existent tables (fix in v5)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 172
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
Pointed out in:
- #840
Currently this runs without throwing errors:
python -c 'import sqlite_utils
db = sqlite_utils.Database(memory=True)
print(list(db.table("does_not_exist").rows_where()))
db.table("does_not_exist").delete_where()'
But this does raise an error:
python -c 'import sqlite_utils
db = sqlite_utils.Database(memory=True)
print(db.table("does_not_exist").count_where())'
Raises:
sqlite3.OperationalError: no such table: does_not_exist
#840 proposed fixing count_where() to return 0. I think the fix is that those other two methods should raise an error, but since this would break compatibility I'm going to hold it for a future v5 version.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the Python implementations of rows_where(), delete_where(), and count_where(), then reproduce the missing-table behavior shown in the issue. Compare how these methods handle nonexistent tables; done means rows_where() and delete_where() raise the appropriate SQLite error, with coverage for both cases, while accounting for the stated v5 compatibility target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100