[Tutor] Python database options

Pijus Virketis virketis@fas.harvard.edu
Mon, 11 Feb 2002 10:13:59 -0500


> 5. Postgres, MySQL + Python bindings

I suggest you pick one of these databases, and move your data to it. My
reasoning is rather simple: both of them are free, they will give you great
speed and flexibility, and, perhaps most important, if you want to do
something a bit more sophisticated later on, they will scale and expand
nicely. And trust me, once you have, say, a MySQL db set up, you will
immediately think of five interesting ways to slice and dice your data ...

The actual process of moving should be fairly straightforward. MySQL and
probably Postgres should come standard with your RH distro. The Python
interface to the former is here:
http://sourceforge.net/projects/mysql-python/ and for the latter here
http://sourceforge.net/projects/pypgsql/. Check out the docs for the Python
DB API and other interesting info here:
http://www.python.org/topics/database/. Then, it's just a question of
opening up a connection, reading your 150000 lines one by one, and inserting
them into the table. While you're at it, you might want to normalise it as
well, since 10 fields sounds a bit much. :)