[Tutor] storing dict objects in in a database through SQLObject
Kent Johnson
kent37 at tds.net
Mon Jul 3 17:39:43 CEST 2006
Emily Fortuna wrote:
> Hello all,
> I am experiementing in storing Python objects in a SQLite databse using
> SQLOjbect. I want to store dicts and tuples in the databse, but as far
> as I can tell the only way to do this is to create a PickleCol. Is
> there some other better way to store this data? EnumCol? Would a
> different database interface support this idea better?
What is in the dicts and tuples? It sounds like you haven't matched your
data structures and your database very well. To store a dict, maybe you
want a table of key/value pairs. For the tuples, if they are all the
same structure, each element of the tuple might correspond to a database
field and each tuple would be one database record.
I'm not to familiar with SQLObject but you might make a persistent class
for the key/value pair of the dictionary and another class to represent
the contents of a tuple.
Kent
More information about the Tutor
mailing list