Introducing Sqlite-Commander - Curses Client for your SQLite Database

I am happy to introduce to you, my recent nighttime hack "Sqlite-Commander - A Curses client for your SQLite Database".

While I was working in a project involving sqlite, I wanted to check the contents of a sqlite database. The command line sqlite client involves too much of typing for viewing records. The sqlite viewers that I found were not very keyboard friendly. There was a firefox extension which looked good but I felt it is too clumsy to launch that application. Also, I wanted a tool that will read SQLite tables over ssh without requiring much bandwidth. I could not find any CUI client for SQLite and I felt it may be useful to write one, atleast for my satisfying my needs. So, here we have Sqlite-Commander. The name is inspired from an awesome piece of software Midnight-Commander written by Miguel De Icaza.


Screenshot
Sqlite-Commander => Click to enlarge


Features
+ Shows the list of tables in the left pane.
+ Allows you to navigate the list of tables using arrow keys.
+ Shows the first 30 records for the selected table in the right pane
+ Non-printable columns are shown with a ???
+ Maximum of 30 characters are displayed per column. Column data exceeding this length are shown with "..."


TODO
+ It is not a full-fledged SQLite client with rich features. It is like an enriched version of cat for working with sqlite. I don't intend to make a release, as  I am not sure if this will be useful for anyone other than people who work with SQLite and can use only a terminal/ssh. If there are enough users, I will enhance and make it a full-fledged product. So drop me a mail if you are interested in this project.
+ It should be fairly straight-forward to implement connectivity to any database (MySQL, Oracle, etc.) such that we can have a generic SQL NCurses client. It will be a good exercise for someone who wants to know C#.
+ Add a scroll bar and show more than 30 columns. Should be moderate/easy to implement.
+ Add a dialog box to execute any random SQL statement. Should be fairly trivial to implement.
+ Create Events such that pressing Enter on the records list will pass the currently selected record to a custom script/command. Useful ?
+ Copy selections of records to clipboard.  Easy to implement.
+ Handle tablenames with special characters.


Thanks
Credits are due for the awesome mono-ncurses interface authors (Miguel and Co.) If you are looking to writing some terminal application I can heartily recommend that mono-ncurses is the best library you will ever get. Before beginning this application, I evaluated a few options (like Python etc.) and nothing comes close to being as easy to use as mono-ncurses.  Also, special thanks to VIM and git, two of the most productive tools ever invented.

16 comments:

Marius Gedminas said...

I would find such a thing useful.

keck said...

Please do make a release version! I'd offer to help with packaging if that is a burden. This would be very handy, for all the times I've found myself typing sql just to see what is in some random file on my phone.

Anonymous said...

Lovely work!

Cant wait to try it out myself on my own databases :-)

Miguel

Sankar said...

@Marius Thanks.

@Keck Thanks for the packaging offer. I will do the packaging myself before next weekend.

@Miguel Thank you a lot :-) A moment to cherish for me.

Anonymous said...

Great to see curses app development. Best wishes.

-- rahul k

Jinu M Joy said...

Now that is kwel. Please do have a release version.

The ZLM Agent persists quite a bit of data in sqlite DBs. I would think this tool would be very handy.

Sankar said...

@Rahul Thanks.

@Jinu wow. that is cool. Thanks. I shall come up with a release version soon.

Nikanth Karthikesan said...

How hard/easy is it to package a mono/.net application? Does it have an equivalent of executable jar files?

Pankaj Kumar Biswas said...

Nice work man.keep it up.

chenthill said...

I hope this tool is going to help many people. Keep the same spirit up and going!!

Sankar said...

@nikanth afaik, Mono applications are packaged in the sameway as the rest of the linux applications, just that instead of .so we will have .exe and .dll

@Pankaj Thank you a lot

@Chenthill Thanks :-)

Anonymous said...

Sqlite-Commander has been featured at LinuxLinks.com

Sankar said...

anon: Thanks for the Information.

Anonymous said...

No download? I was looking for such a thing a couple days ago to modify a sqlite database used by the fireclip extension, I just need to change 4 characters >_< A .tar.gz would be appreciated. I could package it as a .deb if that would help.
~ Hazard

jbobbylopez said...

Instructions for compiling (packages required, etc) on different systems (Debian/Ubuntu, Redhat, etc.) would be much appreciated.

vencanice said...

Very usefull thing. Thanks for sharing