Tutorial
SQLAlchemy: Taming ORM with Python
Jonathan Ellis, Berkeley Data Systems
Track: Python
Date: Tuesday, July 24
Time: 1:30pm
- 5:00pm
Location: D135
The SQLAlchemy philosophy is "SQL databases behave less and less like object collections the more size and performance start to matter; object collections behave less and less like tables and rows the more abstraction starts to matter." This tutorial will teach how SQLAlchemy allows you to use the full power and expresiveness of both object-oriented Python and your database.
Introduction
- Data Mapper pattern vs. Active Record
- Reusable constructs vs collections of special cases
- Limitations you won't find in SA
Queries
- Joins
- Aliasing
Mapping to Python classes
- one to many, many to many
- back references
- cascade options
- inheritance
Sessions
- session context
- transactions
- detatching, attaching objects
Advanced mapping & optimization
- profiling queries
- lazy / eager loading
- identity map is not a cache
- mapping function calls and subqueries
- playing nice with in-db defaults and triggers
- using ON DELETE CASCADE





















