r/FastAPI • u/Lucky-Sense-2650 • Jun 22 '26
Question Help with Pydantic schema
Using FastAPI + SQLAlchemy (async) + Pydantic v2
My `Post` model in db stores `author_id` (UUID foreign key).
My `PostRead` response schema needs to return `author_username` (a string from the related `User` table).
What's the clean way to handle this?
15
Upvotes
View all comments
Show parent comment
1
u/Lucky-Sense-2650 Jun 22 '26
Main problem is, do I have to requery the author