Beispiel #1
0
def table_data_view(request, database, schema, table):
    logger.info(
        "table_data_view attempt: %s %s %s %s",
        request.user.email,
        database,
        schema,
        table,
    )

    log_event(
        request.user,
        EventLog.TYPE_DATASET_TABLE_DATA_DOWNLOAD,
        extra={
            "path": request.get_full_path(),
            "database": database,
            "schema": schema,
            "table": table,
        },
    )

    if request.method != "GET":
        return HttpResponseNotAllowed(["GET"])
    elif not can_access_schema_table(request.user, database, schema, table):
        return HttpResponseForbidden()
    elif not (view_exists(database, schema, table)
              or table_exists(database, schema, table)):
        return HttpResponseNotFound()
    else:
        return table_data(request.user.email, database, schema, table)
Beispiel #2
0
def table_data_view(request, database, schema, table):
    logger.info(
        'table_data_view attempt: %s %s %s %s',
        request.user.email,
        database,
        schema,
        table,
    )

    log_event(
        request.user,
        EventLog.TYPE_DATASET_TABLE_DATA_DOWNLOAD,
        extra={
            'path': request.get_full_path(),
            'database': database,
            'schema': schema,
            'table': table,
        },
    )

    if request.method != 'GET':
        return HttpResponseNotAllowed(['GET'])
    elif not can_access_schema_table(request.user, database, schema, table):
        return HttpResponseForbidden()
    elif not (view_exists(database, schema, table)
              or table_exists(database, schema, table)):
        return HttpResponseNotFound()
    else:
        return table_data(request.user.email, database, schema, table)
Beispiel #3
0
 def db_object_exists(db_object):
     return view_exists(db_object.database.memorable_name, db_object.schema,
                        db_object.view)