[FSF Associate Member]

Flattr this
Rss Feed
Subscribe
Recent Posts
csvDB 0.4 New Project: csvDB FB-Mix 0.4 Turious 0.3 Alpha 5 Turious 0.3 Alpha 4 Turious 0.3 Alpha 3 Turious 0.3 Alpha 2 Turious 0.3 Alpha 1 New Project: wMUSH FB-Mix 0.3 Man Pages in PDF 64bit Flash - Update Nodau 0.2 New Project: LibIPTables Turious 0.3 Dev Snapshot released Turious: an update New Project: PreParse 64 Bit Flash Blogging for the sake of blogging... New Project: Nodau New Project: FB-Console Turious 0.2 FINAL Turious Rc4 & TSDL Rc3 Turious Rc3 Turious Rc2 Turious Binary installers Turious and TSDL rc1 Turious Beta 6 Turious Beta 5 TSDL Update Another Update More New Turious Turous reaches Beta! Updates to Turious and TSDL Alpha Beta RC etc... First Post
Darkrose's Blog
New Project: csvDB
By: Darkrose
So the other day work I found myself working with a csv file and needing to know what the unique values of on of the columns was... much awk'ing and grep'ing ensued. Having decided this was non optimal I figured I needed to run an sql query on it; which meant creating a database table somewhere, loading the data, then doing the query I want, and finally dropping the table... again non-optimal. So instead I wrote a quick script (in PHP of all things) to parse sql and query the file.

As the day went by I had to do some more queries on the file, and the script grew to add LIMIT and COUNT() and so on... I showed this to a colleague who was generally impressed.

By the time I got home the idea of doing a more complete utility was on my mind... and once I got the basic SQL working the idea of splitting it into a separate library and client had to come into being. This meant doing some more work on the client so it was a bit more than just `command "query"', so the various -f -e -n arguments were added. Then I figured I might as well add a shell, and while I'm at it, might as well give the shell persistant history.

The result of all this, is csvDB: check out it's project page.

There's a fair - but nowhere near complete - subset of SQL available; 'SELECT' for instance is pretty much all there, you just can't use HAVING on GROUP BY, yet. You can however load pretty much any CSV file into csvDB with 'LOAD DATA INFILE', then 'SHOW TABLES' to see what's loaded, 'DROP TABLE' to unload a table, 'DROP PERMANENT TABLE' to unload it and delete the file, and 'DESCRIBE TABLE' to see what columns you've got. I do have plans to keep expanding, eventually adding 'INSERT' and 'DELETE' and so on in order to actually edit files, but this is a good starting point I think. For now, I think I'll just write some doc's for it.

A screenshot of the csvDB shell in action:

There are no comments for this blog entry.
Add a Comment