Message223725
There is significant overhead. Microbenchmark results:
$ ./python -m timeit -s "import sqlite3; con = sqlite3.connect(':memory:')" "con.execute('select 1 as a, 2 as b').fetchall()"
10000 loops, best of 3: 35.8 usec per loop
$ ./python -m timeit -s "import sqlite3; con = sqlite3.connect(':memory:'); con.row_factory = sqlite3.Row" "con.execute('select 1 as a, 2 as b').fetchall()"
10000 loops, best of 3: 37.3 usec per loop
$ ./python -m timeit -s "import sqlite3; con = sqlite3.connect(':memory:'); con.row_factory = sqlite3.NamedTupleRow" "con.execute('select 1 as a, 2 as b').fetchall()"
10000 loops, best of 3: 92.1 usec per loop
It would be easier to add __getattr__ to sqlite3.Row. |
|
Date |
User |
Action |
Args |
2014-07-23 05:51:21 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, ghaering, ncoghlan, eric.araujo, BreamoreBoy, petri.lehtinen, Russell.Sim |
2014-07-23 05:51:21 | serhiy.storchaka | set | messageid: <1406094681.75.0.179157839515.issue13299@psf.upfronthosting.co.za> |
2014-07-23 05:51:21 | serhiy.storchaka | link | issue13299 messages |
2014-07-23 05:51:21 | serhiy.storchaka | create | |
|