BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//pretalx//pretalx.com//pydata-london-2026//speaker//ZZA7AP
BEGIN:VTIMEZONE
TZID:GMT
BEGIN:STANDARD
DTSTART:20001029T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:GMT
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20000326T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
TZNAME:BST
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:pretalx-pydata-london-2026-KQDKTE@pretalx.com
DTSTART;TZID=GMT:20260607T110000
DTEND;TZID=GMT:20260607T114500
DESCRIPTION:Large SQL codebases inevitably accumulate duplication\, inconsi
 stency\, deep nesting\, and subtle logic errors\, making refactoring slow\
 , risky\, and often unrealistic to do by hand. This talk shows how Python 
 metaprogramming can turn SQL itself into data that can be analyzed and tra
 nsformed safely and automatically.\n\nInstead of relying on fragile regex 
 patterns or manual inspection\, we use Python to parse queries into Abstra
 ct Syntax Trees (represented as nested dictionaries) using libraries such 
 as sqloxide. Once SQL itself is encoded as data\, entirely new workflows b
 ecome possible.\n\nThe session walks through practical examples of treatin
 g SQL programmatically via tree operations in Python: computing subquery d
 epth for linting\, wrapping all denominators in NULLIF() with a simple AST
  rewrite\, auto‑aliasing aggregate expressions\, and generating dependen
 cy graphs of temporary tables used across pipelines\, among others. Each e
 xample highlights how metaprogramming enables precise\, automatable refact
 ors that would be error‑prone or impossible through text manipulation al
 one. This talk is designed for analytics and data engineers who work with 
 large SQL codebases.
DTSTAMP:20260602T212905Z
LOCATION:Doddington Forum
SUMMARY:Querying the queries: SQL Metaprogramming in Python - Michel Semaan
URL:https://pretalx.com/pydata-london-2026/talk/KQDKTE/
END:VEVENT
END:VCALENDAR
