Flat file, Python accessible database?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karlo Lozovina

    #1

    Flat file, Python accessible database?

    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.
    |__|_|__||_____ |_____|
  • Björn Lindström

    #2
    Re: Flat file, Python accessible database?

    Karlo Lozovina <_karlo_@_mosor .net_> writes:
    [color=blue]
    > I've been Googling around for _small_, flat file (no server
    > processes), SQL-like database which can be easily access from Python.[/color]

    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.

    Source code: Lib/csv.py The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to att...


    --
    Björn Lindström <bkhl@stp.lingf il.uu.se>
    Student of computational linguistics, Uppsala University, Sweden

    Comment

    • Kent Johnson

      #3
      Re: Flat file, Python accessible database?

      Karlo Lozovina wrote:[color=blue]
      > 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.[/color]

      Depending on what you mean by "SQL-like" you might like KirbyBase


      Kent

      Comment

      • Micah Elliott

        #4
        Re: Flat file, Python accessible database?

        On Nov 01, Karlo Lozovina wrote:[color=blue]
        > 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 :(.[/color]

        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:



        And Fredrik Lundh's examples usage is here:



        And the Initialization File format is described here:



        --
        _ _ ___
        |V|icah |- lliott http://micah.elliott.name mde@micah.ellio tt.name
        " " """

        Comment

        • Karlo Lozovina

          #5
          Re: Flat file, Python accessible database?

          bkhl@stp.lingfi l.uu.se (=?utf-8?Q?Bj=C3=B6rn_ Lindstr=C3=B6m? =) wrote in
          news:877jbsxnrx .fsf@lucien.dre aming:
          [color=blue]
          > If you need it to be SQL-like, SQLite seems to be the right thing.[/color]

          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?
          [color=blue]
          > 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[/color]

          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.
          |__|_|__||_____ |_____|

          Comment

          • Peter Hansen

            #6
            Re: Flat file, Python accessible database?

            Karlo Lozovina wrote:[color=blue]
            > bkhl@stp.lingfi l.uu.se (=?utf-8?Q?Bj=C3=B6rn_ Lindstr=C3=B6m? =) wrote in
            > news:877jbsxnrx .fsf@lucien.dre aming:
            >[color=green]
            >>If you need it to be SQL-like, SQLite seems to be the right thing.[/color]
            >
            > 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).[/color]

            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

            Comment

            • alex23

              #7
              Re: Flat file, Python accessible database?

              Karlo Lozovina wrote:[color=blue]
              > I've been Googling around for _small_, flat file (no server processes),
              > SQL-like database which can be easily access from Python.[/color]

              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

              Comment

              • Ganesan Rajagopal

                #8
                Re: Flat file, Python accessible database?

                >>>>> "Peter" == Peter Hansen <peter@engcorp. com> writes:
                [color=blue]
                > Karlo Lozovina wrote:[color=green]
                >> bkhl@stp.lingfi l.uu.se (=?utf-8?Q?Bj=C3=B6rn_ Lindstr=C3=B6m? =) wrote
                >> in news:877jbsxnrx .fsf@lucien.dre aming:
                >>[color=darkred]
                >>> If you need it to be SQL-like, SQLite seems to be the right thing.[/color]
                >> 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).[/color][/color]
                [color=blue]
                > 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.[/color]

                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

                Comment

                • Roman Suzi

                  #9
                  Re: Flat file, Python accessible database?

                  On Tue, 1 Nov 2005, Karlo Lozovina wrote:
                  [color=blue]
                  > bkhl@stp.lingfi l.uu.se (=?utf-8?Q?Bj=C3=B6rn_ Lindstr=C3=B6m? =) wrote in
                  > news:877jbsxnrx .fsf@lucien.dre aming:
                  >[color=green]
                  >> If you need it to be SQL-like, SQLite seems to be the right thing.[/color]
                  >
                  > Tried that one, but had some problems setting things up.[/color]

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

                  [color=blue]
                  > On the other
                  > hand, BerkeleyDB + Pybsddb worked like a charm, with no setting up (under
                  > Cygwin).[/color]

                  Sincerely yours, Roman Suzi
                  --
                  rnd@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3

                  Comment

                  • Steve Holden

                    #10
                    Re: Flat file, Python accessible database?

                    Peter Hansen wrote:[color=blue]
                    > Karlo Lozovina wrote:
                    >[color=green]
                    >>bkhl@stp.ling fil.uu.se (=?utf-8?Q?Bj=C3=B6rn_ Lindstr=C3=B6m? =) wrote in
                    >>news:877jbsxn rx.fsf@lucien.d reaming:
                    >>
                    >>[color=darkred]
                    >>>If you need it to be SQL-like, SQLite seems to be the right thing.[/color]
                    >>
                    >>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).[/color]
                    >
                    >
                    > 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[/color]

                    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/

                    Comment

                    • Magnus Lycka

                      #11
                      Re: Flat file, Python accessible database?

                      Karlo Lozovina wrote:[color=blue]
                      > I've been Googling around for _small_, flat file (no server processes),
                      > SQL-like database which can be easily access from Python.[/color]

                      There are some suggestions in my EPC 2004 DB presentation:

                      Comment

                      • Peter Hansen

                        #12
                        Re: Flat file, Python accessible database?

                        Steve Holden wrote:[color=blue]
                        > My experience on Cygwin was that I had to install sqlite before pySqlite
                        > worked.[/color]

                        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

                        Comment

                        • Jorgen Grahn

                          #13
                          Re: Flat file, Python accessible database?

                          On Tue, 1 Nov 2005 21:02:20 +0000 (UTC), Karlo Lozovina <_karlo_@_mosor .net_> wrote:[color=blue]
                          > bkhl@stp.lingfi l.uu.se (=?utf-8?Q?Bj=C3=B6rn_ Lindstr=C3=B6m? =) wrote in
                          > news:877jbsxnrx .fsf@lucien.dre aming:
                          >[color=green]
                          >> If you need it to be SQL-like, SQLite seems to be the right thing.[/color]
                          >
                          > 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 :(.[/color]

                          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!

                          Comment

                          Working...