Adapting types to fix SQLAlchemy's "can't adapt type" error

published on
I have recently been using Pydantic a lot, which is pretty cool since it lets me specify concrete types on my previously untyped data. Until I ran into an error when I was inserting data stored in a Pydantic model to my postgres database using SQLAlchemy. Problem I have a Pydantic model like this to define my incoming data from a request: # Pydantic class class EventSchema(BaseModel): ip_address: IPvAnyAddress Another part in my code defined an SQLAlchemy model to persist this incoming information (along with other data not shown here): Read More...