Django prefetch_related | Django select_related vs prefetch_related : kzbin.info/www/bejne/a164f2ePhal3h8U
@evanwhite41903 жыл бұрын
This makes so much more sense than the documentation. Thank you!
@CodeBand3 жыл бұрын
Glad to hear that...you can also checkout prefetch_related here : kzbin.info/www/bejne/a164f2ePhal3h8U
@sayadahmedshaurov86393 жыл бұрын
I was looking for this kind of explanation with example. What everyone does is just talks about theory. Thanks for making more sense by giving an example.
@CodeBand3 жыл бұрын
Glad to hear that brother...😊
@rahul_singh_rajput3292 Жыл бұрын
hhmm. delicious example 😌🔥..
@CodeBand Жыл бұрын
Thank you 🙌
@oruchkin3 жыл бұрын
Very good thanks
@CodeBand3 жыл бұрын
Most welcome
@PrriyanshuSharmaa3 жыл бұрын
Thank You so much bro.
@CodeBand3 жыл бұрын
Glad to hear that😊
@vinodinti3 жыл бұрын
very good bro.
@CodeBand3 жыл бұрын
Thanks a lot👍🏻
@likeitthings84182 жыл бұрын
thank you so much it helped me alot
@CodeBand2 жыл бұрын
Glad it helped!
@amirhosseinebneroomi72802 жыл бұрын
amazing..
@CodeBand2 жыл бұрын
Thanks a lot
@mohammadfaisal2039 Жыл бұрын
Thank you, for good explanations
@CodeBand Жыл бұрын
Glad to hear that :)
@hachhh11 ай бұрын
Thank you!! Very clear explanation.
@zoromahm4 жыл бұрын
So useful. Thanks for the video.
@CodeBand4 жыл бұрын
Glad it was helpful!
@mmafhbmmafhb35553 жыл бұрын
thank you , you save me :)
@CodeBand3 жыл бұрын
You're welcome!
@user-ib4pu5zr7l3 жыл бұрын
Thank you ! The explanation is awesome)
@CodeBand3 жыл бұрын
Glad to hear that...😊
@behruzisaev21022 жыл бұрын
Great explanation, bro. Thanks a lot!
@CodeBand2 жыл бұрын
Glad it was helpful!
@omidasadi22642 жыл бұрын
it was great, thanks for sharing
@CodeBand2 жыл бұрын
Glad you enjoyed it
@ricardomoha142 жыл бұрын
Your video is really great, up to the point and easy to understand, just onething.. Try being a bit faster.. I think the video could have been done in 5 minutes instead of 12.
@CodeBand2 жыл бұрын
Thanks a lot and I have noted down the suggestion and will try to improve in future...
@santiagobustamante9704 жыл бұрын
Great video and thanks for the tool, so useful! you saved hours of my life Thanks again man
@CodeBand4 жыл бұрын
Glad it helped! Keep supporting 😊
@MuhammadMahirQ84 жыл бұрын
awesome broo.. highly appreciated
@CodeBand4 жыл бұрын
Glad to hear that brother...Please share in your circle too...Thanks a lot... :)
@nikeshthakor4062 жыл бұрын
Thanks
@CodeBand2 жыл бұрын
Welcome.. :)
@digambar6191 Жыл бұрын
Thanx sir
@romanbush5164 Жыл бұрын
ThankS!
@SAIFHASANAT-cm8xh4 ай бұрын
thank you
@harshamachine_learning78314 жыл бұрын
Thanks for select related Please include prefetch related asap
@CodeBand4 жыл бұрын
Definitely, I will upload it very soon. Thanks😊
@CodeBand4 жыл бұрын
I have done the video of prefetch_related.😊 Please do let me know your suggestions in the comments. Thank you☺️ kzbin.info/www/bejne/a164f2ePhal3h8U
@harshamachine_learning78314 жыл бұрын
@@CodeBand video looks good, it covers key basic areas of that method
@CodeBand4 жыл бұрын
Thanks❤️
@azizbekgulomov28813 жыл бұрын
Yeah good job! Keep it up!
@CodeBand3 жыл бұрын
Thanks a lot👍🏻
@josemanuel91374 жыл бұрын
good explanation bro!
@CodeBand4 жыл бұрын
Glad you liked it! Thanks for the support and keep supporting :)
@rangabharath42534 жыл бұрын
awesome
@CodeBand4 жыл бұрын
Thanks a lot 😊
@imranshaikh-bt5ln7 ай бұрын
Hi which extension have you added on your browser to show requests and response time?
@joshuahadap23734 жыл бұрын
All I can say is I love you!
@CodeBand4 жыл бұрын
Thanks a lot...Keep supporting... ☺️
@bricegnanago4093 жыл бұрын
So good ! Now how make a left join query with select_related please
@CodeBand3 жыл бұрын
Glad to hear that...have a quick research on left join and you'll find an answer...keep going👍🏻
@pritamghosh2704 жыл бұрын
Great explained. Thanks 😊 . If I want objects of Employee table from Department then what to do? For an expample, I want some employees under a specific department. But I want it from the Department model not from Employee. That time what to do?
@CodeBand4 жыл бұрын
Glad to hear that😊. In the case you mentioned, there is no chance of raising an N+1 query problem, because, department id will be there with you, and you just need to fetch all the employees with that specific dept. id, so at most 2 queries will be required. Hope this helps and I recommend you to watch the prefetch_related too... kzbin.info/www/bejne/a164f2ePhal3h8U
@misfarsiddeek31054 жыл бұрын
Brother, can you do a complete CRUD video with validation also? For the data input please use raw html forms. Without using Model Form or django form.
@CodeBand4 жыл бұрын
Will try to do that in the future brother...Thanks for the suggestion... :)
@misfarsiddeek31054 жыл бұрын
@@CodeBand sure. I am waiting for that video.
@CodeBand4 жыл бұрын
:)
@danarardiwinanto2 жыл бұрын
Sir... I want to output count employee per department. let's say I have 8 departments, and I want to outputing all department with and without employee. How can I do this? Thankyou
@CodeBand2 жыл бұрын
Sorry for the late reply... Did you figured it out?
@danarardiwinanto2 жыл бұрын
@@CodeBand Yes, I have figured it out. I need to annotate (right join) my employee_id on department table. Should be like this: Department.objects.values('id_department').annotate(Counter=Count('employee')).values('id_department', 'Counter')
@yollaifliandry4952 жыл бұрын
Thank you. By the way, is it possible to use select_related in class-based view ?
@CodeBand2 жыл бұрын
Hey, for sure. It doesn't matter whether you use CBV/FBV.
@FitriWibowo4 жыл бұрын
Very nice video, can we do the same thing with the Q keyword in Django
@CodeBand4 жыл бұрын
Thanks a lot brother...There are a couple of ways of doing it...and this one stands out in terms of performance... :)
@mfsdrawings86004 жыл бұрын
👍🏻👍🏻👍🏻👍🏻❤️
@CodeBand4 жыл бұрын
Thanks a lot brother... :)
@jmdesros2 жыл бұрын
What if an employee doesn't have a department?
@CodeBand2 жыл бұрын
Sorry for the late reply... That depends on the foreign key configurations.
@RedElectrik4 жыл бұрын
You should remove "prefetch_related" from the title. You don't talk about it
@RedElectrik4 жыл бұрын
Your also dont seem to have made a video about it anywhere
@CodeBand4 жыл бұрын
Actually, I planned to do both in a single video, but unfortunately, I couldn't. I will definitely make a video on prefetch_related very soon, I planned it earlier, but somehow I got into some other videos. Sorry for the inconvenience caused.😔
@RedElectrik4 жыл бұрын
Probs still a good idea to remove that out the title
@CodeBand4 жыл бұрын
I have done the video of prefetch_related.😊 I also discuss when to use prefetch_related or select_related and their differences in the video. Please do let me know your suggestions in the comments. Thank you☺️ kzbin.info/www/bejne/a164f2ePhal3h8U
@RedElectrik4 жыл бұрын
@@CodeBand I mean the title for this is still prefetch_related. Seems somewhat misleading
@misfarsiddeek31054 жыл бұрын
Hi. Great brother. May know that what is the different between mentioning Foreignkey, many to many and one to many in our model? Are they same?
@CodeBand4 жыл бұрын
Thanks a lot brother...and about mentioning the foreign key and all, it totally depends on what kind of relationship you wanna use... I recommend you to watch this playlist...you will get a better idea... kzbin.info/aero/PLbasZIkCgHJH38p2WkC5GTsgoV_8hlQ4A And also please refer this article... hackernoon.com/django-orm-relationships-cheat-sheet-14433d6cf68c
@misfarsiddeek31054 жыл бұрын
@@CodeBand ok brother. I will refer these and ask from u if I have doubts. Thanx for helping me to learn django.
@CodeBand4 жыл бұрын
@@misfarsiddeek3105 It's my pleasure brother...I will definitely help you out in case...Thanks :)
@misfarsiddeek31054 жыл бұрын
@@CodeBand thnx brother. ❤️
@CodeBand4 жыл бұрын
@@misfarsiddeek3105 Welcome brother..:)
@pankaj95753 жыл бұрын
Getting error while migrations, Cannot add or update a child row,a foreign key constraint fails
@CodeBand3 жыл бұрын
Please post your models.py so that I could help...😊
@abhisharma85264 жыл бұрын
hello sir ...please make a video of prefetch_related today...it's urgent for me ....please
@CodeBand4 жыл бұрын
I'm very sorry...I have not scheduled any video for today...but I can assure, the next video is prefetch_related. Meanwhile, you can refer other resources. Thank you for the support😊
@CodeBand4 жыл бұрын
I have done the video of prefetch_related.😊 kzbin.info/www/bejne/a164f2ePhal3h8U
@deepanshuaggarwal70423 жыл бұрын
we can use select_related only in ForeignKey case? or we can use with other joins also
@CodeBand3 жыл бұрын
select_related is limited to single-valued relationships - foreign key and one-to-one. For more clarification, please see this post in SO. stackoverflow.com/questions/31237042/whats-the-difference-between-select-related-and-prefetch-related-in-django-orm
@rojanshrestha8224 жыл бұрын
Thanks!! By the way, where is the video on prefetch_related??
@CodeBand4 жыл бұрын
Glad it was helpful. I will actually do the prefetch_related in a future video... :) Thank you :)
@CodeBand4 жыл бұрын
I have done the video of prefetch_related.😊 I also discuss when to use prefetch_related or select_related and their differences in the video. Please do let me know your suggestions in the comments. Thank you☺️ kzbin.info/www/bejne/a164f2ePhal3h8U
@paranoia91422 жыл бұрын
Will this work on 3 models?
@CodeBand2 жыл бұрын
You can use __(double underscores) to access related field, see this : stackoverflow.com/questions/19909672/django-prefetch-related-on-multiple-models
@RedElectrik4 жыл бұрын
You gonna remove "prefetch_related" for the title yet?
@CodeBand4 жыл бұрын
I'm planning to do the next video in prefetch_related, so that I could put up both of them as a playlist and hence it would not be a big issue. Please let me know your view on this😊
@CodeBand4 жыл бұрын
I have done the video of prefetch_related.😊 I also discuss when to use prefetch_related or select_related and their differences in the video. Please do let me know your suggestions in the comments. Thank you☺️ kzbin.info/www/bejne/a164f2ePhal3h8U
@flowing_dance4 жыл бұрын
why people use fake accent ..its so irritating!
@CodeBand4 жыл бұрын
Sorry to hear that...Honestly, it's not made up...its original😊