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)
def get_table_fields(tenant_id, schema_id, table_id): return unwrap_response(retrieve_schema_table_fields(tenant_id, schema_id, table_id))
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)
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)
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))
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)
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)))
def create_new_tenant(): tenant = save_tenant(json.loads(request.data), uuid.uuid4()) return unwrap_response(tenant)
def get_all_schemas(tenant_id): """ Retrieves all the schema definitions """ return unwrap_response(retrieve_all_schemas(tenant_id))
def get_all_tenants(): """ Retrieves all the tenant definitions """ return unwrap_response(retrieve_all_tenants())
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)
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)
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)
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())])