where data is an unstructured JSON folder.
The same holds for the API response model StateRead:
class _StateBase(BaseModel):
"""
Base class for `State`.
Attributes:
id: Primary key
data: Content of the state
timestamp: Time stamp of the state
"""
data: dict[str, Any]
timestamp: datetime
class StateRead(_StateBase):
"""
Class for `State` read from database.
Attributes:
id:
"""
id: Optional[int]
_timestamp = validator("timestamp", allow_reuse=True)(valutc("timestamp"))
However we add an additional typing via TaskCollectStatusV2, which is used here:
I suggest we get rid of this model: we either opt for guaranteed structure (thus extracting the relevant attributes from a JSON column into specific columns) or we accept unstructured JSON values.
The relevant db model reads
where
data
is an unstructured JSON folder. The same holds for the API response modelStateRead
:However we add an additional typing via
TaskCollectStatusV2
, which is used here:I suggest we get rid of this model: we either opt for guaranteed structure (thus extracting the relevant attributes from a JSON column into specific columns) or we accept unstructured JSON values.
(cc @mfranzon)