ANN: KirbyBase 2.0 beta 1

J

Jamey Cribbs

I would like to announce the first beta of version 2 of KirbyBase, a
simple, pure-Python database management system that stores it's data in
plain-text files. Version 2 is a total rewrite of the code, a major
change in the api, and a major improvement (I hope) in the syntax used
to express queries, inserts, and updates.

Because of the dramatic changes, I wanted to get this beta out in the
hopes that I can get some early feedback on the new api and syntax,
before releasing version 2.

You can download the beta from here:

http://www.netpromi.com/files/KirbyBase_Python_2.0_beta_1.zip


Included in the zip file is a script, kbtest.py that has numerous
examples of the new syntax. I'll try to give you a small flavor of it here:

To specify a select query in the old version of KirbyBase you would do
something like this:

db.select('plane.tbl', ['country', 'speed'], ['USA', '> 300'])

which says, "Select all planes from the US with a speed greater than 300mph.

In the new version of KirbyBase you could state the query using named
arguments:

plane_tbl.select(country='USA', speed='> 300')

or, using a dictionary:

plane_tbl.select({'country': 'USA', 'speed': '> 300'})

or, you could even use a lambda, like this:

plane_tbl.select(lambda r: r.country == 'USA' and r.speed > 300)

I personally prefer the latter, but I realize that lambda's are quite
controversial just now, so I offer alternative ways to specify select
criteria. One of the cool things about using lambdas is that it gives
you more power in your selects, like being able to use regular
expressions and being able to use "or" logic.

Anyway, this is just a small taste of the changes. The changes actually
go much deeper and, I think, make the resulting api much more
"Pythonic". About the only thing that hasn't changed is the table
structure in the physical file (well, there is one small change, but it
is easily made).

It is currently a good bit slower than the current version of KirbyBase;
I will work on optimizing it after the api is frozen.

For those of you who have used the Ruby version of KirbyBase, this new
Python version closely resembles that, while trying to be as Python-like
as possible.

There is no manual yet, but I think you can get a good feel for the
differences by looking at kbtest.py.

I would be very interested in any feedback you can give me on the new
version.

Jamey Cribbs

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top