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 <[email protected]>
<http://bugs.python.org/issue13299>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com