[Tutor] Re: Data storage, SQL?

Kent Johnson kent37 at tds.net
Sun Feb 13 14:00:38 CET 2005


Liam Clarke wrote:
> ...So,  trying to get this straight - if I were going to use SQLite,
> what would I actually download from http://www.sqlite.org/sqlite.html
> ?

SQLite itself does not use / interface with Python. So you would download the appropriate version of 
SQLite for your platform from http://www.sqlite.org/download.html. Then get the matching release of 
pysqlite from http://sourceforge.net/projects/pysqlite/ - this is the Python interface to SQLite.

> Also, would Gadfly be easier, being native Python?

Gadfly might be a little easier to install since there is only one piece. Both Gadfly and SQLite 
have DB-API compliant drivers and use SQL for their command language, so in use they will be 
similar. Gadfly keeps the database in memory so for large amounts of data it won't work. I think 
SQLite has been around longer than Gadfly so it may be more mature.

If you want a simple database with a Pythonic interface, take a look at KirbyBase. Though from your 
brief description I think you will want a database that supports joins.

There is a great variety of databases usable from Python. Most of them use DB-API and SQL for the 
interface, so you have to pick one based on features. I guess I see three rough categories.

<disclaimer>
This is a rough opinion based on reading about these databases. My own experience is with MS SQL 
Server, PostgreSQL and MS Access.
</disclaimer>

At the top of the heap are the industrial strength databases. This includes free products like 
MySQL, PostgreSQL and Firebird as well as commercial products like MS SQL Server, Sybase and Oracle. 
These databases will take anything you can throw at them with style and aplomb. (MySQL is probably 
the most limited of this category but it is widely used and clearly quite capable.) They are well 
supported with tools and they are used in a wide variety of projects.

In the middle tier are databases that are not as full featured but still very usable for small to 
midsize work. I would put SQLite and Gadfly into this category. Some people would argue that MySQL 
belongs here. These databases will be missing features like transactions, large database support, 
unicode support...

In the bottom tier are programs that are more of a persistence mechanism than a true database. I put 
KirbyBase here along with the standard Python shelve and dbm modules.


OK...I don't know if this has been any help...I suggest you look at the *features* of SQLite and 
Gadfly and see if either is missing anything you need.


Finally, you might want to look at SQLObject. This is a wrapper on top of the database that makes 
your objects persist themselves. It shields you from DB-API and SQL. http://sqlobject.org

HTH,
Kent

> 
> Regards, 
> 
> Liam Clarke
> 
> 
> On Sat, 12 Feb 2005 14:27:21 +0500, Sandip Bhattacharya
> <sandip at lug-delhi.org> wrote:
> 
>>On Fri, 11 Feb 2005 20:09:10 +1300, 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?
>>>Also, I keep hearing about SQL, would this be the best way to go? I
>>>don't know much about databases.
>>
>>You can take a look at sqlite
>>(http://www.sqlite.org/). It doesn't require a client
>>server setup, and offers you the same sql syntax for manipulating data on
>>it.
>>
>>Some amazing facts about this from the website:
>>
>>[...]
>>SQLite is a small C library that implements a self-contained,
>>embeddable, zero-configuration SQL database engine. Features include:
>>
>>* Transactions are atomic, consistent, isolated, and durable  (ACID)
>>    even after system crashes and power failures.
>>* Zero-configuration - no setup or administration needed.
>>* Implements most of SQL92.
>>* A complete database is stored in a single disk file.
>>* Database files can be freely shared between machines with
>>  different byte orders.
>>* Supports databases up to 2 terabytes (2^41 bytes) in size.
>>* Sizes of strings and BLOBs limited only by available memory.
>>* Small code footprint: less than 30K lines of C code, less
>>    than 250KB code space (gcc on i486)
>>* Faster than popular  client/server database engines
>>  for most common operations.
>>* Simple, easy to use API.
>>* Well-commented source code with over 95% test coverage.
>>* Self-contained: no external dependencies.
>>* Sources are in the public domain. Use for any purpose.
>>
>>The SQLite distribution comes with a standalone command-line access
>>program (sqlite) that can be used to administer an SQLite database and
>>which serves as an example of how to use the SQLite library.
>>
>>[...]
>>
>>- Sandip
>>
>>--
>>Sandip Bhattacharya    *    Puroga Technologies   *     sandip at puroga.com
>>Work: http://www.puroga.com   *    Home/Blog: http://www.sandipb.net/blog
>>
>>PGP/GPG Signature: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3
>>
>>
>>_______________________________________________
>>Tutor maillist  -  Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>
> 
> 
> 



More information about the Tutor mailing list