3 ms·
I think the big issue is that everyone like pydantic and are willing to put it in places it may not really see a big benefit, over say, DRF. OTOH, if you're a
by bb88 3y ago
I think the big issue is that everyone like pydantic and are willing to put it in places it may not really see a big benefit, over say, DRF.
OTOH, if you're a big fan of NoSQL databases, then pydantic is a godsend.
- mejutoco 3y agoDRF is very dynamic. While useful, it does too much magic for my taste. Pydantic pure data models, combined with typeguard annotations do it for me. Plain functions with defined input output types. It helps validate all the assumptions and catch errors earlier.
- Loeffelmann 3y agoIt will never stop being funny to me when NoSQL people need schemas for their schemaless database.
- physicsguy 3y agoThey have a schema, they just don’t want to write it down. So they write it down in code instead of course. Which isn’t fragile at all…!
- patmorgan23 3y agoIt's almost as if schemas and static types were a good idea/expression of a fundamental reality.
- WD-42 3y agoAs mentioned elsewhere in this thread, simple CRUD usually stops being simple CRUD pretty quickly. If you are actually doing simple CRUD, then DRF's ModelViewSets are great, and Pydantic would indeed be an overkill. However once the view diverges from your DB model, writing Pydantic models IMO is FAR superior than having to write custom DRF serializers.
- bb88 3y agoThe key there is 'IMO' isn't it? If the DB is your schema, great, DRF is awesome. But if the DB is not your schema, no problem, DRF still can handle it. And with DRF you get CRUD by default. And if you don't want CRUD, no problem, DRF has generic API views too.
- WD-42 3y agoSo exactly like this package and ninja? Except instead of writing un typed drf serializers you get to write small, concise pydantic models.