Bases: BaseSchemaModel[View]
Model for the View schema.
Source code in pixano/app/models/base_schema.py
| def __init__(self, /, created_at: datetime | None = None, updated_at: datetime | None = None, **data: Any):
"""Create a new model by parsing and validating input data from keyword arguments.
Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
`self` is explicitly positional-only to allow `self` as a field name.
Args:
created_at: The creation date of the object.
updated_at: The last modification date of the object.
data: The data of the object validated by Pydantic.
"""
created_at, updated_at = validate_and_init_create_at_and_update_at(created_at, updated_at)
data.update({"created_at": created_at, "updated_at": updated_at})
super().__init__(**data)
|
to_row(schema_type)
Create a View from the model.
Source code in pixano/app/models/views.py
| def to_row(self, schema_type: type[T]) -> T:
"""Create a [View][pixano.features.View] from the model."""
if not issubclass(schema_type, View):
raise ValueError(f"Schema type must be a subclass of {View.__name__}.")
return super().to_row(schema_type)
|