listtables.py
changeset 101 2a2d0d5df03b
parent 93 b72591087495
child 104 d8ff52a0390f
equal deleted inserted replaced
100:d6088dba8fea 101:2a2d0d5df03b
     5 
     5 
     6 class ListTablesTool(toolbase.SimpleTool):
     6 class ListTablesTool(toolbase.SimpleTool):
     7     def __init__(self):
     7     def __init__(self):
     8         toolbase.SimpleTool.__init__(self, name='listtables', desc='List tables in database.')
     8         toolbase.SimpleTool.__init__(self, name='listtables', desc='List tables in database.')
     9         self.parser.add_argument('-o', dest='options', type=str, nargs='*', help='Filter by options (eg. -o autovacuum_enabled=false).')
     9         self.parser.add_argument('-o', dest='options', type=str, nargs='*', help='Filter by options (eg. -o autovacuum_enabled=false).')
    10         self.init()
       
    11 
    10 
    12     def main(self):
    11     def main(self):
    13         browser = pgbrowser.PgBrowser(self.pgm.get_conn('target'))
    12         browser = pgbrowser.PgBrowser(self.pgm.get_conn('target'))
    14 
    13 
    15         # scan all tables from all shemas, remember names and sizes
    14         # scan all tables from all shemas, remember names and sizes
    29             table_name = '%s.%s' % (table.schema.name, table.name)
    28             table_name = '%s.%s' % (table.schema.name, table.name)
    30             print(' ', table_name)
    29             print(' ', table_name)
    31 
    30 
    32 
    31 
    33 tool = ListTablesTool()
    32 tool = ListTablesTool()
       
    33 tool.setup()
    34 tool.main()
    34 tool.main()
    35 
    35