What is Pydantic ? ?
If you are hearing this for first time. Its quite interesting to learn about pydantic. Although we understand that python language is easier to code and faster to complete. But when you have increased in your complexity, you’ll start getting into the world of messy codes. Due to increase in attributes it becomes quite messy to update the values,etc.
Here comes the task for pydantic library.
Things to know:
Super class that it inherits when you build model. >> Base Model
Other factors : List Optional
data types it provides:
id >> integer (string,floats etc.) value are converted into integer else returns exception
name >> string
signup_ts >> datetime field
friends >> uses python’s typing system that requires list of integers
What if your datatype fails ?
you already know it raises error and called as Validation error.
class it have created for such error ValidationError (in pydantic module)
If you want to dive into depth lets connect together and build our earth better with tech and nature.
Linked profile : Adarsha Regmi