SQLAlchemy - The Architecture of Open Source Applicaitons
Table of Contents
- The Core/ORM Dichotomy
- Taming the DBAPI
- Schema Definition
- SQL Expressions
- Class Mapping with the ORM
- Query and Loading Behavior
- Session/Identity Map
- Link
The Core/ORM Dichotomy
Taming the DBAPI
Schema Definition
SQL Expressions
from sqlalchemy.sql import table, column, select
user = table('user', column('id'), column('name'))
stmt = select([user.c.id]).where(user.c.name=='ed')
Class Mapping with the ORM
user_table = Table("user", metadata,
Column('id', Integer, primary_key=True),
)
class User(object):
pass
mapper(User, user_table, properties={
'related':relationship(Address)
})