sqlite3 or mysqldb?

Jarek Zgoda jzgoda at o2.usun.pl
Thu Aug 17 16:40:16 EDT 2006


John Salerno napisał(a):

> I did a little experimentation with MySQL, and yesterday I was reading
> up on SQLite. Since they both use the SQL language, does this mean that
> the queries you write will be the same for both modules? I'm sure there
> are slight differences for how you connect to DBs, but since they both
> use the same DB API 2.0, and both use SQL, I was wondering how easily
> you could 'switch' them out if you needed to go from one to the other.
> 
> (I know there are slight differences between the two in terms of SQL
> commands understood, but I'm mainly referring to the most important
> things, like simply accessing and changing DB information.)
> 
> I was using mysqldb just because MySQL seems to be a pretty big
> standard, but now that sqlite3 is coming with Python 2.5, I might
> switch, since it seems to be easier to use.
> 
> (And again, I'm such an amateur programmer that really I'm using these
> things just to learn them. It's not like I control my company's entire
> employee records or anything.)   :)

To learn SQL SQLite should be enough - it has all the basics, just as
MySQL, while it doesn't require any server/client configuration
(encoding configuration in MySQL is real PITA). But if you want any
"serious SQL", go with any freely available *real SQL server*, like
Firebird or PostgreSQL. I'd consider Firebird, as it's pretty lightweight.

In theory, switching from one db backend to another should go without
problem (at least at ANSI SQL level), but usually requires much work, so
it's rather rare practice. While basics, like DML or DDL syntax, remain
similar, often particular backends require specific tweaks and
optimizations to get desired level of efficiency. You know, this part of
application is a bottleneck.

-- 
Jarek Zgoda
http://jpa.berlios.de/



More information about the Python-list mailing list