I had been using an order_by with the AssociationProxy since 0.3.4.
In 0.3.6, this has been broken or else no longer supported.  Since
this is an extension, it has no unit tests (is this the norm?)

The resulting SQL fails with "no such column: items.description"

Below is a patched examples/association/proxied_association.py that
works in 0.3.5, and fails in 0.3.6 through HEAD:

Index: proxied_association.py
===================================================================
--- proxied_association.py      (revision 2527)
+++ proxied_association.py      (working copy)
@@ -48,7 +48,8 @@
         self.price = price or item.price

 mapper(Order, orders, properties={
-    'itemassociations':relation(OrderItem, cascade="all,
delete-orphan", lazy=False)
+    'itemassociations':relation(OrderItem, cascade="all,
delete-orphan", lazy=False,
+    order_by=items.c.description)
 })
 mapper(Item, items)
 mapper(OrderItem, orderitems, properties={
@@ -97,11 +98,11 @@
 print [(item.description, item.price) for item in order.items]

 # print customers who bought 'MySQL Crowbar' on sale
-result = 
session.query(Order).join('item').filter(and_(items.c.description=='MySQL
Crowbar', items.c.price>orderitems.c.price))
+result = 
SelectResults(session.query(Order)).join_to('item').select(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 = session.query(Order).join('item').filter(and_(items.c.description=='SA
T-Shirt', items.c.price>orderitems.c.price))
+result = 
SelectResults(session.query(Order)).join_to('item').select(and_(items.c.description=='SA
T-Shirt', items.c.price>orderitems.c.price))
 print [order.customer_name for order in result]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to