~/talk

Querying the queries: SQL Metaprogramming in Python

Talkat PyData London 2026 · on Sunday, 2026-06-07· at 11:00· Doddington Forum· [databases, developer-experience]
links:none on file
slides:none on file

Python parses SQL into ASTs represented as nested dictionaries (using libraries like sqloxide) so queries become editable data rather than fragile text. Concrete results: DFS computes subquery depth for CI linting, an AST rewrite wrap denominators in NULLIF() to eliminate divide‑by‑zero errors, auto‑aliasing transforms unnamed aggregates into predictable names, and dependency graphs reveal orphan table E for automated removal. Workflows run deterministically at scale and avoid regex fragility and LLM hallucination.

AI-written summary · about

  1. 0:00SQL metaprogramming intro
  2. 2:09SQL code quality at scale
  3. 11:18Regex fails for SQL analysis
  4. 13:03Parsers and ASTs for SQL
  5. 18:08Dependency graphs with ASTs
  6. 19:32Nested subquery depth detection
  7. 21:37Auto-aliasing aggregates
  8. 26:36NULLIF for denominators
  9. 30:49Unused CTEs in queries
  10. 32:53FAQ and LLMs
~/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.