Re: Dictionary or Database—Please advise

CM cmpython at gmail.com
Fri Feb 26 15:27:06 EST 2010


On Feb 26, 10:58 am, Jeremy <jlcon... at gmail.com> wrote:
> I have lots of data

How much is "lots"?

> that I currently store in dictionaries.  However,
> the memory requirements are becoming a problem.  I am considering
> using a database of some sorts instead, but I have never used them
> before.  Would a database be more memory efficient than a dictionary?

What do you mean by more efficient?

> I also need platform independence without having to install a database
> and Python interface on all the platforms I'll be using.  Is there
> something built-in to Python that will allow me to do this?

The SQLite datbase engine is built into Python 2.5 and up.  I have
heard on this list that there may be problems with it with Python 2.6
and up on Linux, but I've stayed with 2.5 and it works fine for me on
WinXP, Vista, and Linux.

You can use it as a disk-stored single database file, or an in-memory-
only database.  The SQLite website (http://www.sqlite.org/) claims it
is the "most widely deployed SQL database engine in the world.", for
what that's worth.

Have a look at this:
http://docs.python.org/library/sqlite3.html

Che



>
> Thanks,
> Jeremy




More information about the Python-list mailing list