Partially Validated Pydantic Models

Поділитися
Вставка
  • Опубліковано 16 жов 2024
  • #mathbyteacademy #python
    In this video I want to present a really neat approach that one of my students on Udemy came up with to have Pydantic models that will still deserialize invalid data (populated with some value, such as None), as well as provide information about those fields that failed validation.
    I didn't think it could be done, so I was very happy to be proved wrong by that person's very elegant solution! This is a technique that I will probably use often moving forward.
    It is also a great example of a practical application of wrap validators and model validators. Even if you have no need for partially validated Pydantic models, you should still watch this to get a clear understanding of how wrap validators work and can be leveraged.
    Thank you to the author for coming up with this and sharing it on GitHub!
    Code for this Video
    ================
    Available in GitHub blog repo: github.com/fba...
    Direct link: tinyurl.com/52...
    Original author's GitHub repo: github.com/lin...
    My Python Courses
    =================
    Python 3 Fundamentals (introduction to Python)
    www.udemy.com/...
    Pydantic V2: Essentials
    www.udemy.com/...
    Python 3 Deep Dive (Part 1 - Functional)
    www.udemy.com/...
    Python 3 Deep Dive (Part 2 - Iteration, Generators)
    www.udemy.com/...
    Python 3 Deep Dive (Part 3 - Hash Maps)
    www.udemy.com/...
    Python 3 Deep Dive (Part 4 - OOP)
    www.udemy.com/...

КОМЕНТАРІ • 7

  • @szymonpiechutowski2340
    @szymonpiechutowski2340 2 місяці тому +3

    Can you create a video about how to use Pydantic for app config management? How to serialize/deserialize, update them etc. Everything that a standard app does with JSON or YAML config

  • @redDuck757
    @redDuck757 2 місяці тому +1

    New video on the best Python channel🎉🎉🎉
    Thank you

  • @szymonpiechutowski2340
    @szymonpiechutowski2340 2 місяці тому +1

    Hi Fred, happy to see the new video!

  • @pavelekshin9261
    @pavelekshin9261 Місяць тому

    Hi Fred, thanks for sharing, very helpful!💎