persistent dictionary with non-string keys

S

San71

I'm writing an application which creates a rather large dictionary (>
500 MB) from MySQL data. It is a dictionary which uses integers,
tuples, and datetime instances as keys. I've tried shelve (str() en
eval() for the integer and tuples), but of course, that doesn't solve
it, because I also need to keep the datetime instances intact as a
key. Is there a way to make this dictionary persistent?
 
L

Larry Bates

Can't you just create indexes on the items that you
use as dictionary keys in the MySQL database and
look them up as you need them (MySQL is blazingly
fast reading indexed data)? You could create
a dictionary-like class wrapper around the SQL
access so that it "looks" like a regular dictionary
to main program. You could also cache information
in this class, if data access is such that caching
would speed up entries that are frequently accessed.

If not, you may want to take a look at Gadfly:

http://gadfly.sourceforge.net/gadfly.html

HTH,
Larry Bates
Syscon, Inc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,122
Latest member
VinayKumarNevatia_
Top