[Tutor] Python DB

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Sep 22 20:55:21 CEST 2005



On Thu, 22 Sep 2005, Matt Williams wrote:

> The problem (I have) with SQL-type DB is that I cannot be sure ahead of
> time of the exact data structure. The DB will be about patients, who
> have diseases, and also have treatments.....Clearly, I can't specify now
> the exact structure of the table. The advantage of SQL is that you can
> (in general) do things like constrain types for fields, and give
> enumerated options, which makes the data more consistent.

Hi Matt,

But another kind of advantage of SQL is that it can accomodate ad-hoc
queries.  That's a big one, since it means that if the requirements
change, the database can usually handle it efficiently.  Object databases
are tied to a particular structure and access pattern, so they may not be
so adaptable to different access patterns.

I'm also not quite seeing how an object database like ZODB will allow you
to escape planning about how to represent patients, diseases, and
treatement data.  And SQL databases may be more flexible to structural
change than you might expect.

SQLite is a lightweight database that you might want to consider:

    http://www.sqlite.org/
    http://initd.org/projects/pysqlite

and SQLite does have enough support for ALTER TABLE to let you change the
database structure as the problem statement solidifies:

    http://sqlite.org/faq.html#q13

Best of wishes to you!



More information about the Tutor mailing list