forked from orbit-oss/flask
Use sqlite3.Row factory in Flaskr
As pointed out in issue #588 sqlite3.Row should be used instead of using casting to dict(). Also altered the "Easy Querying" Patterns example to include the more correct way to return rows as dicts. Did not touch Tutorial examples ("Views"), as these are not up to date with the current Flaskr code, and the "Show Entries" section points out the "Easy Querying" section on how to convert to a dict().
This commit is contained in:
parent
2b885ce4dc
commit
82b29c09ac
2 changed files with 9 additions and 2 deletions
|
|
@ -76,6 +76,10 @@ dictionaries instead of tuples this can be used::
|
|||
|
||||
db.row_factory = make_dicts
|
||||
|
||||
Or even simpler::
|
||||
|
||||
db.row_factory = sqlite3.Row
|
||||
|
||||
Additionally it is a good idea to provide a query function that combines
|
||||
getting the cursor, executing and fetching the results::
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue