Hacker News new | comments | show | ask | jobs | submit login

The first feature in the deck is FILTER, which I can't help but mention I added support for (with a case/when fallback) to Django 2.0. So, if you're using the new Django release you can use this syntax on any aggregate/annotate via the filter kwarg[1] now.

There was one user report on the github PR that said FILTER was 10-15% faster over the equivalent CASE/WHEN, due to the null filtering I think. It's a shame only Postgres supports this supposedly standard syntax.

Edit: Heh, I initially got (stole) the idea of using FILTER + CASE from modern-sql.com[2], which is run by the author of this slide deck. So I guess I aught to thank Markus for this!

1. https://docs.djangoproject.com/en/2.0/ref/models/conditional...

2. http://modern-sql.com/feature/filter




That's really clever - I just blogged about it https://simonwillison.net/2018/Feb/3/conditional-aggregation...


Thank you Simon!


Welcome :)




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: