By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,768 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,768 IT Pros & Developers. It's quick & easy.

Flat file, Python accessible database?

P: n/a
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...

--
_______ Karlo Lozovina - Mosor
| | |.-----.-----. web: http://www.mosor.net || ICQ#: 10667163
| || _ | _ | Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|
Nov 1 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Karlo Lozovina <_karlo_@_mosor.net_> writes:
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

--
Björn Lindström <bk**@stp.lingfil.uu.se>
Student of computational linguistics, Uppsala University, Sweden
Nov 1 '05 #2

P: n/a
Karlo Lozovina wrote:
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
Nov 1 '05 #3

P: n/a
On Nov 01, Karlo Lozovina wrote:
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/li...figParser.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

--
_ _ ___
|V|icah |- lliott http://micah.elliott.name md*@micah.elliott.name
" " """
Nov 1 '05 #4

P: n/a
bk**@stp.lingfil.uu.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in
news:87************@lucien.dreaming:
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 :).

--
_______ Karlo Lozovina - Mosor
| | |.-----.-----. web: http://www.mosor.net || ICQ#: 10667163
| || _ | _ | Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|
Nov 1 '05 #5

P: n/a
Karlo Lozovina wrote:
bk**@stp.lingfil.uu.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in
news:87************@lucien.dreaming:
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).


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
Nov 2 '05 #6

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


Although it doesn't support SQL queries, Metakit
(http://www.equi4.com/metakit/python.html) is a very lightweight and
easy to use db with a nicely pythonic API.

-alex23

Nov 2 '05 #7

P: n/a
>>>>> "Peter" == Peter Hansen <pe***@engcorp.com> writes:
Karlo Lozovina wrote:
bk**@stp.lingfil.uu.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote
in news:87************@lucien.dreaming:
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).

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

--
Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA
Web: http://employees.org/~rganesan | http://rganesan.blogspot.com

Nov 2 '05 #8

P: n/a
On Tue, 1 Nov 2005, Karlo Lozovina wrote:
bk**@stp.lingfil.uu.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in
news:87************@lucien.dreaming:
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.


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
--
rn*@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
Nov 2 '05 #9

P: n/a
Peter Hansen wrote:
Karlo Lozovina wrote:
bk**@stp.lingfil.uu.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in
news:87************@lucien.dreaming:

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).

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
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Nov 2 '05 #10

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


There are some suggestions in my EPC 2004 DB presentation:
http://www.thinkware.se/epc2004db/epc04_mly_db.pdf
Nov 2 '05 #11

P: n/a
Steve Holden wrote:
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
Nov 2 '05 #12

P: n/a
On Tue, 1 Nov 2005 21:02:20 +0000 (UTC), Karlo Lozovina <_karlo_@_mosor.net_> wrote:
bk**@stp.lingfil.uu.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) wrote in
news:87************@lucien.dreaming:
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 :(.


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

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Nov 9 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.