Author serhiy.storchaka
Recipients BreamoreBoy, Russell.Sim, eric.araujo, ghaering, ncoghlan, petri.lehtinen, rhettinger, serhiy.storchaka
Date 2014-07-23.05:51:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406094681.75.0.179157839515.issue13299@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-07-23 05:51:21serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, ghaering, ncoghlan, eric.araujo, BreamoreBoy, petri.lehtinen, Russell.Sim
2014-07-23 05:51:21serhiy.storchakasetmessageid: <1406094681.75.0.179157839515.issue13299@psf.upfronthosting.co.za>
2014-07-23 05:51:21serhiy.storchakalinkissue13299 messages
2014-07-23 05:51:21serhiy.storchakacreate