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.
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.
I have done the video of prefetch_related.😊 Please do let me know your suggestions in the comments. Thank you☺️ th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
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?
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... th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
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
@@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')
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.😔
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☺️ th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
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
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... th-cam.com/play/PLbasZIkCgHJH38p2WkC5GTsgoV_8hlQ4A.html And also please refer this article... hackernoon.com/django-orm-relationships-cheat-sheet-14433d6cf68c
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☺️ th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
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😊
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😊
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☺️ th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
Django prefetch_related | Django select_related vs prefetch_related : th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
This makes so much more sense than the documentation. Thank you!
Glad to hear that...you can also checkout prefetch_related here :
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
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.
Glad to hear that brother...😊
hhmm. delicious example 😌🔥..
Thank you 🙌
thank you so much it helped me alot
Glad it helped!
Very good thanks
Most welcome
Thank You so much bro.
Glad to hear that😊
very good bro.
Thanks a lot👍🏻
amazing..
Thanks a lot
Thank you, for good explanations
Glad to hear that :)
So useful. Thanks for the video.
Glad it was helpful!
thank you , you save me :)
You're welcome!
Thank you!! Very clear explanation.
Thank you ! The explanation is awesome)
Glad to hear that...😊
Great explanation, bro. Thanks a lot!
Glad it was helpful!
Thanks
Welcome.. :)
it was great, thanks for sharing
Glad you enjoyed it
Great video and thanks for the tool, so useful! you saved hours of my life
Thanks again man
Glad it helped! Keep supporting 😊
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.
Thanks a lot and I have noted down the suggestion and will try to improve in future...
awesome broo.. highly appreciated
Glad to hear that brother...Please share in your circle too...Thanks a lot... :)
ThankS!
thank you
Yeah good job! Keep it up!
Thanks a lot👍🏻
Thanx sir
Thanks for select related
Please include prefetch related asap
Definitely, I will upload it very soon. Thanks😊
I have done the video of prefetch_related.😊 Please do let me know your suggestions in the comments. Thank you☺️
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
@@CodeBand video looks good, it covers key basic areas of that method
Thanks❤️
good explanation bro!
Glad you liked it! Thanks for the support and keep supporting :)
Hi which extension have you added on your browser to show requests and response time?
All I can say is I love you!
Thanks a lot...Keep supporting... ☺️
So good ! Now how make a left join query with select_related please
Glad to hear that...have a quick research on left join and you'll find an answer...keep going👍🏻
awesome
Thanks a lot 😊
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?
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...
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
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
Sorry for the late reply...
Did you figured it out?
@@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')
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.
Will try to do that in the future brother...Thanks for the suggestion... :)
@@CodeBand sure. I am waiting for that video.
:)
You should remove "prefetch_related" from the title. You don't talk about it
Your also dont seem to have made a video about it anywhere
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.😔
Probs still a good idea to remove that out the title
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☺️
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
@@CodeBand I mean the title for this is still prefetch_related. Seems somewhat misleading
we can use select_related only in ForeignKey case? or we can use with other joins also
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
Getting error while migrations, Cannot add or update a child row,a foreign key constraint fails
Please post your models.py so that I could help...😊
Thank you. By the way, is it possible to use select_related in class-based view ?
Hey, for sure. It doesn't matter whether you use CBV/FBV.
Very nice video, can we do the same thing with the Q keyword in Django
Thanks a lot brother...There are a couple of ways of doing it...and this one stands out in terms of performance... :)
What if an employee doesn't have a department?
Sorry for the late reply...
That depends on the foreign key configurations.
👍🏻👍🏻👍🏻👍🏻❤️
Thanks a lot brother... :)
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?
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...
th-cam.com/play/PLbasZIkCgHJH38p2WkC5GTsgoV_8hlQ4A.html
And also please refer this article...
hackernoon.com/django-orm-relationships-cheat-sheet-14433d6cf68c
@@CodeBand ok brother. I will refer these and ask from u if I have doubts. Thanx for helping me to learn django.
@@misfarsiddeek3105 It's my pleasure brother...I will definitely help you out in case...Thanks :)
@@CodeBand thnx brother. ❤️
@@misfarsiddeek3105 Welcome brother..:)
Thanks!! By the way, where is the video on prefetch_related??
Glad it was helpful.
I will actually do the prefetch_related in a future video... :)
Thank you :)
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☺️
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
hello sir ...please make a video of prefetch_related today...it's urgent for me ....please
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😊
I have done the video of prefetch_related.😊
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
Will this work on 3 models?
You can use __(double underscores) to access related field, see this : stackoverflow.com/questions/19909672/django-prefetch-related-on-multiple-models
You gonna remove "prefetch_related" for the title yet?
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😊
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☺️
th-cam.com/video/5-UN4YPDDQc/w-d-xo.html
why people use fake accent ..its so irritating!
Sorry to hear that...Honestly, it's not made up...its original😊