Skip to content

rows_where() and delete_where() fail to throw errors against non-existent tables (fix in v5) #841

Description

@simonw

Pointed out in:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions