Slashdot Mirror


F/OSS Flat-File Database?

Leemeng writes "I'm looking for a simple, free, and F/OSS flat-file database program. I'm storing info about Wi-Fi access points that I come across, maybe 8-9 fields per entry. I've outgrown Notepad. This info is for my own reference only; it is not going on a Web server. Googling was unhelpful, with results skewed towards SQL, Access (MS), and Oracle, all of which would be overkill for my purposes. My criteria are: it must be simple, F/OSS, must work in Windows Vista, preferably use a portable format, must not be an online app, and must not require Java. Does such a beast exist?"

53 of 702 comments (clear)

  1. Python? by fyngyrz · · Score: 5, Informative

    Can't be Java... well, how about Python?

    Here is a completely free (PD, not GPL-style "you're free to do as we tell you") database engine that will do what you have described thus far.

    The database engine is about 19k bytes (not a typo), has no dependencies (other than Python itself), supports a useful subset of SQL so you can actually create flexible queries that produce well-sorted results from your database, and it works everywhere Python does, which is to say, it works pretty much everywhere. It's just as happy operating on a command line as it is on a web server. The results (the actual databases) are 100% portable from OS to OS. I use it on various linuxes, OS X, and Windows for tasks very similar to yours.

    Comes with tutorial examples, sample databases and extensive docs. In a 13k (not a typo) archive.

    :-)

    --
    I've fallen off your lawn, and I can't get up.
    1. Re:Python? by fyngyrz · · Score: 3, Informative

      No, it isn't just that. It is used to show that what you are quoting is verbatim, for instance in cases where an assertion is unique, questionable, or worded unusually. This also works for obvious spelling errors, of course.

      --
      I've fallen off your lawn, and I can't get up.
    2. Re:Python? by fyngyrz · · Score: 4, Informative

      Why not sqlite?

      • SQLite isn't present or compiled in, in all Python installations, 2.5 or otherwise
      • At 800k, it's about 50x the size of class dbtxt (executable)
      • Source is huge compared to class dbtxt, so maintainance is not easy
      • SQLite is considerably more difficult to use (it's also more capable, though)

      That's all I have for ya, offhand. ;-)

      --
      I've fallen off your lawn, and I can't get up.
    3. Re:Python? by ehrichweiss · · Score: 5, Informative

      Well that assertion was a massive FAIL. I make quite a living thanks to the GPL and I know tons of others who do the same.

      --
      0x09F911029D74E35BD84156C5635688C0
    4. Re:Python? by Nwallins · · Score: 2, Informative

      I can't legally utilize GPL'd source code within a commercial application without doing some very specific (and not always possible) things that the GPL license instructs me I must do. You can use the software all you want. Just don't distribute it.
    5. Re:Python? by fyngyrz · · Score: 2, Informative

      Yes, that's pretty much what I said, only with more details. What's your point?

      --
      I've fallen off your lawn, and I can't get up.
    6. Re:Python? by dixonpete · · Score: 5, Informative

      There's an add-on for Firefox that makes SQlite use fairly painless: SQLite Manager. Brilliant work.

    7. Re:Python? by legutierr · · Score: 1, Informative

      OK, dbtxt looks interesting, but SQLite is very stable (it's used as the data storage in the iPhone, in Firefox, and in Skype, for example), and has a ton of features, like:

      - mostly ACID compliant (i.e. transactions w/rollback)
      - standard SQL (or close enough to it; de facto, there's no such thing), including joins
      - indexes and primary key generation
      - concurrent use by multiple processes w/locking
      - extremely cross-platform, including many OSs and most languages
      - a great command-line editing tool

      I'm not surprised that most of the posts here site SQLite, because it is great. And it's public domain, so it can be used by anyone, anywhere, for any commercial or private purpose.

      Having a db that is human readable can be a good thing--and a bad thing (anyone can change its contents manually?). Being small is a good thing. But even if you are doing embedded programing, is 800k such a burden that you would give up this feature set?

    8. Re:Python? by smilindog2000 · · Score: 3, Informative

      I'll throw out a shameless plug for something totally unsuitable for what the poster wants: datadraw. It's an in-memory super-high-performance (think raw C code or better - not SQL), database generator that I've not only had a lot of fun with, but which now supports well over 1M lines of algorithmic code - some of the most high performance stuff around.

      --
      Beer is proof that God loves us, and wants us to be happy.
    9. Re:Python? by smilindog2000 · · Score: 4, Informative

      Grr... some shameless link! Should have checked it: datadraw

      --
      Beer is proof that God loves us, and wants us to be happy.
    10. Re:Python? by QuasiEvil · · Score: 2, Informative

      Use it in any project that isn't GPL'd. Agreed - this is a particular problem when it comes to library code that folks have either intentionally or ignorantly GPL'd. If I'm not modifying the library code, just using it, I don't want to have to jump through hoops on the calling interface. I don't want to have to build as a shared library with a runtime link. It's a pain, and an unnecessary headache. I'm more than happy to help distribute the source I built against, but I don't want it GPLing my app in the process.

      So, the freedom I want is the freedom to license my code as I see fit, while still making use of the high quality of free software (libraries) and supporting them with bugfixes, patches, and another distribution point. With the GPL, you're really only free to make more GPL software. Part of freedom is allowing people to do things you don't like and/or don't agree with. That part seems to have been lost here.

      I've been moving my own personal released code to BSD lately, and my professional code, well, is largely internal apps for my employer.

    11. Re:Python? by MSG · · Score: 2, Informative

      I'm sure it's just me.

      It's not just you. Python exposes the locking mechanisms of the underlying platform and doesn't try to abstract any further than that.

      If you want simple, portable locking, use this recipe from ASPN:
      http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203

    12. Re:Python? by fyngyrz · · Score: 2, Informative

      But sqlite is on a totally different level of reliability; the fact that it is at the core of the iPhone's data management points to the level of confidence that people have in it.

      Wait a sec... That's not reliability; that's confidence. Reliability is a performance metric; confidence is not. I suspect — looking at some relevant SQLite pages — that dbtext might actually be more reliable, because my bug list is at zero and has never moved off zero since release, though it is used thousands of times every day just in my own venues. I have no idea how much others use it, though. ;-)

      --
      I've fallen off your lawn, and I can't get up.
    13. Re:Python? by jhol13 · · Score: 3, Informative

      dbtxt can only handle ASCII (<128 so even ISO-8859-1, etc. are no-no). This can be killer (it is for me).

      Other than that the dbtxt looks very nice indeed.

    14. Re:Python? by Binary+Boy · · Score: 3, Informative

      Never used a self join? I mean I'm no relational database theorist, so maybe you're correct on some level, but one can certainly create relationships between data stored in a single table.

    15. Re:Python? by kjots · · Score: 2, Informative

      (God, I don't know why I keep reading Slashot comments, I really don't; but I guess an eleven year habit habit is hard to break...)

      Let's start with the obvious, shall we?

      With the GPL, you're really only free to make more GPL software.

      That's the whole bloody point, except that instead of that second 'GPL' you should be saying 'copyleft'. The GPL and other copyleft licenses are specifically designed to prevent covered code from being used in non-copyleft projects. It's a basic design principal!

      ... the freedom I want is the freedom to license my code as I see fit ...

      You still have that freedom, you just don't have the freedom to relicense other people's code. Not even the BSD style licenses allow you this so-called 'freedom'.

      ... when it comes to library code that [other] folks have ... [I'm] just using it ...

      I added that [other] above to emphasize my point - that it's other people's code that you want to use. You didn't write it, so you can have no expectations that you should be allowed to use it. In this case, these other folks have decided to let you use the code that they have written, but only under their terms. You either have to agree to these terms, rewrite the library so that you can release the code under your own license, or bitch and moan about how unfair it is that you can't just do whatever the fuck you want with other people's hard work (you appear to have chosen the latter).

      Freedom does not mean being able to do whatever the fuck you want to do - that's anarchy, and it doesn't work. Freedom is having a set of universally recognized rights, and the means to enforce those rights on those that seek to trespass against them. Like copyright - it gives you (and only you) the freedom to do whatever you like with your work, and the power to prevent other people from doing whatever they like with your work. In this instance, QuasiEvil, you are the other people.

      Until everyone can be trusted to just 'do the right thing' (whatever the hell that is), freedom will always mean trading some small convenience (like the ability to walk into my neighbours house and take his stuff) for a larger convenience (like not having people walk into my house and taking my stuff). The GPL is no different.

      The truth is that is is possible to circumvent the GPL (i.e. to mix GPL and non-GPL code in the same project) - you just have to ensure that, when you are running the non-GPL code, the CPU's instruction pointer never refers to a block of GPL-covered code. You can achieve this by using networking and/or message passing techniques to pass information from one module to another, without requiring your non-GPL module to be linked with the GPL module. Yes, it's a fuck around, but one again we are simply trading a small convenience for a larger one.

      This post is from someone who releases code under the GPL to everyone in this forum that bashes the GPL at every opportunity (like the first poster). I've made my decision and I'm comfortable with it, so you might as well just shut the fuck up - you're bitching about something that no-one has any intention of changing.

    16. Re:Python? by poopdeville · · Score: 3, Informative

      No, he's completely wrong. A relation is a subset of the Cartesian product of sets. And one can form the Cartesian product of a set with itself. For example, the plane is realized by the product RxR.

      --
      After all, I am strangely colored.
  2. Err ... by Anonymous Coward · · Score: 4, Informative

    Comma Separated Variable Text Files, as exported and imported by Excel. You can get libraries to read and write these, and search these in most languages.

    Otherwise what's wrong with a simple database like MySQL or PostgreSQL on your computer?

    1. Re:Err ... by djmurdoch · · Score: 2, Informative

      Comma Separated Variable Text Files, as exported and imported by Excel. Don't use CSV with Excel, it will by default change values on import.

      For example, if you ask it to read and write this:

      May 20,5/20,1.000

      you get this:

      20-May,20-May,1

      That might be okay if those were really two dates and a number, but I was never asked if they were. (OOO Calc is just as bad: it asks, and by default modifies the data).
    2. Re:Err ... by pthisis · · Score: 3, Informative

      We have even worst problems; it'll turn

      Smith,John,703-555-5555

      into
      Smith,John,-5407

      The latter being 703 minus 555 minus 5555.
      when importing a CSV file. No joke. There are ways around it, but the default is pretty braindead.

      --
      rage, rage against the dying of the light
    3. Re:Err ... by CheeseTroll · · Score: 3, Informative

      Another way around that is to open Excel first, then do File > Open to open the .csv file. That should force Excel to use the import Wizard, which lets you specify those columns as text, rather than assuming that they're numbers or an equation.

      That's what I do in Excel 2003, anyway, to stop it from stripping the leading zeros in SSNs.

      --
      A post a day keeps productivity at bay.
  3. OOO? by iamhigh · · Score: 5, Informative

    it must be simple, F/OSS, must work in Windows Vista, preferably use a portable format, must not be an online app, and must not require Java. Does such a beast exist Maybe this will do? I think it meets all your needs. You can even use it with a web app if desired. Some functionality may need Java, but most doesn't. I don't know what parts of OOO are Java-driven, but I am sure somebody here does!
    --
    No comprende? Let me type that a little slower for you...
  4. sqlite by nguy · · Score: 5, Informative

    Sqlite is used in many apps (including Firefox), it's small, and it's efficient. It also has bindings to just about every imaginable language.

    I find it amazing that you didn't come across it in Googling...

    1. Re:SQLite by Quartz25 · · Score: 3, Informative

      Python 2.5 comes with SQLite3, so you don't even have to install it separately.

      --
      Most people don't get why the integral of "e to the x" is so funny. Most math majors don't have a sense of humor.
    2. Re:SQLite by edalytical · · Score: 2, Informative

      Yeah, you can't really get more permissive than public domain.

      --
      Win a signed Stephen Carpenter ESP Guitar from the Deftones: http://def-tag.com/?r=0008781
    3. Re:sqlite by kingbyu · · Score: 5, Informative

      There is an add-on to Firefox called SQLite Manager that makes managing your own little database quite a bit easier than typing sql commands on a command line:
      https://addons.mozilla.org/en-US/firefox/addon/5817

  5. SQLite by kcbanner · · Score: 4, Informative

    Get it http://www.sqlite.org/ here.
    There are GUI clients that work fine for this sort of thing, SQL is simple for doing basic things. One file, one database.

    --
    Obligatory blog plug: http://www.caseybanner.ca/
  6. SQLite by elhedran · · Score: 2, Informative

    Have you looked at SQLite?

    C based, no client-server. Very small, quite fast. And a very permissive license.

  7. sqlite of course by cats-paw · · Score: 2, Informative

    I think this would be perfect, I found it when I was looking for a DB which met similar criteria. I don't care about windows, but it does work under windows AFAIK.

      http://www.sqlite.org/

    Use it all the time for everthing from trivial databases to several 10s of megabytes. Since query's can be entered on the command line it's quite simple to write an ascii results grabber.

    --
    Absolute statements are never true
  8. Re:OOO? Calc and Base by edisrafeht · · Score: 2, Informative

    In addition to Calc, there is also Base, the alternative to MS Access. Check it out here: http://www.openoffice.org/product/base.html It's gotta be way easier to work in OpenOffice than a whole database system (making up accounts, tables, reports, and all).

  9. Spreadsheet by benwb · · Score: 3, Informative

    Open office should do the trick.

  10. SQLIte or BDB by willyhill · · Score: 3, Informative
    I'd recommend SQLite or Berkley DB. I've used BDB on a couple of projects where I needed to basically store an enormous hashtable that could be read quickly by key, and I don't think anything else comes close to the speed of that thing.

    BDB is *not* a relational database though, it's just a storage/indexing engine, which is used most notably by MySQL as a backend. SQLite on the other hand is a full file-based RDBMS with a small runtime, so it might be a bit of overkill for you in this particular scenario.

    But both of them run on Windows, Linux and the BSDs, so you won't have portability problems. And most languages have bindings for them.

    --
    The twitter monologues. Click on my homepage and be amazed.
  11. GDBM by jschmerge · · Score: 4, Informative
    If you're doing simple Key,Record storing, try GDBM (or one of its analogs: DBM, NDBM). IIRC, it's included as part of glibc. The interface for it is analogous to that of a hash table... In fact there's even native Perl support for tying hash tables to GDBM.

    If that doesn't satisfy your need, take a look at Berkley DB. It offers a more sophisticated interface than DBM.

  12. How about a spreadsheet? by diamondsw · · Score: 2, Informative

    For a small number of fields like that, why re-invent the wheel? Grab OpenOffice and just create a spreadsheet. Easily searchable, sortable, extendable, and all with zero maintenance on your part.

    I recently moved my collection of serial numbers out of a defunct proprietary program and into a spreadsheet - couldn't be happier.

    --
    I don't know what kind of crack I was on, but I suspect it was decaf.
  13. Re:OOO? Calc and Base by KenSeymour · · Score: 2, Informative

    Have you used OO Base?

    I was using it about a year ago and I found it buggy and hard to use. I was using it to access
    PostgreSQL.

    I like the other parts of OpenOffice that I use, Write, Calc, Draw.
    Of course, I have not had time to look at it since then.

    --
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein
  14. Re:Python comes with SQLite by spookymonster · · Score: 4, Informative

    Just get Python, and use the version of SQLite that comes with it:

    import sqlite3
    mydb = sqlite3.connect('sample.db')
    mydb.execute("create table contacts (fname text, lname text, email text)")

    mydb.execute("insert into contacts values('Spooky','Monster','spook@spammity.spam')")

    mydb.commit()
    mydb.close()


    You can then use the free and open SQLite database browser to browse, edit, and print your table.

    You may think you're keeping it simple by using a flat file, but you're really not. It may be somewhat easier to manually edit, but it's also easier to screw up, and I've never heard of one with the ability to undo changes.

    --
    - Despite popular opinion, I am not perfect.
  15. Try Metakit by kawabago · · Score: 4, Informative

    Metakit is a small footprint database that might fit your needs. Metakit

    1. Re:Try Metakit by slackergod · · Score: 2, Informative

      Much as I like sqllite, I agree with you completely... metakit is definitely what he wants.

      For those not familiar with metakit,
      it straddles a very interesting (to me at least)
      line between "some csv files i threw together" and "full on sql db" in terms of it's storage
      and query semantics, while at the same time being
      a flat file like sqllite.

      And it really deserves to be better known from a
      theoretical standpoint, in how it structures the
      data... especially some of the more interesting
      applications it's been put to, such as a
      graph-theory style database written as a layer on
      top of metakit (can't remember the name).

      Also, it's bound to a number of languages (python
      and tcl are the only ones i've played with).

      Perhaps if there weren't SO MANY responses saying
      "sqllite" over and over, your response would have
      gotten the informative rating it needs.

  16. sed, awk, and grep... by mikelieman · · Score: 3, Informative

    echo "badger, badger, badger, badger, snake" >> my_file

    --
    Technology -- No Place For Wimps! Grateful Dead and Jerry Garcia Chatroom -- http://www.wemissjerry.org
  17. Consider an xml-based db by Doofus · · Score: 2, Informative

    There are a number of XML databases, several free and open source, that will rely only on "flat-files". You could probably get by with Microsoft's xml libraries, though there are a number of ways to manipulate and query a set of xml documents. Several of these XML databases implement XQuery which may help if your dataset grows beyond effective queries by visual inspection in Notepad.

    eXist is one alternative; while I haven't personally used it the home page indicates it's a fairly capable project.

    Sedna also appears to be feature-rich.

    There was a similar discussion on Slashdot specifically with reference to XML databases, here.

    Happy hunting -

    --
    If the Government becomes a lawbreaker, it breeds contempt for law; ... it invites anarchy. - Brandeis
  18. Re:No Java? by Anonymous Coward · · Score: 1, Informative

    CSQL only supports in-memory databases. It doesn't even have an on-disk representation -- it's strictly a memory-only cache thing.

  19. PCFile by Linker3000 · · Score: 2, Informative

    1993 called to recommend PCFILE!

    http://www.umich.edu/~archive/msdos/database/pcfile/

    Mind you, you'll have to toss Jim Button $10 as it's shareware!

    --
    AT&ROFLMAO
  20. It is still a database system but.. by SixDimensionalArray · · Score: 2, Informative

    Nobody has yet mentioned that MySQL has a CSV storage engine - just create a table with type CSV and away you go. It does require the MySQL engine though.

    Otherwise, I agree with most posters who say just use a simple text and/or xml file if the data volume is relatively small. That should be more than enough!

    SixD

  21. Requirements by jd · · Score: 2, Informative

    The poster didn't want SQL, so I'm guessing they ruled out SQLite on those grounds. QDBM and Oracle/Sleepycat/Berkley DB-4 would be the smallest, fastest "pure" flat-file databases that are also cross-platform - at least, that I know of.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  22. Re:OOO? Calc and Base by pbhj · · Score: 2, Informative

    I'm still using it for a customer database, it's two main problems are it's buggy and hard to use, and slow.

    So really it's 3 main problems are being buggy, hard to use, slow* and totally bloated ...

    Actually it's not half as buggy as it was a few releases back - I can actually use it now to fill in a form without it crashing. Just tried opening a windows XP made odb file in Ubuntu (OOo 2.4) and it's slow as hell and bugged to death, so you might add portability to that list of main problems.

    [Yes I've filed bug reports].

    ---
    * slow for searching, takes about 2 mins to do a straight text search on 500 records.

  23. Why are we trying to promote python? by tknd · · Score: 5, Informative

    He doesn't need python. He just needs a database. He can download a precompiled binary for windows that allows one to work with the database at the command line. Python is not necessary.

    And if the command line is too much, as others have noted there is already a convenient firefox extension for graphically interacting with a sqlite database.

  24. Re:Python comes with SQLite (What about cPickle?) by adonisv1 · · Score: 2, Informative

    Why not the pickle/cPickle module? Not a flat-file but easier to manipulate since your just serializing native Python objects.

    e.g.

    import cPickle
    class Record:
    def __init__(self, fname, lname, email):
    self.fname = fname
    self.lname = lname
    self.email = email
    # ---
    # Write out the data
    records = list()
    records.append(Record("John", "Doe", "jd@email.com"))
    output = open("records.db", "wb")
    cPickle.dump(records, output)
    output.close()
    # ---
    # Read back the data
    inputFile = open("records.db", "rb")
    data = cPickle.load(inputFile)
    for record in data:
    print record.fname, record.lname, record.email
    inputFile.close()

  25. Berkeley? by mindstrm · · Score: 3, Informative

    Berkely DB?

  26. Re:Python comes with SQLite by Just+Some+Guy · · Score: 2, Informative

    I don't know if the python bindings are of that same quality; if they are, they're top notch.

    The sqlite3 module as shipped with Leopard says that it supports question mark substitution, so his example would be better written like:

    mydb.execute("insert into contacts values(?, ?, ?)", ('Spooky', 'Monster', 'spook@spammity.spam'))

    BTW, the same could be written for PostgreSQL like:

    mydb.execute("insert into contacts values(%(first)s, %(last)s, %(email)s)", {'first': 'Spooky', 'last': 'Monster', 'email': 'spook@spammity.spam'})

    Hopefully sqlite3 will get the same standard substitution in the future, but at least it is possible to do it safely today.

    --
    Dewey, what part of this looks like authorities should be involved?
  27. Spectate Swamp Desktop Search by SpectateSwamp · · Score: 3, Informative

    Been searching flat files with this open source VB5 program since 1999. Searches flat files at 20,000,000 cps displaying hi-lited hits in matching lines only or full context mode. Results can be exported to a results file. Append txt files together. Search and replace option. Run multiple versions with various default settings. I have been yapping and yapping about flat files, only to get great amounts of resistance from the Geeks. The search uses lots of defaults and quick keys (for typists). From startup to shutdown nothing is faster. Channel9 and thedailyWTF.com have the best threads. Check it out. It's the only program you'll ever need

    --
    Challenge: I have better access to my Video, Music, Pics and Text than anyone on Earth.
  28. Re:Python comes with SQLite by ubernostrum · · Score: 2, Informative

    Actually, the Python SQLite adapter supports the standard Python DB API (PEP 249), and so you can just follow its recommendations (which includes using placeholders).

  29. Metakit by hkuiper · · Score: 2, Informative

    Take a look at Metakit. http://www.equi4.com/metakit/index.html. Its single file, small, fast and it has proven itself over many years. It is written in C++ and bindings for Python and Tcl are available. Instead of tables, rows and fields it uses similar concepts called view, index and property. Interestingly, a property may also be a subview thus allowing a mix of a relational database (flexible) and a hierarchical database (fast).

  30. Open source java databases by youngdev · · Score: 2, Informative

    I use hsql. It has many options: flat file, memory just to name 2.

    I have also heard good things about H2 and apache derby. These have been especially valuable for embedded apps