def create_model(json): name = json["name"] type_name = json["type"] datasource_id = json["datasource"] input_columns = json["input-columns"] type_id = with_session(compose( getattr("id"), query_type_by_name(type_name) )) new_model_id = with_session(create_row(ModelModel, { "name": name, "type_id": type_id, "datasource_id": datasource_id }))["id"] with_session(create_input_columns(input_columns, new_model_id)) queue_model_creation_task(json) return get_model(new_model_id)
def get_table_class(attr): return getattr(attr, Base.classes)
def row_ids(model_class, session): return list(map(getattr("id"), query_all(model_class, session)))
def invoker(x): result = self.decorator(r.getattr(name, self._fn(x)))(*args, **kwargs) return self.resolve(result)