[Zope-dev] SQLite as a Light DB component for Zope and Python

William Trenker wtrenker@shaw.ca
Tue, 02 Apr 2002 12:17:56 -0800


--Boundary_(ID_Dd32iz5Sb9+GTpNh3rFFYA)
Content-type: text/plain; x-avg-checked=avg-ok-26257225; charset=us-ascii;
 format=flowed
Content-transfer-encoding: 7BIT

At 10:45 AM 4/2/02 -0600, "Ross J. Reedstrom" <reedstrm@rice.edu> wrote:
>Scale, as in multiuser? Hardly at all: it's an SQL library that accesses a 
>single, textbased, flatfile for the entire database.

>As a lightweight replacement for gadfly, it looks like it might be pretty 
>good.

Exactly.  I'm proposing this as a lightweight component, just as you say, 
not as a replacement for something like MySQL or PostgreSQL.  What I have 
in mind is a small, simple, built-in SQL engine that could be used as a 
step up from something like TinyTablePlus in Zope and be compact enough to 
even be considered as a module candidate for the standard Python library.

>Note that the scripting language of choice of the author seems to be Tcl, 
>rather than Python. This probably explains the 'everything is a string' 
>approach :-)

If you look into the C interface you will find it is almost trivial to 
build a Python extension module and "bring" SQLite into the realm of Python 
scripting.  SQLite also has it's own C interface for adding expression 
functions and aggregates to the SQL syntax.  I expect this could be hooked 
into Python through the Python extension interface as a callback.

Again, the "everything is a string" approach fits in with the idea of 
"simple, lightweight".  Mind you, SQLite supports SQL expressions so it can 
do things like "SELECT * FROM my_table WHERE my_field / 2 > 23.8", or 
"INSERT INTO my_table VALUES (100 / 30.0)".  SQLite does implicit 
conversions, as required.

>The speed comparisions with PostgreSQL are very much an apples vs. fish 
>sort of thing: the pgsql server was not tuned _at all_, and does a whole 
>lot more that was never tested, such as multi-user writer access.

You could be right.  I'm not an expert with PostgreSQL so I can't 
comment.  But, at the risk of being repetitious, I'm thinking 
"lightweight".  My intent is to propose a small relational tool  that 
doesn't impose a significant overhead on the host system and might be 
simple enough that the Zope and Python developers would consider SQLite, 
together with a Python DB API and Zope DA, for their standard libraries.

Thanks for commenting,
Bill



"The commandments of the LORD are right, bringing joy to the heart. The 
commands of the LORD are clear, giving insight to life . . . For this is 
the love of God, that we keep His commandments. And His commandments are 
not burdensome." (Psalm 19:8, 1John 
5:3)    <http://torahteacher.com/>torahteacher.com

--Boundary_(ID_Dd32iz5Sb9+GTpNh3rFFYA)
Content-type: text/plain; charset=us-ascii; x-avg=cert;
 x-avg-checked=avg-ok-26257225
Content-transfer-encoding: 7BIT
Content-disposition: inline


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.343 / Virus Database: 190 - Release Date: 3/22/02

--Boundary_(ID_Dd32iz5Sb9+GTpNh3rFFYA)--