1. Florian Bösch
  2. sqlalchemy console

Overview

sqlalchemy_console - an sql console based on sqlalchemy

sqlalchemy console allows you to connect to any of the databases supported by sqlalchemy and run an interactive database command line against it.

Features

  • enumerate tables
  • describe tables
  • display output of queries
  • output is ANSI color highlighted
  • in interactive mode output continuation prompt every 10 rows
  • execute arbitary queries
  • if supported by the database, row counts displayed for queries
  • interactive python command line with meta and tables in locals
  • execution of scripts both from the shell and interactive command line
  • execution of single python commands inside the command line
  • error messages in red
  • persistent readline history

Screenshot

http://codeflow.org/projects/sqlalchemy_console/screenshot.png

Install

sqlalchemy console is a python package any of the following commands: command line:

cd sqlalchemy_console; python setup.py install
easy_install sqlalchemy_console
easy_install http://hg.codeflow.org/sqlalchemy_console/archive/tip.tar.gz

Usage

command line::
sqlac [script] --url <database url> --command <command> --no-color --debug

DB URLs

The db URLs accepted by sqlalchemy console are defined by sqlalchemy. for example, these are valid URLs:

sqlite:////absolute/path/to/database.txt
sqlite:///relative/path/to/database.txt
sqlite://:memory:
mysql://localhost/foo
oracle://scott:tiger@dsn
oracle://scott:tiger@127.0.0.1:1521/sidname
mssql://username:password@localhost/database
mssql://username:password@/?dsn=mydsn

For further reference see: http://www.sqlalchemy.org/docs/05/dbengine.html#create-engine-url-arguments

copyright:2009 by Florian Boesch
license:GNU AGPL3, see LICENSE for more details