~/talk

Let's talk Databases in Python: SQLAlchemy and Alembic

Talkat PyCon US 2020 · 2020-04-15..04-23· [databases]
slides:none on file

Shows concrete use of SQLAlchemy and Alembic to model tables, run multi-step migrations, and deploy schema and data changes (adds an organization table, adds organization_id to groups, then assigns a default org to existing rows). Demonstrates connection pools with pool_size/overflow and a 60s TCP keepalive, an indexed shadow‑ban field and a partial index, exposes an N+1 query cost (1 + number_of_members) and the join_load fix, and warns against importing evolving models into migrations.

AI-written summary · about

  1. 0:00Intro
  2. 1:20What's an ORM?
  3. 1:48Available Python ORMS
  4. 2:43User Model
  5. 4:12Common Base
  6. 4:52Validation
  7. 6:17Relationships
  8. 7:11Unique Constraints
  9. 7:45Multi Column Indexes
  10. 8:42Partial Indexing
  11. 10:14Functional/Expression Indexing
  12. 12:02Connecting to the DB
  13. 12:41Inserting Data
  14. 13:06Using a Session Context Manager
  15. 13:56Session Scoping
  16. 14:26Establishing a DB Connection
  17. 15:04Connection Pools
  18. 20:15Creating the DB
  19. 20:53Database Migrations
  20. 22:35Database Migration Libraries
  21. 22:57Configuration
  22. 23:20Creating a Migration
  23. 26:13Run the migration
  24. 26:29Downgrade the migration
  25. 26:39Modify an Existing Table
  26. 27:23Modify Data
  27. 30:00Problems in the Wild: Lazy Loading
  28. 30:12Lazy Loading: What is it?
  29. 30:56Lazy Loading: Why is it a problem?
  30. 31:37Lazy Loading: Use Eager Load Instead!
  31. 32:04Problems in the Wild: Unexpected Query Generation
  32. 33:01Review
  33. 33:19Questions
~/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.