def get_objects(self, schema, object_type='all', echo=True):
    "Get metadata for objects. object_type in 'all', 'table', 'view'"
    Rec = namedtuple('Table', 'schema object_name object_type')
    self._fields = Rec._fields

    def get_rec(object_name, object_type):
        r_dict = dict(schema=schema, object_name=object_name, object_type=object_type)
        return Rec(**r_dict)
    if (object_type == 'all'):
        table_rows = self.get_tables(schema)
        rows = [get_rec(r.table, 'table') for r in sorted(table_rows)]
        view_rows = self.get_views(schema)
        rows += [get_rec(r.view, 'view') for r in sorted(view_rows)]
    elif (object_type == 'table'):
        table_rows = self.get_tables(schema)
        rows = [get_rec(r.table, 'table') for r in sorted(table_rows)]
    elif (object_type == 'view'):
        view_rows = self.get_views(schema)
        rows += [get_rec(r.view, 'view') for r in sorted(view_rows)]
    else:
        raise Exception('Object type "{}" not supported!'.format(object_type))
    return rows
Get metadata for objects. object_type in 'all', 'table', 'view'
def get_objects(self, schema, object_type='all', echo=True):
    
    Rec = namedtuple('Table', 'schema object_name object_type')
    self._fields = Rec._fields

    def get_rec(object_name, object_type):
        r_dict = dict(schema=schema, object_name=object_name, object_type=object_type)
        return Rec(**r_dict)
    if (object_type == 'all'):
        table_rows = self.get_tables(schema)
        rows = [get_rec(r.table, 'table') for r in sorted(table_rows)]
        view_rows = self.get_views(schema)
        rows += [get_rec(r.view, 'view') for r in sorted(view_rows)]
    elif (object_type == 'table'):
        table_rows = self.get_tables(schema)
        rows = [get_rec(r.table, 'table') for r in sorted(table_rows)]
    elif (object_type == 'view'):
        view_rows = self.get_views(schema)
        rows += [get_rec(r.view, 'view') for r in sorted(view_rows)]
    else:
        raise Exception('Object type "{}" not supported!'.format(object_type))
    return rows