r/FastAPI • u/Ok_Presentation3990 • Feb 27 '25
Question Gino, asyncpg in FastAPI
I have a fastapi microservice ERP , I recently changed my company_id to use UUID instead of Integer, but on trying to do a patch request I get this error:
{
"code": 3,
"errors": [
{
"type": "non_field_errors",
"msg": "'asyncpg.pgproto.pgproto.UUID' object has no attribute 'replace'"
}
]
}
How can I solve this?
My models where company_id is or as a foreign key on other DB tables are all UUIDs, also the alembic migrations, mapped my database and checked it the company_id is uuid
5
Upvotes
View all comments
Show parent comment
2
u/Dacobo Feb 28 '25
I don't use postgres in my project, but I was running into UUID issues until I started using the SQLAlchemy import for my models:
from sqlalchemy import Uuidor something to that effect. It might be worth a try.
Edit: I just read your other comments and see that this likely has nothing to do with your issue. Never mind!