Example #1
0
def function_doc(funk_name):
    """
    Returns the docstring of the function requested by name
    :param funk_name: Name of the function to get the docstring from
    :type funk_name: str
    :returns: dict -- Object with the docstring as the message attribute
    """
    try:
        module = __import__('polyglot.pyapi.validations', fromlist=[funk_name])
        funk = getattr(module, funk_name)
        return unwrap_response(dict(docstring=funk.func_doc))
    except AttributeError:
        raise ResourceNotFoundException("The function, %s, does not exist as a validation" % funk_name)
Example #2
0
def get_table_fields(tenant_id, schema_id, table_id):
    return unwrap_response(retrieve_schema_table_fields(tenant_id, schema_id, table_id))
Example #3
0
def save_table_fields(tenant_id, schema_id, table_id):
    """
    """
    field = save_field(json.loads(request.data), tenant_id, schema_id, table_id, uuid.uuid4())
    return unwrap_response(field)
Example #4
0
def create_schema_table(tenant_id, schema_id):
    """
    Retrieves the Tables for a Schema
    """
    table = save_table(json.loads(request.data), uuid.UUID(tenant_id), uuid.UUID(schema_id), uuid.uuid4())
    return unwrap_response(table)
Example #5
0
def get_table(tenant_id, schema_id, table_id):
    """
    Retrieves the table and its fields
    """
    return unwrap_response(retrieve_schema_table(tenant_id, schema_id, table_id))
Example #6
0
def create_new_schema(tenant_id):
    """
    Create a new schema definition
    """
    schema = save_schema(json.loads(request.data), tenant_id, uuid.uuid4())
    return unwrap_response(schema)
Example #7
0
def get_schema_tables(tenant_id, schema_id):
    """
    Retrieves the Tables for a Schema
    """
    return unwrap_response(retrieve_schema_tables(tenant_id, uuid.UUID(schema_id)))
Example #8
0
def create_new_tenant():
    tenant = save_tenant(json.loads(request.data), uuid.uuid4())
    return unwrap_response(tenant)
Example #9
0
def get_all_schemas(tenant_id):
    """
    Retrieves all the schema definitions
    """
    return unwrap_response(retrieve_all_schemas(tenant_id))
Example #10
0
def get_all_tenants():
    """
    Retrieves all the tenant definitions
    """
    return unwrap_response(retrieve_all_tenants())
Example #11
0
def update_existing_instance(tenant_id, schema_id, table_id, instance_id):
    """
    """
    instance = save_instance(json.loads(request.data), tenant_id, schema_id, table_id, instance_id)
    return unwrap_response(instance)
Example #12
0
def save_new_instance(tenant_id, schema_id, table_id):
    """
    """
    instance = save_instance(json.loads(request.data), tenant_id, schema_id, table_id, uuid.uuid4())
    return unwrap_response(instance)
Example #13
0
def get_one_instance(tenant_id, schema_id, table_id, instance_id):
    """
    """
    filters = ['id', 'tenant_id', 'schema_id', 'table_id']
    instance = retrieve_one_instance(tenant_id, schema_id, table_id, instance_id).clean4_dump()
    return unwrap_response(instance, filters=filters)
Example #14
0
def get_all_instances(tenant_id, schema_id, table_id):
    """
    """
    return unwrap_response([instance for instance in retrieve_all_instances(tenant_id, schema_id, table_id, query_filters=add_filter_fields())])