def get_model_schema_set_by_code(code):
    model_schema_set_dict = load_raw_schema_by_code(code)
    if model_schema_set_dict is not None:
        model_schema_set = ModelSchemaSet(**model_schema_set_dict)
        return model_schema_set
    else:
        return None
def create_raw_data_model_set(code, data):
    model_schema_set = ModelSchemaSet()
    model_schema_set.id = get_surrogate_key()
    model_schema_set.code = code
    model_schema_set.schemas = {}
    model_schema_set.relationships = {}
    create_schema(model_schema_set, code, data, True)
    # insert_data_schema(model_schema_set.dict())
    return model_schema_set
Пример #3
0
def create_raw_data_model_set(code, data):
    model_schema_set = get_model_schema_set_by_code(code)
    if model_schema_set is not None:
        create_schema(model_schema_set, code, data, True)
        update_data_schema(model_schema_set.id, model_schema_set.dict())
    else:
        model_schema_set = ModelSchemaSet()
        model_schema_set.id = get_surrogate_key()
        model_schema_set.code = code
        model_schema_set.schemas = {}
        model_schema_set.relationships = {}
        create_schema(model_schema_set, code, data, True)
        insert_data_schema(model_schema_set.dict())

    return model_schema_set