9.3 - dbtxt - A tiny PD database in Python
I wrote dbtxt because I needed a small, flat database in a python environment that didn't depend upon any external libraries. Most libraries are contaminated with the GPL, and this needed to be OK for commercial distribution without any complications. So that's what we have here - a complete (though small) database system that depends on nothing at all other than the Python language and its internal libraries. The entire database comes in at about 20k bytes (that's right, "k", not hundreds of k or megabytes) and I was able to implement all the functions I needed. So I was happy. Will you be happy? Well, download it and read the docs and see what you think. The download, zipped, is about 13k. Yep. 13k. :-)
By all means, if you have a need for the same kind of thing, feel free to make any use of dbtxt you please. I have released it as PD, so you can use it in projects that are commercial, GPL, BSD, PD, private, government... whatever you like. Below you'll find a basic description taken from beginning of the docs; in the archive you'll download there is complete documentation, two sample databases, a test program and the database engine itself.
9.3.1 - Why PD and not GPL?
Because I want to give this to the entire community without any obligations in either direction, and the GPL cannot accomplish this. Frankly, I'm not a fan of the GPL. I feel that it is more about restriction and class warfare than it is about freedom. PD is about freedom. And I do want this to be free.
9.3.2 - What about changes?
If you make any, feel free to let me know. Or not, as you please. If I make any, I'll post them here. Observe the version number and compare to what you're using. If it is different, then something has been updated. It's as simple as that.
9.3.3 - Installation
All you really need to know is that the archive is flat, that is, unpacking it will not create a sub-directory. The files will be extracted in the directory or folder you are presently located in. So if you want this in a particular folder, either create it if you need to, and navigate to it before you extract the files, or you'll just have to move them afterwards. The only file you need to add to your own projects is dbtxt.py, everything else is either documentation or related to tutorial matters.
So here's what it's all about:
9.3.4 - BETA version 1.1 for the bold
Version 1.1 adds the binary field type (and so can handle extended character sets or things like jpeg images) and floating point field types, time and date capability, and more documentation. This is a beta version, particularly in that the new capabilities need testing. By all means, please do so and if you find any problems, let me know. Download BETA version 1.1 here.
9.3.5 - version 1.0 for the wary
class dbtxt() - Download Here
Incept Date: Thursday, April 7th, 2005, MST
Hours invested: April 7th/4, 8th/4, 9th/12, 11th/2
Last Prodding: Monday, April 11th, 2005, MST
Author: Black Belt Systems/CBB
Disclaimer: No obligations. For anything. Use at your own risk.
What it's For: Tiny db applications. No mysql, postgresql? Try this.
License: None. PD. 100% Free Sofware. Use it any way you like.
Bug reports to: firstname.lastname@example.org
Changes: 1.0: This is the out-of-the-gate release.
Class dbtxt() provides the following features:
o Class dbtxt() is small! 20k for a working database? Yupper, you betcha!
o You need... nothing else. Nothing. Python2.2.2+class dbtxt(), you're good to go.
o Table level data management, one table at a time
o Integer and text field types
o Skeletal (muhahahahahhh) SQL-like query/command language
o Memory consumption linear with query result size
o Ability to automatically reuse deleted table rows
o Ability to NOT automatically reuse rows (faster)
o Case sensitive and insensitive layered order by clauses
o Packed ASCII database is moderately efficient AND readable, includes field cues
o Multiple reading clients, no limits. Notice READING clients!
o Reasonable error messages and dead-quiet failure modes
o Command language:
o pack -- allows you to re-pack a database with deleted rows
o create -- create a database table, optionally overwrite
o insert -- add a record to a table, optionally reusing dead rows
o delete -- row delete
o undelete -- undo deleted rows (if not re-using dead rows)
o update -- change data in existing rows
o select -- select rows from the database
Class dbtxt() presently labors under the following limitations:
o One user and one thread per table if you're writing anything. PERIOD! (Python doesn't support file locking)
o Where clauses don't do math. They do logic only.
o ASCII characters up to 127 *ONLY*. 128 and higher are used internally. I warned you. (except v1.1+)
o There are no auto-incrementing field types
o class dbtxt() doesn't implement indexes. Slower, but very memory-friendly.
o Most of SQL is missing, and it isn't exactly SQL anyway. So take off.
o You can't alter the structure of an already existing table. Unless deleting it.
(but you *can* create a new one and load the old data into it)
Systems that have been able to run class dbtxt():
o RH9 Linux and Python 2.2.2 with dbtxt() 1.0
o Debian (unknown revision) and Python 2.2.1 with dbtxt() 1.0
o Mac OS X 10.3, 10.4 and 10.5 and the supplied Python with dbtxt() 1.0
Have a comment for me? Click here.