This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author exarkun
Recipients erno, exarkun, ghaering, gregburd, gregory.p.smith, jcea, josiahcarlson, pitrou, rhettinger, skip.montanaro
Date 2009-01-30.01:37:33
SpamBayes Score 4.61052e-09
Marked as misclassified No
Message-id <1233279455.99.0.780871147893.issue3783@psf.upfronthosting.co.za>
In-reply-to
Content
Some comments on tmp_dev_shelver.py...

Regarding SQLhash.__init__, it would be better to avoid relying on the
"sqlite_master" table by using the CREATE TABLE IF NOT EXISTS form of
table creation.

Setting the isolation_level in __init__ will have essentially no effect
on this code because there is currently no transaction management in the
code.  However, the rest of the code also has almost no effect, because
there are no commits anywhere in SQLhash.  All the data is always lost
when the connection is closed.

Regarding the XXX in SQLhash.__len__, there is no faster way using
"sqlite_master".  There is basically just one way to make COUNT(*) fast.
 Keep track of the count in the database (update it on inserts and
deletes).  Then, use that instead of using COUNT(*).

Once there is some use of transactions, it will indeed be important, in
DBhash.__setitem__, to make sure the delete and the insert are in the
same transaction.  Actually, a different approach would be better,
though.  INSERT OR REPLACE INTO will let you replace a row's value with
one statement.  It's also faster, since the row only has to be found once.

Additionally, an index on the key column will assist performance
substantially for large data sets.
History
Date User Action Args
2009-01-30 01:37:36exarkunsetrecipients: + exarkun, skip.montanaro, rhettinger, gregory.p.smith, jcea, ghaering, josiahcarlson, pitrou, erno, gregburd
2009-01-30 01:37:35exarkunsetmessageid: <1233279455.99.0.780871147893.issue3783@psf.upfronthosting.co.za>
2009-01-30 01:37:34exarkunlinkissue3783 messages
2009-01-30 01:37:33exarkuncreate