Hacker News new | past | comments | ask | show | jobs | submit login

Yeah, you do end up defining everything more than once, once for SA, and then for pydantic. Create, Read, and Update may all be different pydantic models as well. They are for defining what comes in and out of the actual API. Your create request may not have the id field yet and some optional fields, and then the response has everything. And then an update may have everything as optional except the id. Only been using it a few weeks now, but liking it a lot so far.

https://fastapi.tiangolo.com/tutorial/sql-databases/#create-...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: