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?"

46 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 maxume · · Score: 5, Insightful

      Why not sqlite? Comes with Python 2.5 on Windows. It adds a relatively weighty 800k or so to my python installation on Windows, but the installation is dozens of megabytes overall, so it doesn't really matter.

      --
      Nerd rage is the funniest rage.
    2. Re:Python? by goombah99 · · Score: 5, Interesting

      You need YAML

      I think is exactly what you are requesting.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    3. Re:Python? by Facetious · · Score: 4, Funny

      Look, now you are just contradicting everything. He came here for an argument.

      --
      Let us not become the evil that we deplore.
    4. Re:Python? by el+americano · · Score: 4, Funny

      YAML is a recursive acronym for ...

      Next!

      --
      Those are my principles. If you don't like them I have others. -Groucho Marx
    5. 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.
    6. Re:Python? by goombah99 · · Score: 4, Interesting

      YAML meets the flat file requirement and can be made to be the persistent DB behind Python, Perl, Ruby.

      If it were not for the Flat File requirement then a simple Python shelve or Perl Tie would be the most logical solution since they are both part of the standard library so don't require installing libs on random computers you might use or port to.

      of those two Perl Tie is probably the most suited because it's backed by a real DB operating off the disk not fully in memory.

      But why not do both: use YAML as the DB backing the Perl Tie.
        then you get a nice human readable flat file.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    7. 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
    8. Re:Python? by fyngyrz · · Score: 5, Insightful

      Care to tell me exactly what the user of GPL software is not free to do? Otherwise maybe you'd like to retract your casual FUD-spreading aside.

      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. Any other ways I can help with your basic F/OSS education? I'll be here all day.

      --
      I've fallen off your lawn, and I can't get up.
    9. Re:Python? by Facetious · · Score: 5, Funny

      Great. Now I'm going to have to call Red Hat and tell them their profits aren't real. I always hate to make that call. Just last week I had to tell Steve Ballmer that chair!=discus||frisbee. He was pissed.

      --
      Let us not become the evil that we deplore.
    10. Re:Python? by aweraw · · Score: 5, Insightful

      Mod parent up.

      IMO, the people who still, after all these years, haven't figured out how to make money with GPL software are the failures, not the GPL.

      Its just a software license; it doesn't preclude you from charing money for your work, and it doesn't mandate you make your work avaiable to the general public. I can't fathom why some seemingly intelligent people have such a hard time grasping this concept.

      --
      5468652047616D65
    11. Re:Python? by moderatorrater · · Score: 5, Interesting

      I'm missing your point I believe. Or being purposely obtuse which you (probably rightfully) feel you can get away with because this is a very GPL friendly forum. BSD, MIT, etc licenses allow you to do whatever you want with the code with none of the strings that the GPL has. Your false dichotomy between GPL and closed source doesn't really help promote a useful dialog about freedom of source.
    12. Re:Python? by dixonpete · · Score: 5, Informative

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

    13. Re:Python? by Anonymous Coward · · Score: 5, Funny

      no he didn't. he came here for abuse.

    14. Re:Python? by morgan_greywolf · · Score: 4, Funny

      Abuse is down the hall, room 164a, I think.

    15. Re:Python? by morgan_greywolf · · Score: 5, Insightful

      He said he wanted a flat-file database. Why, on this Earth, would he ever need "standard SQL including joins." SQL is designed for relational databases and, in particular, joins are only EVER used in a multi-table, relational database. In fact, the guy even said "SQL is overkill".

      IOW, SQLite, as "lite" as it is compared to Oracle, MySQL, PostgreSQL, etc. is still overkill.

      I'm with the GP -- dbtxt looks really cool. Although, I do gotta say that OpenOffice.org would fit the bill just fine for what his requirements are: Calc can be used as a flat-file database, and I think there is support for simple CSV databases in Base.

    16. 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.
    17. Re:Python? by fyngyrz · · Score: 4, Interesting

      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?

      Sure, it can be. For instance, adding 800k of stuff to your application means that you are giving up control. You might have the source (which is going to be somewhat larger in this case)... but do you have the time to dig into it if there's a problem? Does reporting the problem necessarily mean it's even going to get fixed? For instance, I've reported many problems to various authors, some of which got fixed, some didn't. Likewise, adding a feature can be non-trivial with a large (source code) project. Compare that to a very lightweight thing that, let's say, almost does what you want but you just need feature X. Might be a whole lot easier to add that to a 20k "almost-there" set of source than megabytes of source, is that not possible?

      Distribution of a class module with a python app is an entirely trivial thing to do. For that matter, you can take the class and put it in the same file with your application if that appeals, giving you the advantages of atomic distribution -- harder for an end-user to separate things and make whole app, as you handed it to them, fail to work.

      And I suppose the elephant in the room is that the end user may have no need for the features. I sell a commercial program with features not available in other programs in the same general application space, functionality-wise; that doesn't mean it will sell to anyone on that basis unless they actually need those features, right? In this specific case, based on the article, the needs described seemed to be met by what I'd written, and hence my post.

      PostgreSQL whips the living hoo-ha out of SQLite; it is larger, but offers more features (sound familiar?) Yet SQLite has a place, as your advocacy clearly indicates. I would venture that the difference between SQLite and class dbtext is similar, just occupies another place on the size/features scale. In the end, the user, based on their requirements, may go "what a POS" and step up the ladder. From either one.

      OK, dbtxt looks interesting, but SQLite is very stable

      dbtxt also seems to be very stable. It's never failed for me, nor have I ever received any indication that it wasn't doing what it was supposed to do when used as indicated. Also -- as a user myself -- I'm quite interested in fixing it, should it turn out to have problems.

      Also, just as an aside, If someone can explain cross-platform file locking in python to me in terms I can understand, and if python's ability to lock can be made to implement a reasonable form of "wait for lock to release", I'd like to add that as a feature, too. I found python's docs on locking to be more than a little opaque. I'm sure it's just me.

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

      ...the licenser, who is free to refuse to fix the bugs or demand exhorbinate fees to do so. Same with new features or support.

      To be fair, a proprietary licenser is also free to fix the bugs ASAP and well, provide such fixes for free, also to provide new features for free if they like. I do this all the time with a commercial application. A PD author also retains such freedom. These are not benefits that exclusively arrive via the GPL. And it is well to consider that with a GPL, PD or commercial application, one is free to demand money to fix something, to add features to it, to explain or teach its use, or even to simply use it. Doesn't mean you'll get it, but it doesn't mean you won't, either.

      If you wouldn't do this to someone directly then giving code to someone else so they can do it is unethical.

      I don't think you've really analyzed this far enough. Giving someone something, and then telling them what they can and cannot do with it, carries ethical problems in the form of imposing your will on someone else (and it also devalues the gift, in my personal opinion.)

      "Here's a gift of a book; but you can only read it if you use LED lights." "Here's a gift of a cat; but you can only have it if you'll eat it." "Here's a gift of a some money, but you must spend it upon me."

      You see? This is why the term "freedom" has always seemed to go so poorly with the coercive requirements that the GPL applies to the various recipients in the chain of "gifts."

      --
      I've fallen off your lawn, and I can't get up.
    19. Re:Python? by legutierr · · Score: 5, Interesting

      He said he wanted a flat-file database. Why, on this Earth, would he ever need "standard SQL including joins." SQL is designed for relational databases and, in particular, joins are only EVER used in a multi-table, relational database. In fact, the guy even said "SQL is overkill". First of all, my point was that in comparison to a python-only tool like dbtxt, sqlite is probably worth the additional memory overhead of a couple hundred kilobytes.

      Second, I'm not sure that you know any better than I do what the poster really needs. Open office calc might be an option, but certainly not if 800k is too much space; open office is what, like 200 megs? And dbtxt might also be an option, if doing everything in Python is what the person wants; I love Python, but there are plenty of people who don't. I'm sure that all three proposals are equally valid.

      Now, to defend SQLite: in most cases, dealing with a relational database is "overkill" not because of SQL per se, but because of the fact that software needs to be installed and configured*, and because complex sets of processes need to be managed and maintained. SQLite is useful, in part, because it provides the functionality of a relational database without the complexity of the engine. Now, if you don't want or need SQL, then you might not consider that particular feature to be of particular benefit. Nonetheless, there are many situations where SQL might not be required, but where it might be useful, where in the past SQL might not have been used, but where now, because of SQLite, it will be used. There are very few cases where real-world information is not most accurately represented as relational data (in comparison to flat data). SQLite allows you to avoid making compromises regarding the way that that data is stored. And SQLite is fast.



      *(Although some interpreted languages might require that sqlite's libraries be installed on a system for it to be used by a program, that is not the case for compiled languages like C, C++, Obj-C, etc., where the sqlite libraries can be compiled directly into the code distributed to end users.)
    20. Re:Python? by fyngyrz · · Score: 4, Insightful

      I can only imagine you are being dense on purpose

      Your imagination, not to put too fine a point on it, has failed you.

      You are going around saying that the GPL has restrictions on use. It does not

      Yes, in fact, it does.

      I have come across a snippet of GPL'd source code. I want to use it in my gigabyte of source code commercial app, which, prior to such inclusion, is legally mine to distribute, which is a use I make of this object, that is, my application. However, as quite common in commercial efforts, I cannot legally distribute the source code of my application. So, one day I use the GPL'd source code by compiling said GPL source into the commercial app. I mod it to better suit my use of it. My app is suddenly subject to a change in usability, imposed by the GPL, such that I no longer have the option of using the same way (which act can also be characterized as distribution) to earn money, and my customers no longer have the option to use my altered application. This viral alteration of the usability of my application is entirely courtesy of the GPL. In order to reverse this alteration and keep the code snippet in use in the application, I must perform actions that I actually do not have the option of choosing due to previously existing obligations (essentially source code distribution.) The end result is that the GPL'd code cannot be used if the commercial application is to remain usable.

      To be blunt, the word "use", (as well as all of its natural permutations) which you depend upon so heavily in your flawed analysis, doesn't have the limited meaning you wish it had — nor has it ever, or will it ever, have such a limited meaning. This is why your argument is specious.

      --
      I've fallen off your lawn, and I can't get up.
    21. Re:Python? by totally+bogus+dude · · Score: 5, Funny

      That'd make the first one a shameful link, yes?

    22. Re:Python? by Jason+Earl · · Score: 4, Insightful

      Why should the GPL hackers share with you if you aren't willing to share with them?

      You don't like their license. That's fine, they don't like your license either.

  2. No Java? by jawtheshark · · Score: 5, Insightful

    I would have recommended HSQL, but you don't want Java. Frankly, usually, when we're talking databases I won't say "use a spreadsheet", but with 10 fields, you might as well use a spreadsheet. Of course OpenOffice.org Base is out, because it uses HSQL.

    Something like CSQL might fit, but I have no experience with it.

    --
    Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
    1. Re:No Java? by geekboy642 · · Score: 5, Insightful

      Mod parent up.
      This guy wants a spreadsheet, he just doesn't know it. Excel--or the free alternative from OpenOffice.org--will do everything he could possibly want, and although it saves as its own infernal file format, it exports competently into a tab or comma-delimited format.

      All the extra "requirements" are just pseudo-intellectual mumbo-jumbo that have no bearing on reality.

      --
      Just another "DOJ fascist authoritarian totalitarian bootlicker" -- Zeio
  3. 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 rindeee · · Score: 4, Funny

      Such foolishness. Imagine a program which exists for the intent purpose of solving math equations interpreting 703-555-5555 as just such an equation. Next someone's going to say that you shouldn't be using Excel as a database. Crazy talk I tell ya'!

    2. Re:Err ... by DAldredge · · Score: 5, Insightful

      Just tired that on Excel 2007 - it imported correctly. The three fields all imported correctly.

  4. 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...
    1. Re:OOO? by ADRA · · Score: 4, Insightful

      OpenOffice uses Java for its database tool. I'm fine with it, and its probably the best choice for anyone actually wanting something simple / usefull / free, but obviously the OP is a trolling wanker, so it has to be san-Java.

      --
      Bye!
  5. 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 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

  6. 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/
  7. how about... by ramirez · · Score: 4, Insightful

    a comma delimited file?

    Umm... just write a few one-liner perl scripts to get info out.

  8. heh by B3ryllium · · Score: 4, Funny

    Since the majority of the comments so far have pointed at SQLite, I'm kind of surprised that the post didn't come "from the sqlite dept." :)

  9. Flat file is useless by bluefoxlucid · · Score: 5, Insightful

    Trying to solve such an issue as a flat file is a poor design characteristic. This says "I don't want to learn SQL" or "I want the output human readable." If you just want to store information for programmatic use, use SQLite and quit worrying about data storage format. If you want it human readable, grab libxml2 (works on Windows too) and store it as XML. Decide which problem you are solving because if you don't need (i.e. it's not helpful) it human-readable and/or want the ability to search it quickly without loading the whole thing into memory, then SQLite is probably a better solution.

    1. Re:Flat file is useless by blippo · · Score: 4, Insightful


      Well... XML is human readable in the same way as a sand is edible.

      If the OP wants to use a tool better than notepad for editing, he probably should try Open Office.

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

  11. 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.
  12. Try Metakit by kawabago · · Score: 4, Informative

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

  13. For your reference only by holophrastic · · Score: 4, Insightful

    If it's just for your reference, you don't need a database at all. Databases don't become technically worth-while until you get to indexing. And until you have fifty-thousand records, or complex queries, you don't need indexing.

    So why not simply write out a tab-delimited file? Retrieval is as simple as reading every line, splitting by the delimeter, and regexp'ing whichever field you're examining. 15'000 records takes about two seconds on a modern machine. Of course, for anything more complicated, that same file gets easily imported into your favourite spreadsheet application.

    You don't need to worry about locking because you're the only one using it. And otherwise, your application simply locks the file handle, or creates & destroys a traditional lock-file.

    It's a thirty-line perl script (of legible perl). You can do it in JScript as a local HTA if you want the benefit of html etc. interfaces.

  14. Re:Python comes with SQLite by fyngyrz · · Score: 4, Interesting

    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.

    Class dbtxt includes the ability to undo changes, and features human-readbility for the flat database files. It's trivial and not error-prone at all to mod a database file to delete, or undelete a record, and of course you can do it through the database engine as well.

    --
    I've fallen off your lawn, and I can't get up.
  15. How about a full Oracle Database 11g Enterprise by myspace-cn · · Score: 4, Funny

    Why mess about with filty batchfiles, bashscripts and clunky sqlite, mysql. How about a full Oracle Database 11g Enterprise? o;)

  16. Re:Python comes with SQLite by dkf · · Score: 4, Interesting

    mydb.execute("insert into contacts values('Spooky','Monster','spook@spammity.spam')") Couldn't you have at least done an example that doesn't promote bad practices with quoting? My experience with sqlite (admittedly using the Tcl binding) is that it gets this stuff far more correct and easy to use in practice than any other database API that I've seen. I don't know if the python bindings are of that same quality; if they are, they're top notch. The code I would have written? Like this:

    set first "Spooky"
    set last "Monster"
    set email "spook@spammity.spam"
    # In practice it's really easy to put values into variables
    mydb eval {insert into contacts values (:first,:last,:email)}


    The advantage? That code is now totally armour-plated against SQL injection attacks as well as being fast. Which is nice, really really nice.
    --
    "Little does he know, but there is no 'I' in 'Idiot'!"
  17. 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.

  18. You really do NOT want a DBMS, use a spread sheet. by ChrisA90278 · · Score: 4, Interesting

    Your problem is that you are looking for a "database". This is a very complex kind of program that is total overkill for your purpose. Will you really be storing hundreds of thousands of records and wanting to do some complex querries? Ifnot why not just use a speadsheet? If you want a free spreadsheet look at OpenOffice.