make_ordering_model

specatalog.helpers.helper_functions.make_ordering_model(model)[source]

Create dynamically a pydantic-class for ordering based on an SQLAlchemy model.

Parameters:

model (TimeStampedModel) – An SQLAlchemy model of the type TimeStampedModel or any subclass.

Returns:

OrderingModel – The ordering-model contains all column names as optional fields with the default-value None. The value of the field can only be set to “asc” (to indicate ascending ordering) or “desc” (to indicate descending ordering). No additional fields can be created when using the model.

Return type:

BaseModel