示例#1
0
    def fetch_all_tables(self, conn_id=None, did=None, sid=None):
        status, schemas = get_schemas(self.conn, show_system_objects=False)
        if not status:
            return status, schemas

        all_tables = []
        for row in schemas['rows']:
            status, res = \
                BaseTableView.fetch_tables(self, sid, did, row['oid'])
            if not status:
                return status, res

            all_tables.extend(res.values())

        return True, all_tables
示例#2
0
def prequisite(trans_id, sgid, sid, did):
    conn = _get_connection(sid, did, trans_id)
    helper = ERDHelper(trans_id, sid, did)
    status, col_types = helper.get_types()

    if not status:
        return internal_server_error(errormsg=col_types)

    status, schemas = get_schemas(conn, show_system_objects=False)

    if not status:
        return internal_server_error(errormsg=schemas)

    return make_json_response(data={
        'col_types': col_types,
        'schemas': schemas['rows']
    },
                              status=200)