mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Added db[table].rows iterator
This commit is contained in:
parent
62e1edeaf6
commit
3095f2e671
3 changed files with 26 additions and 0 deletions
|
|
@ -52,6 +52,17 @@ You can also iterate through the table objects themselves using the ``.tables``
|
|||
>>> db.tables
|
||||
[<Table dogs>]
|
||||
|
||||
Listing rows
|
||||
============
|
||||
|
||||
To iterate through dictionaries for each of the rows in a table, use ``.rows``::
|
||||
|
||||
>>> db = sqlite_utils.Database("dogs.db")
|
||||
>>> for row in db["dogs"].rows:
|
||||
... print(row)
|
||||
{'id': 1, 'age': 4, 'name': 'Cleo'}
|
||||
{'id': 2, 'age': 2, 'name': 'Pancakes'}
|
||||
|
||||
Creating tables
|
||||
===============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue