[issue13299] namedtuple row factory for sqlite3
Serhiy Storchaka
report at bugs.python.org
Wed Jul 23 07:51:21 CEST 2014
Serhiy Storchaka added the comment:
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.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13299>
_______________________________________
More information about the Python-bugs-list
mailing list