, __ __ ((_,-. ____/ /_ ______ ___ / /_ ____ '-.\_)'-, / __ / / / / __ `__ \/ __ \/ __ \ ) _ )'- / /_/ / /_/ / / / / / / /_/ / /_/ / (/(/ \)) \__,_/\__,_/_/ /_/ /_/_.___/\____/
Dumbo is a simple database viewer aiming to be pgadmin work-a-like for the console.
I need to occasionally administer db servers over ssh and feel that psql is a bit tedious when you don't use it every day. pgadmin is great but needs to be run locally (mine is a headless server, no X) which requires the database to be accessible via the internet. I also needed an excuse to try Urwid.
Dumbo has been written to work with postgres, but have tried to make it DB agnostic. It may work with other databases with some effort.
- Recent python (2.6 or 2.7)
- Recent urwid and possibly curses
- Recent database module, e.g. python-psycopg2 for postgres
- A running database
So far it has been tested on Ubuntu Maverick thru Precise, but should work other places after some tweaking. Also reported to work on an OpenSuse 11.4 / Py 2.7 / PG 9.0 combo.
On the aforementioned Ubuntu Precise, it is done thusly:
If necessary, install and configure:
sudo apt-get install postgresql
Then you can use pip:
sudo pip install pg-dumbo
or the prerequisites and optional packages:
sudo apt-get install urwid python-psycopg2 mercurial
Download or "hg clone" this repository to local folder.
Edit the ini file:
This file contains the necessary information to configure dumbo.
Things that can be configured here:
- database connection
- postgres may not need any of these fields filled if you have a local server running, matching username and database, etc.
- color theme and palette
Edit this file to add your database addresss and credentials.
Dumbo will check for the file in these locations in order:
./dumbo.ini, ~/.config/dumbo.ini, /etc/dumbo.ini
Another path can be given as a command line argument:
- database connection
chmod a+x dumbo (pip/hg set this one up for me.) Run dumbo
Dumbo has a Windows Explorer-type interface, a tree of databases and tables on the left, with a table viewer on the right.
Use the arrow keys to move around the tree. The right and left arrow keys can expand/collapse folders (databases).
Use the Enter key or left-click to view a table or expand/collapse. Use the tab key to switch focus to the table viewer, and again to return. Enlarge the terminal window get more real-estate.
Escape or (q while focused on the tree) will exit the program.
- Before 1.0:
- First column, not legend should get focus on tab.
- Move mouse handling code into tree control.
- Tone down logo with palette on light theme.
- Thinking about using Ctrl+S to save (commit) to db instead of immediately.
- Before 1.x:
- Add menu bar, dialogs, etc.
- Work with other dbs if possible.
- separate ini files?
- Refactor into a more OO style/remove global vars.
- Fix bug: current database tables are listed under every database :/ Looks like postgres will need a separate connection for each.
- XP Explorer style folders, others will collapse on expansion.
- Choose ini file from cmd line
- Query/display column metadata
- Write to database.
- Query for primary key and sort by it.
- Postgres only.
- Does not clear or fix screen on exit from linux console. urwid/curses bug?