Flat file, Python accessible database?

K

Karlo Lozovina

I've been Googling around for _small_, flat file (no server processes),
SQL-like database which can be easily access from Python. Speed and
perforamnce are of no issue, most important is that all data is contained
within single file and no server binary has to run in order to use the
dbase. Oh, and I'm using Python under Cygwin.

Ofcourse, ease of use and simplicity is most welcomed :). I'm currently
playing around SQLite+PySQLite and BerkeleyDB, but those two seem like an
overkill :(.

Thanks in advance...
 
G

Guest

Karlo Lozovina said:
I've been Googling around for _small_, flat file (no server
processes), SQL-like database which can be easily access from Python.

If you need it to be SQL-like, SQLite seems to be the right thing.

It's not clear to me what you mean by "flat" file here, but if you mean
it should be human readable, maybe the csv module is the thing.

http://docs.python.org/lib/module-csv.html
 
K

Kent Johnson

Karlo said:
I've been Googling around for _small_, flat file (no server processes),
SQL-like database which can be easily access from Python. Speed and
perforamnce are of no issue, most important is that all data is contained
within single file and no server binary has to run in order to use the
dbase. Oh, and I'm using Python under Cygwin.

Depending on what you mean by "SQL-like" you might like KirbyBase
http://www.netpromi.com/kirbybase.html

Kent
 
M

Micah Elliott

I've been Googling around for _small_, flat file (no server
processes), SQL-like database which can be easily access from
Python. Speed and perforamnce are of no issue, most important is
that all data is contained within single file and no server binary
has to run in order to use the dbase. Oh, and I'm using Python under
Cygwin.

Ofcourse, ease of use and simplicity is most welcomed :). I'm
currently playing around SQLite+PySQLite and BerkeleyDB, but those
two seem like an overkill :(.

Not sure about "SQL-like", but the conf/ini file type could be
considered a reasonable database format for simple needs, and is
easy to parse/write. The ConfigParser is documented here:

http://www.python.org/doc/current/lib/module-ConfigParser.html

And Fredrik Lundh's examples usage is here:

http://effbot.org/librarybook/configparser.htm

And the Initialization File format is described here:

http://en.wikipedia.org/wiki/INI_file
 
K

Karlo Lozovina

(e-mail address removed) (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in
If you need it to be SQL-like, SQLite seems to be the right thing.

Tried that one, but had some problems setting things up. On the other
hand, BerkeleyDB + Pybsddb worked like a charm, with no setting up (under
Cygwin).

The problem is, Pybsddb is as badly documented as Windows Registry, no
examples, no tutorials, no nothing :(. Does anyone have some small
(possibly documented) Python program which does some basic database
routines - select, insert, and such?
It's not clear to me what you mean by "flat" file here, but if you mean
it should be human readable, maybe the csv module is the thing.
http://docs.python.org/lib/module-csv.html

Well, no, that's not it, but anyway thnx for the link, I need to parse a
lot of CSV files, so this will speed me up :).
 
P

Peter Hansen

Karlo said:
(e-mail address removed) (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in


Tried that one, but had some problems setting things up. On the other
hand, BerkeleyDB + Pybsddb worked like a charm, with no setting up (under
Cygwin).

I'm very curious what problems you had. In my experience SQLite
requires *nothing* I'd call "setup". You install Pysqlite or APSW,
write your code, and it runs and works. There are no configuration
steps required, nothing but creating tables (and that's a standard step
with any SQL-like database). What environment were you using, and what
kind of issues did you encounter? (I ask because I often recommend
SQLite, but would like to temper that advice if in some cases these
setup problems would cause someone trouble.)

-Peter
 
R

Roman Suzi

(e-mail address removed) (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in


Tried that one, but had some problems setting things up.

That is strange. SQLite + PySQLite are IMHO no harder
to install than BerkeleyDB + Pybsddb...

On the other
hand, BerkeleyDB + Pybsddb worked like a charm, with no setting up (under
Cygwin).

Sincerely yours, Roman Suzi
 
G

Ganesan Rajagopal

I'm very curious what problems you had. In my experience SQLite
requires *nothing* I'd call "setup". You install Pysqlite or APSW,
write your code, and it runs and works.

I imagine that's the "setup" OP is talking about. You need to install it
separately as opposed to bsddb. I wish SQLite is bundled with Python 2.5. To
the OP, you could try gadfly (http://gadfly.sourceforge.net/gadfly.html) or
KirbyBase (http://www.netpromi.com/kirbybase.html) but they are also
separate packages to install. I would personally stick with SQLite.

Ganesan
 
S

Steve Holden

Peter said:
I'm very curious what problems you had. In my experience SQLite
requires *nothing* I'd call "setup". You install Pysqlite or APSW,
write your code, and it runs and works. There are no configuration
steps required, nothing but creating tables (and that's a standard step
with any SQL-like database). What environment were you using, and what
kind of issues did you encounter? (I ask because I often recommend
SQLite, but would like to temper that advice if in some cases these
setup problems would cause someone trouble.)

-Peter

My experience on Cygwin was that I had to install sqlite before pySqlite
worked. Maybe that's what was meant.

regards
Steve
 
P

Peter Hansen

Steve said:
My experience on Cygwin was that I had to install sqlite before pySqlite
worked.

So although the Windows install of Pysqlite bundles a .pyd that includes
the statically linked sqlite library, other platforms do not? I agree
that would represent a potentially annoying extra setup step.

-Peter
 
J

Jorgen Grahn

(e-mail address removed) (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in


Tried that one, but had some problems setting things up. On the other
hand, BerkeleyDB + Pybsddb worked like a charm, with no setting up (under
Cygwin).

The problem is, Pybsddb is as badly documented as Windows Registry, no
examples, no tutorials, no nothing :(.

What about the standard module bsddb, then? It's not a /relational/ database
though, if that is what you're looking for. But it's simple to understand,
well documented, and unbelievably fast.

/Jorgen
 

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

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top