Right now, the most popular SQL command-line tools are
- SQLPlus, included with Oracle, is sometimes great, sometimes annoying, and impossible to modify (source code not available).
- gqlplus is open-source. It's written in C, though, which means (to my mind) that you'll need all of your strength and all of your courage if you want to modify it.
$ pythonNow comes the fun part! Open up mysqlpy.py and sqlpython.py and start modifying. They're very basic right now, but very clean, concise, easy to understand, and easy to modify. For instance, I wanted to be able to issue Python commands like this:
>>> import mysqlpy
SQL.NoConnection> connect hr/hr@xe
SQL.xe> select * from employees;
SQL.xe> py print 'This is a python command';So I added this method to mysqlpy:
This is a python command.
def do_py(self, arg):That's all I did - not one keystroke more - and it works. Now that's extensibility!
If you're not an Oracle person and you're envious, as far as I can tell, it should be easy to modify SQLpython to use any DB-API2 adapter.