Pydantic, Everywhere, All at Once
- Track:
- Web Development, Web APIs, Front-End Integration
- Type:
- Talk
- Level:
- intermediate
- Duration:
- 30 minutes
Abstract
Ever tried using “one data model to rule them all” and ended up with a tangle of constraints, endpoints, and SQL tables? You’re not alone! In this talk, we’ll explore the lofty dream of unifying your Pydantic models across constrained LLM generation, FastAPI inputs/outputs, and SQLModel ORM definitions. But, is it possible to keep a single source of truth without driving yourself (and your teammates) nuts? Or should you split them up and keep everyone happy? We’ll tackle practical examples, including the joys (and pains) (mostly pains) of juggling Pydantic v1 vs. v2. You’ll leave with a clear framework for deciding how best to structure your models and a road map for staying sane when you want Pydantic for all the things.