Skip to content

Commit

Permalink
🐛Handle case where metadata in comp_runs are NULL (#4646)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored Aug 23, 2023
1 parent 18dc092 commit 08e7c25
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ def ensure_utc(cls, v: datetime.datetime | None) -> datetime.datetime | None:
v = v.replace(tzinfo=datetime.timezone.utc)
return v

@validator("metadata", pre=True)
@classmethod
def convert_null_to_empty_metadata(cls, v):
if v is None:
v = RunMetadataDict()
return v

class Config:
orm_mode = True
schema_extra: ClassVar[dict[str, Any]] = {
Expand Down

0 comments on commit 08e7c25

Please sign in to comment.