[Tutor] Data storage, SQL?

Kent Johnson kent37 at tds.net
Fri Feb 11 12:00:34 CET 2005


Liam Clarke wrote:
> Hi, 
> 
> I'm looking to create a prog that will store disparate bits of info
> all linked together, i.e. address details for a person, transaction
> records, specific themes, and the ability to search by certain
> criteria, so I'm pretty sure I want a database.
> 
> Can anyone recommend a useful database library for Python that's not
> too complex?

Most Python database access modules implement the Python DB-API. This is a standard API created by 
the Python community. As a result most Python database libraries are pretty similar from the 
programmer's point of view.

See the Database Topic Guide for the DB-API spec and links to modules that support it.
http://www.python.org/topics/database/

> Also, I keep hearing about SQL, would this be the best way to go? I
> don't know much about databases.

SQL is a standardized language for giving commands to databases. Most (all?) industrial-strength 
databases use SQL as their command language. (DB-API is actually a wrapper around SQL - it 
standardizes the API to issue a SQL command and read the results.)

SQL is kind of a strange beast and has a style and learning curve all its own. It is worth learning 
if you expect to be using databases much in your future. There are some light-weight databases that 
don't use SQL (KirbyBase and MetaKit are two) but all of the major ones do.

A couple of pages that might help you make a choice:
http://www.python.org/moin/DatabaseInterfaces
http://www.python.org/moin/ChoosingDatabase

Note that DB-API and SQL don't provide 100% portability between databases; there are differences in 
the details that can trip you up.

Kent

> 
> Regards,
> 
> Liam Clarke



More information about the Tutor mailing list