Source

dumbo / readme.rst

 ,                    __                __
((_,-.           ____/ /_  ______ ___  / /_  ____
 '-.\_)'-,      / __  / / / / __ `__ \/ __ \/ __ \
    )  _ )'-   / /_/ / /_/ / / / / / / /_/ / /_/ /
   (/(/ \))    \__,_/\__,_/_/ /_/ /_/_.___/\____/

Dumbo 0.60

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.

Requirements

  • 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.

Installation

On the aforementioned Ubuntu Precise, it is done thusly:

  1. If necessary, install and configure:

    sudo apt-get install postgresql
    
  2. 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.

  3. 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:

    dumbo ~/another.ini
    
  4. chmod a+x dumbo (pip/hg set this one up for me.) Run dumbo

Usage

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.

TODO List

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?
Done:
  • 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.

Known Limitations

  • Postgres only.
  • Does not clear or fix screen on exit from linux console. urwid/curses bug?
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.