Django Aggregation & Annotation / values() and values_list() functions

  Рет қаралды 11,563

BugBytes

BugBytes

Күн бұрын

Пікірлер: 72
@bugbytes3923
@bugbytes3923 9 ай бұрын
Playlist link: kzbin.info/www/bejne/e6SlonyQordli8U
@rhysjesett99
@rhysjesett99 Жыл бұрын
These are genuinely some of the most helpful tutorials on the Internet. No fluff, just constant gold.
@bugbytes3923
@bugbytes3923 Жыл бұрын
Wow, thanks a lot! Delighted to hear that!
@XzibiTP
@XzibiTP Ай бұрын
I have watched so many tutorials and yours is the best i have come across. Its detailed easy to understand and structured. Keep the good work up. Thanks
@bugbytes3923
@bugbytes3923 Ай бұрын
That's incredible, thank you for sharing! Amazing to hear that.
@gigi123-hp3
@gigi123-hp3 Ай бұрын
Never seen a tutorial so well explained...❤
@bugbytes3923
@bugbytes3923 Ай бұрын
Thanks a lot!!
@DecodingTruth101
@DecodingTruth101 Ай бұрын
Highly appreciate your in depth explanation and usage ,Thankyou
@bugbytes3923
@bugbytes3923 Ай бұрын
@@DecodingTruth101 thanks a lot, appreciate it!
@hemrajkaliraman1
@hemrajkaliraman1 4 ай бұрын
Best series on Django advance topics. I have improved the performance of my project a lot. you are doing a great job creating a lot of value.
@bugbytes3923
@bugbytes3923 3 ай бұрын
Thanks a lot, glad to hear it, cheers!
@codedjango
@codedjango Жыл бұрын
Very nice explanation on aggregate and annotate.....thank you so much
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks very much!
@khunjohn1054
@khunjohn1054 Жыл бұрын
As usual, great tutorial. I hope that in the next video you include OuterRef and Subquery. This is a more advanced topic, but it packs a ton of functionality. ie. Let's say you have a company with many offices and one of those offices is market as the HQ. With OuterRef and Subquery, you can annotate the company address from the specific office in the many to one related table marked as the HQ and also aggregate the total amount of employees as a Sum of each office.
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thank you! I'll cover these topics very soon - not the next video but the one after, I think. But yeah, will definitely cover it!
@the_code_js
@the_code_js 24 күн бұрын
The best teacher, thank you so much.
@bugbytes3923
@bugbytes3923 21 күн бұрын
Thanks a lot!
@Rinpower
@Rinpower Ай бұрын
very helpful, that's exactly what I was looking for, thanks again bro !!
@seydinaoumarsamabaly1806
@seydinaoumarsamabaly1806 Жыл бұрын
I just want to thank you Master 🙌🏾before I finish watching the tutorial !
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks as always! 😄
@robhafemeister3100
@robhafemeister3100 Жыл бұрын
Great video! you explained in less than an hour what probably took me a week to learn on my own awhile back. Love it!
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot Rob, much appreciated as always!
@Peterstavrou
@Peterstavrou Жыл бұрын
This series has been incredible!
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot Peter!
@diegofunes1802
@diegofunes1802 6 ай бұрын
Excellent video! Many thanks!
@bugbytes3923
@bugbytes3923 6 ай бұрын
Thanks a lot!
@farzadmf
@farzadmf Жыл бұрын
SUPER high quality video as always; great job!
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot 🙏
@DhavalAhir10
@DhavalAhir10 Жыл бұрын
Amazing every concept clear. Love from India bro. ✌️
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot bro! Glad it was clear and greetings from Scotland!
@repotranstech
@repotranstech Жыл бұрын
Thanks 👍 for this tutorial.I have a microfinance project that will require this.
@bugbytes3923
@bugbytes3923 Жыл бұрын
Hope the video will help! 👍
@ShivaR-k9b
@ShivaR-k9b Жыл бұрын
awesome content Mate!! I learned many new concepts in this video and will try to apply in my projects too 😁
@bugbytes3923
@bugbytes3923 Жыл бұрын
Awesome, thanks a lot, glad you liked the video!
@priyanshvatsal9791
@priyanshvatsal9791 8 ай бұрын
So much useful information in just one video. Thanks
@bugbytes3923
@bugbytes3923 8 ай бұрын
Glad to hear it, thanks a lot for watching and commenting!
@ChandlerWright-m8x
@ChandlerWright-m8x Жыл бұрын
Nice plants as well as the video
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot! 🪴😄
@paulwanjohi2537
@paulwanjohi2537 9 ай бұрын
Incredible. That was so helpful. Thank you man👊
@bugbytes3923
@bugbytes3923 9 ай бұрын
Thanks a lot man! Glad it helped.
@ndifrekeumoren3548
@ndifrekeumoren3548 25 күн бұрын
Thanks 👍
@bugbytes3923
@bugbytes3923 25 күн бұрын
@@ndifrekeumoren3548 thanks for watching!
@vaibhavbijapur6037
@vaibhavbijapur6037 Жыл бұрын
bro you deserve more followers
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks man!
@thokozanindlovu1939
@thokozanindlovu1939 Жыл бұрын
Another brilliant video. thank you
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot!
@UzairAhmad.
@UzairAhmad. 6 сағат бұрын
good work.
@bugbytes3923
@bugbytes3923 4 сағат бұрын
@@UzairAhmad. thank you!
@DavidLuiz-y2h
@DavidLuiz-y2h Жыл бұрын
Thanks for great videos
@bugbytes3923
@bugbytes3923 Жыл бұрын
You’re welcome, thanks a lot for watching!
@Septumsempra8818
@Septumsempra8818 Жыл бұрын
Great tutorial. Any caching vids coming?
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks! Yes, I'll be doing stuff with Django + Redis in the near future.
@anatoliyloboda4601
@anatoliyloboda4601 11 ай бұрын
It's a very interesting and important part of working with DB. Thank you for sharing!!!
@Niki-ue6fk
@Niki-ue6fk 10 ай бұрын
Thanks !!
@bugbytes3923
@bugbytes3923 10 ай бұрын
Thanks for watching!
@frameff9073
@frameff9073 Жыл бұрын
thank
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks for watching!
@azhariqbal3658
@azhariqbal3658 10 ай бұрын
Is there any package you use for runscript this is very useful for testing queries
@bugbytes3923
@bugbytes3923 10 ай бұрын
It’s part of django-extensions which I always add to django projects
@abbasebadian6851
@abbasebadian6851 Ай бұрын
In the Concat topic, what if a field's value were empty? Is there a way to pass a fallback value for it ?
@bugbytes3923
@bugbytes3923 Ай бұрын
@@abbasebadian6851 you can use COALESCE for that - there’s a video in the series on this function
@firstandlast4435
@firstandlast4435 8 ай бұрын
A little recap: Annotate by itself (without values()) doesn't do grouping even with use of aggregate functions (which just duplicate argumented field in such case); We use annotate() with values() and we don't use it with only() (at least my tests proved last as useless); We can start from both child and parent Model and get the same result So this: Books.objects.values_list("author__firstname", "author__lastname").annotate( total=Count("id") ) And that: q = Author.objects.values_list("firstname", "lastname").annotate( total=Count("books") ) will do the same (p.s. "books" in the last statement refers to "related_query_name" specified in ForeignKey field of the "Books" model );
@wihlarkop
@wihlarkop Жыл бұрын
can you make tutorial how to use async queryset on django 4?
@bugbytes3923
@bugbytes3923 Жыл бұрын
Yes, definitely!
@sha999-u4s
@sha999-u4s Жыл бұрын
hi, do you have solution for Like: Multiple table field Sum calculation from parent model ---------- to get stock qty each product (stock qty= purchase_qty - purchase_return_qty - sales_qty + sales_qty )
@techwithabid
@techwithabid 5 ай бұрын
Do a video on channel and web socket
@bugbytes3923
@bugbytes3923 5 ай бұрын
In the future for sure!
@Yarkanlaki
@Yarkanlaki 9 ай бұрын
I wonder why aggregation results always is too big.? Comapre to use for loop
@firstandlast4435
@firstandlast4435 8 ай бұрын
What I dislike about youtube is that there's a need in comments in order to promote a channel, it might be ok in some cases but when it's about education I actually wanna see some related to subject discussions on top instead of "thanks author you are so great"... Anyway what I failed to understand is when annotate is used to add extra field to query set and when to group by fields and the similar about values. As it does return dictionaries like? Then why can we do things like ModelName.objects.values('smth').annotate(Agregate func) and then use functions like order by to it. Don't we need Django specific query sets to use those functions, or we can use it to any dictionary?
@bugbytes3923
@bugbytes3923 8 ай бұрын
The annotate() function will add the annotated field to each object in the queryset. Importantly, annotate returns a queryset, so you can chain other methods like values() and order_by(), etc. The aggregate() function, on the other hand, returns a dictionary containing all the aggregations passed to the function. Queryset methods don’t work on dictionaries, so chaining additional methods like order_by() won’t work.
@pakeffendi5061
@pakeffendi5061 Жыл бұрын
# fungction to get one cctv location and past it to leaflet map def Cctvlist(request, id): # get cctv category cctvs = get_object_or_404(Daftarcctv, id = id) # show all cctv location in cctv category cctv = cctvs.cctvdetail_set.all() # lopping all cctv location for i in cctv: # get one cctv location from i looping showloc = Cctvlocation.objects.get(pk=i) # i want to get cctv location row to past in json format # and get values lat, long from varible "showloc" # BUT ALWAYS FAIL, PLEASE SHOW ME A SOLUTION cctvsloc = list(Cctvlocation.objects.values('latitude', 'longitude')[:100]) print(cctvsloc) return render(request, 'cctvkorem/daftarcctv.html', {'cctvs':cctvs, 'cctv':cctv, 'showloc':showloc })
Django - F Expressions for database-level operations
20:36
BugBytes
Рет қаралды 6 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
How to Use Root and Global Hooks in PayloadCMS
16:02
NLV Codes
Рет қаралды 184
Django ORM Deep Dive - Introduction to Databases & SQL
29:18
BugBytes
Рет қаралды 28 М.
Caching with Redis and Django!
20:05
BugBytes
Рет қаралды 2,1 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН