diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-03-10 03:41:55 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-03-10 03:41:55 +0000 |
| commit | dc2d085a75edf382fadcf40e100542b74a78686a (patch) | |
| tree | f1942be6775ac137b8cda029fe14a2d0dca0c3de /examples/association | |
| parent | b2e04755cc5f382596fb174c7381f60dd2972d94 (diff) | |
| download | sqlalchemy-dc2d085a75edf382fadcf40e100542b74a78686a.tar.gz | |
- Query has add_entity() and add_column() generative methods. these
will add the given mapper/class or ColumnElement to the query at compile
time, and apply them to the instances method. the user is responsible
for constructing reasonable join conditions (otherwise you can get
full cartesian products). result set is the list of tuples, non-uniqued.
- fixed multi-mapper instances() to pad out shorter results with None so
zip() gets everything
Diffstat (limited to 'examples/association')
| -rw-r--r-- | examples/association/proxied_association.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/association/proxied_association.py b/examples/association/proxied_association.py index e6180ad8a..31a64ce7a 100644 --- a/examples/association/proxied_association.py +++ b/examples/association/proxied_association.py @@ -97,11 +97,11 @@ print [(item.item.description, item.price) for item in order.itemassociations] print [(item.description, item.price) for item in order.items] # print customers who bought 'MySQL Crowbar' on sale -result = SelectResults(session.query(Order)).join_to('item').select(and_(items.c.description=='MySQL Crowbar', items.c.price>orderitems.c.price)) +result = session.query(Order).join('item').filter(and_(items.c.description=='MySQL Crowbar', items.c.price>orderitems.c.price)) print [order.customer_name for order in result] # print customers who got the special T-shirt discount -result = SelectResults(session.query(Order)).join_to('item').select(and_(items.c.description=='SA T-Shirt', items.c.price>orderitems.c.price)) +result = session.query(Order).join('item').filter(and_(items.c.description=='SA T-Shirt', items.c.price>orderitems.c.price)) print [order.customer_name for order in result] |
