Repository navigation
sqlite3 docs: extract row factory examples into row factory howto #96168
Copy link
Copy link
Closed
Labels
Description
Activity
- addeddocsDocumentation in the Doc dirDocumentation in the Doc dir
on Aug 22, 2022 Seems reasonable to me—short-ish examples are reasonable for a reference, but advice like
If returning a tuple doesn’t suffice and you want name-based access to columns, you should consider setting row_factory to the highly optimized sqlite3.Row type. Row provides both index-based and case-insensitive name-based access to columns with almost no memory overhead. It will probably be better than your own custom dictionary-based approach or even a db_row based solution.
is much more appropriate in a how-to, or perhaps actually an explanation (but there isn't really enough meat for that, and a how-to is certainly closer than a reference here)
Reacted by Erlend E. AaslandAs a first step, I suggest to improve the dict-factory example by:
- modernising the code; we can use a dict comprehension
- using a doctest, so the expected output is visible
- SELECTing a row with multiple columns, so the effect of the dict factory becomes clearer
Reacted by C.A.M. Gerlach- added a commit that references this issue
on Aug 31, 2022 - added a commit that references this issue
on Sep 1, 2022 - added a commit that references this issue
on Nov 25, 2022 - added 4 commits that reference this issue
on Nov 25, 2022
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
There are several row factory examples scattered around the sqlite3 docs. Most of them in various places in the reference. Suggesting to extract them and create a row factory How-to Guide, in order to clean up the reference and reduce duplication of information.
gh-96168: Improve sqlite3 dict_factory example #96457
[3.11] gh-96168: Improve sqlite3 dict_factory example (GH-96457) #96494
[3.10] gh-96168: Improve sqlite3 dict_factory example (GH-96457) #96495
gh-96168: Add sqlite3 row factory how-to #99507
[3.11] gh-96168: Add sqlite3 row factory how-to (GH-99507) #99778
[3.10] gh-96168: Add sqlite3 row factory how-to (GH-99507) #99779