make_filter_model
- specatalog.helpers.helper_functions.make_filter_model(model, creation_model)[source]
Create dynamically a pydantic-class for filtering based on an SQLAlchemy- model.
- Parameters:
model (TimeStampedModel) – An SQLAlchemy model of the type TimeStampedModel or any subclass.
creation_model (BaseModel) – The creation_model from models.creation_pydantic_measurements/molecules that corresponds to the class of model. E.g. model = ms.TREPR -> creation_model = cpm.TREPRModel.
- Returns:
FilterModel – The filter-model contains all column names as optional fields. The type of each field is determined by the type of the column. The default value is None. For numerical fileds additionally fields with comparison operators and for string-type fields text-comparison operators are created. When using the model no addtional fields are allowed.
- Return type:
BaseModel