--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ibrowser.py Tue Dec 11 10:49:42 2012 +0100
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+"""
+interactive schema browser
+
+Connect to specified database and open interactive shell.
+
+PgBrowser instance is "browser".
+
+Example:
+
+>>> browser.schemas['myschema'].tables['mytable'].columns['id'].default
+"nextval('mytable_id_seq'::regclass)"
+
+"""
+
+from pgtoolkit import pgbrowser, toolbase
+
+import code
+
+
+class InteractiveBrowserTool(toolbase.SimpleTool):
+ def __init__(self):
+ toolbase.SimpleTool.__init__(self, name='ibrowser', desc='Interactive schema browser.')
+ self.init()
+
+ def main(self):
+ browser = pgbrowser.PgBrowser(self.pgm.get_conn('target'))
+ shell = code.InteractiveConsole(locals())
+ shell.interact()
+
+
+tool = InteractiveBrowserTool()
+tool.main()
+