~/talk

Django - Customise your SQL

Talkat PyCon AU 2016 · 2016-08-12..08-16· DjangoCon AU (miniconf)· [databases, django]
slides:none on file

Django 1.7 adds lookups so custom operators (e.g. a true not-equals) compile into SQL; a hand-written lookup above saves about 30 microseconds versus Django’s negation form. Django 1.8 adds expressions to combine fields/aggregates; 1.10 adds date truncation so date_trunc quarter works for Postgres and produces the example report count of 506. For pivoting use Case/conditional SUMs; for quarter‑over‑quarter growth use Postgres window functions like LAG, executed via raw cursor SQL when the ORM can’t express the window.

AI-written summary · about

  1. 0:00Introduction
  2. 1:28Recent changes
  3. 3:59Sales reporting
  4. 5:20Exclude
  5. 7:28Quarterly
  6. 11:43Quarterly aggregation
  7. 13:36Conditional expression
  8. 14:35Sum if
  9. 15:28Final query
  10. 16:27Growth report
  11. 18:50Querying directly
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.