SQLalchemy is widely used ORM for python.
Serializing Pydantic Types
As per the answer here, we initialise our engine with a custom json serializer:
Notably pydantic.json.pydantic_encoder
is now deprecated so there may be a more up to date, idiomatic way to do this