SQLAlchemy Console

Jul. 31, 2009
comments

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

Download

Install

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

cd sqlalchemy_console; python setup.py install
easy_install sqlalchemy_console

Usage

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: create engine url arguments

License

GNU AGPLv3 or later, Copyright 2009 Florian Bösch