Added table.rows_where(where, args) method

This commit is contained in:
Simon Willison 2019-07-14 11:58:40 -07:00
commit f70e35c9bb
3 changed files with 36 additions and 1 deletions

View file

@ -65,6 +65,13 @@ To iterate through dictionaries for each of the rows in a table, use ``.rows``::
{'id': 1, 'age': 4, 'name': 'Cleo'}
{'id': 2, 'age': 2, 'name': 'Pancakes'}
You can filter rows by a WHERE clause using ``.rows_where(where, where_args)``::
>>> db = sqlite_utils.Database("dogs.db")
>>> for row in db["dogs"].rows_where("age > ?", [3]):
... print(row)
{'id': 1, 'age': 4, 'name': 'Cleo'}
Creating tables
===============