python an sqlite objects

eric eric at
Wed Dec 3 22:55:42 CET 2008

On Dec 3, 10:21 pm, Gerhard Häring <g... at> wrote:
> azrael wrote:
> > It logical that it would be more efficient and logical to use a object
> > oriented database, but in this case I ask because of the portable
> > nature of sqlite.
> > so, if I get it right, this should be possible [...]
> Did you try it? Did it work? If so,it was pure luck. Attached is a
> script that shows how to do it right.
> -- Gerhard
> 1KViewDownload


it is also possible to use Google Protobuf (
)  instead of pickle or json
 - it's portable to other languages too
 - you define what's the data you really wan't
 - it's fast, and compact

I've done it on one of my projects ( see the code here
), and using BerkeleyDB instead of sqlite( but that's not the point

What I like with protobuf is that writing the proto file defines the
real data structure, and that's a guaranty over time/processes/coders.
I don't recommand using pickle to serialise object in a database.
Because, it's easy at the beginning, but later, when you are going to
'upgrade' your objects (adding some new fields for instance, or
splitting a field into a new object), you'll get a lot of troubles
( keeping the legacy object to live with the new one, implies renaming
all objects ? etc.). That's what protobuf is for.

BTW, I'm seeking help to start a new project that would connect
protobuf to Database, like the piece of code I've done with
berkeleyDB, but at a bigger scale. If anyone is interested.

More information about the Python-list mailing list