示例#1
0
def get_table(table_id,
              with_schema=True,
              with_column=True,
              with_warnings=True):
    # username = flask_session['uid']
    with DBSession() as session:
        table = logic.get_table_by_id(table_id, session=session)
        api_assert(table, "Invalid table")
        verify_data_schema_permission(table.schema_id, session=session)
        result = table.to_dict(with_schema, with_column, with_warnings)
        return result
示例#2
0
def get_table_by_name(
    schema_name,
    table_name,
    metastore_id,
    with_schema=True,
    with_column=True,
    with_warnings=True,
):
    with DBSession() as session:
        table = logic.get_table_by_name(schema_name,
                                        table_name,
                                        metastore_id,
                                        session=session)
        api_assert(table,
                   "{}.{} does not exist".format(schema_name, table_name))
        verify_data_schema_permission(table.schema_id, session=session)
        table_dict = table.to_dict(with_schema, with_column, with_warnings)

    return table_dict
示例#3
0
def get_tables_from_schema(schema_id):
    with DBSession() as session:
        verify_data_schema_permission(schema_id, session=session)
        return logic.get_table_by_schema_id(schema_id, session=session)