db_request.py

fast command line requests to a rdbms

Overview

This is a reimplementation of the old oracle_request tool in case of the old language tcl and oracle only access. The arguments should be the same and may be some useful enhancements for a better flexible usage.

Commandline Help Output

Usage: db_request.py [Options] [Statement] if no statement as argument was given, it will be asked from stdin

make a request to a rdbms with a sql statement

Options:
--version show program's version number and exit
-h, --help show this help message and exit
-u USER, --user=USER
 set username
-p PASSWORD, --password=PASSWORD
 set password
-r SERVER, --server=SERVER
 set database server (connection type 'oci' will ask for, 'oci8' not)
-l PORT, --port=PORT
 set database server port (connection type 'oci' will ask for, 'oci8' not)
-d DATABASE, --database=DATABASE
 set name of database instance
-c CONNECTTYPE, --connecttype=CONNECTTYPE
 defines connectiontype to database, (odbc,access,mssql ,mysql,mxodbc,oci8,oci,postgres,postgres8,sqlite)
-x PROFILE, --profile=PROFILE
 using profile for shortcutted connects to database, (devices2,devices2015,devices,mirror)
-n NONE, --none=NONE
 don't execute sequel command
-o FORMAT, --format=FORMAT
 decide the output format (xml,c,csv,tab,python,txt,html,json,php,perl)
--header enable header of columns
--doc create online help in restructured text format. Use "./db_request.py --doc | rst2html" for creation of html help
-t, --test performs simple self-test
--idx write at first the line number, like a line counter
--protocols list of known database protocols
--profiles list of known connection profils
--formats list of known output formats and examples
-v, --verbose writes additional informations

Known Profiles

To expand the profiles inside contact the author.
devices2:
connecttype=postgres server=dbnode1.trs.bessy.de instance=test user=anonymous port=5432
devices2015:
connecttype=postgres8 server=dbnode1.trs.bessy.de instance=devices_2015 user=anonymous port=5432
devices:
connecttype=oci8 server=None instance=devices user=anonymous port=None
mirror:
connecttype=oci8 server=None instance=mirror user=guest port=None

known protocols

Known Formats for Output