~/talk

No More Raw SQL with SQLAlchemy and ORMs

Talkat PyData NYC 2024 · 2024-11-06..11-08· [databases, developer-experience]
links:none on file
slides:none on file

Claim: stop writing raw SQL and let SQLAlchemy replace it with programmatic queries that are shorter, safer, and easier to maintain. Uses engine and session (core vs ORM), prepared statements to prevent injection, explicit commit vs begin ones, and relationship loading strategies. Builds a small Marketplace microservice with five tables and converts raw inserts/selects into ORM objects; an N+1 example with three customers emits four queries but eager loading collapses that to one. Also shows hybrid properties for SQL expressions and clearer aggregation.

AI-written summary · about

  1. 0:00SQLAlchemy and ORMs intro
  2. 2:55What is SQLAlchemy
  3. 8:19Marketplace app overview
  4. 9:22Raw SQL without ORM
  5. 11:52Database engine setup
  6. 13:39SQLAlchemy core queries
  7. 17:21SQLAlchemy ORM intro
  8. 24:00ORM querying data
  9. 26:51ORM inserting data
  10. 28:40Optimizing ORM queries
  11. 31:53SQL functions in ORM
  12. 32:36Hybrid properties for calc
  13. 35:27SQLAlchemy benefits
~/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.