Re: Dictionary or Database—Please advise

Luis M. González luismgz at gmail.com
Fri Feb 26 23:41:04 CET 2010


On Feb 26, 12:58 pm, Jeremy <jlcon... at gmail.com> wrote:
> I have lots of data 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?
> 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?
>
> Thanks,
> Jeremy

For small quantities of data, dicts are ok, but if your app
continually handles (and add) large quantities of data, you should use
a database.
You can start with sqlite (which is bundled with python) and it's much
easier to use than any other relational database out there.
You don't need to install anything, since it's not a database server.
You simply save your databases as files.
If you don't know sql (the standard language used to query databases),
I recomend this online tutorial: http://www.sqlcourse.com/

Good luck!
Luis



More information about the Python-list mailing list