Intro to Pydantic V1

  Рет қаралды 19,007

MathByte Academy

MathByte Academy

Күн бұрын

Пікірлер: 54
@leoiceman10
@leoiceman10 4 ай бұрын
really cool to see you have youtube channel now Fred !!!, really there is no one better than you, when it comes to explaining python concepts, btw i also wrote to you linkedin about it, that i got a job in Amazon, using your material on python to prepare for interviews.
@mathbyteacademy
@mathbyteacademy 4 ай бұрын
Thanks! that's great about getting your job, glad you found my Python material useful for that!
@santoshkaladagi
@santoshkaladagi 2 жыл бұрын
I bought all your courses in udemy. They are amazing and have helped me a lot. Thanks for uploading these videos on youtube. I hope at some point you make a video on asyncio too. Take care
@mathbyteacademy
@mathbyteacademy 2 жыл бұрын
Glad you like them!
@rje4242
@rje4242 Жыл бұрын
same here. Dr Baptiste's Udemy course is excellent and I was happy to hear his voice in a youtube channel.
@VivekKumarSinha25
@VivekKumarSinha25 10 ай бұрын
@@mathbyteacademy Could you please tell which version of pydantic have you used for demonstration in this video?
@amidfallen
@amidfallen 2 жыл бұрын
Pydantic is such great library! I'm looking forward to a content about FastAPI.
@difegam3
@difegam3 Жыл бұрын
Thanks! You’re an amazing educator. I am in the part 2 of your Udemy course, and I have already bought the other two. Thanks a lot for sharing your knowledge in this incredible simple way.
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Thanks!
@machinimaaquinix3178
@machinimaaquinix3178 2 жыл бұрын
This is a fantastic intro to pydantic. Most other YT videos are too short and narrow. This covers the material in just the right amount with a great real world example at the end. Very well done, you got a new sub and potential udemy course buyer. (when I get to those topics :D)
@mathbyteacademy
@mathbyteacademy 2 жыл бұрын
Glad you enjoyed it!
@kevon217
@kevon217 Жыл бұрын
Great, thorough walkthrough. Really appreciate your expertise. Excited to start implementing pydantic.
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Thanks, and best of luck!
@moose304
@moose304 Жыл бұрын
Really fantastic walk through/tutorial. One of the best I've seen. Thank you!
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Glad you enjoyed it!
@proMehediBD
@proMehediBD Жыл бұрын
This is a great tutotial! Thanks a lot for the video!! But one thing is missing from here that is - Relation with other table with id. For example books: { title: "" author: "objectId" }
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Thanks Mehedi - glad you liked it! I'm not following you, can you explain a bit more?
@Daniii3004
@Daniii3004 Жыл бұрын
thank you very much, great overview!
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Glad it was helpful!
@awaismirza7908
@awaismirza7908 2 жыл бұрын
Great work! A suggestion would be to divide the video and GitHub notebook into different sections. This makes following them easy.
@pradeepgb986
@pradeepgb986 Жыл бұрын
Very nice and detailed explanation on using the validators in Pydantic. Thank you so much. Can you please upload a video on validating the data (using pydantic) by reading from a csv file and then inserting the data into a PostGres (Or any database) table?
@mathiaz943
@mathiaz943 2 жыл бұрын
Thanks Fred for the awesome tutorial. I have one suggestion: please make sure you are not tying at the bottom of your screen, when I pause the video I see the YT's video control UIs over what you've just typed which makes it impossible to read...
@mathbyteacademy
@mathbyteacademy 2 жыл бұрын
Thanks for the tip!
@warrenmarkham8891
@warrenmarkham8891 Жыл бұрын
Anyone know whether Pydantic can be integrated into PySpark? I tried mapping parsed data strings to a BaseModel object instead of a namedtuple object for each record and I had an error related to pickling. Background: I am creating a PySpark ETL on AWS for an internship. I'm new to all three (AWS, PySpark, ETL concepts) so my mental models may be incoherent, but I'm wondering if: Use Cases: - Pydantic can be used to validate records on read/update - Pydantic can be used to validate and generate test data - other things? No expectation of an answer. I understand that people have their own lives and things. Just thought I would ask. P.S: I love everything Fred does. At the end of a hard day learning and working, I relax by learning from Fred's content. They are just so well put together and delivered from such a nice place of calm and thoughtfulness that it is a pleasure rather than a battle to learn from him.
@warrenmarkham8891
@warrenmarkham8891 Жыл бұрын
Just saw a link to the Faker library. Maybe I should look into that for the 'validate and generate test data' use case.
@SyedMuhammadHussain1
@SyedMuhammadHussain1 11 ай бұрын
1:10:07 why is the second person's display name None? I think it should be "Oskar M". And btw thanks for such a useful and detailed video on pydantic. I couldn't find something like this anywhere.
@mathbyteacademy
@mathbyteacademy 11 ай бұрын
Yeah, it should be - not sure what happened when I was recording . If you check the notebook in GitHub you'll see the display name correctly populated. Glad you liked the video!
@dankprole7884
@dankprole7884 Жыл бұрын
Great video! 1 question I have is where you added an empty list as the default value for an argument. If we do this in standard Python classes then all instances will share the same list, leading to some potentially unwanted side effects. Does pydantic take care of this for us?
@mathbyteacademy
@mathbyteacademy Жыл бұрын
It does - you can just try it out for yourself and test by making two instances of the same Pydantic model, and test identity of the attribute of the two different instances (using `is`) - you'll see that the result is `False`
@dankprole7884
@dankprole7884 Жыл бұрын
@@mathbyteacademy thank you - looking forward to using it!
@souravbiswas4489
@souravbiswas4489 Жыл бұрын
Fred, I am a big fan of your teaching from udemy and this channel. Requesting you to make a video about dbapi, sqlalchemy and alembic. There is not any good tutorial available, at least in the detailed way you teach..
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Thanks, glad you like it! However, SQLAlchemy (or other ORMs) is not a topic I will cover - I avoid it as much as possible, since I prefer actually writing SQL by hand.
@syedabdul8509
@syedabdul8509 10 ай бұрын
When you print ex.json() @6:18, how are you getting the output in a nice formatted manner? For me, the print of a list is a single line with the scroll bar
@mathbyteacademy
@mathbyteacademy 10 ай бұрын
I wonder if something changed in later versions of V1. Certainly things changed in Pydantic V2.x. You can use this to print nicely indented JSON: `print(ex.json(indent=2))`
@syedabdul8509
@syedabdul8509 10 ай бұрын
@@mathbyteacademy Yeah, giving indent worked. Also when can we expect the new Pydantic V2 complete tutorial?
@mathbyteacademy
@mathbyteacademy 10 ай бұрын
​@@syedabdul8509 Glad it worked! I am finalizing a full Pydantic V2 course that will be released on Udemy in early January.
@PythonicDevs
@PythonicDevs Жыл бұрын
Best
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Thanks!
@CyrilLevyMarchal
@CyrilLevyMarchal 2 жыл бұрын
As good as your awesome udemy courses!
@mathbyteacademy
@mathbyteacademy 2 жыл бұрын
Thanks Cyril!
2 жыл бұрын
great thank you
@mathbyteacademy
@mathbyteacademy 2 жыл бұрын
Welcome 😊
@iaaslabs9141
@iaaslabs9141 2 жыл бұрын
thank you sir
@mathbyteacademy
@mathbyteacademy 2 жыл бұрын
You're welcome!
@СергейБабичев-л2ы
@СергейБабичев-л2ы Жыл бұрын
👍🏻
@elsavelaz
@elsavelaz Жыл бұрын
Can someone please help me demistify “validation checking,” because pydantic seems like typechecking on steroids. Reason is that data in the wild might have some random letters that would pass pydantic but it’s not REALLY data validation. This may be because the way “data validation “ is used varies depending on which part of a workflow or tech stack, but I feel nontechnical audiences can’t wrap head around this nuance, and end up with still not necessarily “good data,” just better data. Please correct me if I’m wrong
@elsavelaz
@elsavelaz Жыл бұрын
Of course a solution for example with names, is using something like the python Human Name Parser in conjunction and add some simple checks and exceptions list, but what about in numeric data that can fall in ranges for multiple IoT streams or such? I once worked somewhere that didn’t understand the many to one faultiness of type checking so their data was lots of sensor data that was scrambled and of course their models sucked … so am checking here to see if pydantic would solve something like that, which I don’t think it can in isolation but maybe I’m wrong
@mathbyteacademy
@mathbyteacademy Жыл бұрын
You can write custom validators in Pydantic. I cover the basics of that in this video. You can also create validators that can reference other fields in the structure (in case you need validation using combinations of fields) - also covered in this video.
@elsavelaz
@elsavelaz Жыл бұрын
@@mathbyteacademy can you give me an example of a custom validator that makes sure something is a name? Or are you saying, attach something like human name parser to a validator then that is the custom validator ? I’m probably just missing something here… I will also ask chatGPT for a similar example
@elsavelaz
@elsavelaz Жыл бұрын
Thanks for the response by the way!!
@mathbyteacademy
@mathbyteacademy Жыл бұрын
Yes, you need to write your own Python function (as a pydantic custom validator) that examines the bit of data and determines if it is valid - the implementation of that validation function is entirely up to you. Pydantic has some built-in validators for common things (like integers constrained to some range, text from a pre-defined collection of possible values, etc). But Pydantic isn't going to provide you with more specific validations such as checking if a string is a name - that's something you have to write your own code for. As far as how to verify that a string is a name, I have no idea how you would do that - if I gave you a string like "drmla" or "ngoc" how would you determine (not in code, just manually inspecting) if that is a valid name?
Unicode
25:22
MathByte Academy
Рет қаралды 1,6 М.
A Deep Dive into Python's Dataclasses (Part 1)
1:07:42
MathByte Academy
Рет қаралды 10 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 23 МЛН
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 121 МЛН
Pydantic (V2) - In-depth Starter Guide
1:13:20
MathByte Academy
Рет қаралды 14 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 280 М.
Pydantic Has Saved Me Countless Hours Of Debugging
14:52
Eric Roby
Рет қаралды 6 М.
Concurrency Concepts in Python
51:57
MathByte Academy
Рет қаралды 9 М.
Введение в Pydantic в Питоне(Python)
7:03
Андрей Иванов | Python
Рет қаралды 8 М.
Pydantic: Migrating from V1 to V2
44:10
MathByte Academy
Рет қаралды 2,4 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 23 МЛН