Popular recipes by jo http://code.activestate.com/recipes/users/4185610/2013-03-14T09:13:01-07:00ActiveState Code Recipessql+ the SQL*Plus killer (Python)
2013-03-14T09:13:01-07:00johttp://code.activestate.com/recipes/users/4185610/http://code.activestate.com/recipes/578490-sql-the-sqlplus-killer/
<p style="color: grey">
Python
recipe 578490
by <a href="/recipes/users/4185610/">jo</a>
(<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/db/">db</a>, <a href="/recipes/tags/db_client/">db_client</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/sql_client/">sql_client</a>).
Revision 3.
</p>
<p>This recipe is an emulator of the Oracle SQL*Plus, but it does things in a more friendly way ;).</p>
<p>If you need a client to access your Oracle but you don't like SQL*Plus, try this one.</p>
<p>This recipe was inspired by James Thiele's Console built with Cmd object recipe.</p>
<p>It provides a 'help' facility and supplies command completion when you hit the 'tab' key.</p>
<p>In addition you can use command line editing and history keys.</p>
<p>Here are the commands that you can use:</p>
<pre class="prettyprint"><code>========================================
Documented commands (type help <topic>):
========================================
constraints edit help input sequences shell
db exit history output set tables
desc foreigns index quit settings triggers
</code></pre>
<p>You can edit the queries using 'vim' or any other editor.</p>
<p>The command 'output' can redirect output to a file and command 'input' can input commands from a file.</p>
<p>There's paginated output.</p>
<p>The command 'shell' or '!' allow you to perform operating system commands.</p>
<p>You can add commands by defining methods with names of the form 'do_xxx()' where 'xxx' is
the name of the command you wish to add.</p>
<p>There is a configuration file (.sql+) where you need to enter the dburi, editor name and other
settings.</p>