The following change to the proxied_association.py example works in 0.3.11 but fails in 0.4.4. I'm trying to query the assocations and then use those items to identify what is making the association. Here is the exception trace:
Traceback (most recent call last): File "proxied_association.py", line 110, in <module> i = session.query(OrderItem).filter_by(customer_name='john smith') File "/home/sim/en36219/.python/sqlalchemy/orm/query.py", line 461, in filter_by for key, value in kwargs.iteritems()] File "/home/sim/en36219/.python/sqlalchemy/orm/mapper.py", line 190, in get_property return self._get_property(key, resolve_synonyms=resolve_synonyms, raiseerr=raiseerr) File "/home/sim/en36219/.python/sqlalchemy/orm/mapper.py", line 200, in _get_property raise exceptions.InvalidRequestError("Mapper '%s' has no property '%s'" % (str(self), key)) sqlalchemy.exceptions.InvalidRequestError: Mapper 'Mapper|OrderItem| orderitems' has no property 'customer_name' Index: examples/association/proxied_association.py =================================================================== --- examples/association/proxied_association.py (revision 4351) +++ examples/association/proxied_association.py (working copy) @@ -53,7 +53,8 @@ }) mapper(Item, items) mapper(OrderItem, orderitems, properties={ - 'item':relation(Item, lazy=False) + 'item':relation(Item, lazy=False), + 'order':relation(Order, lazy=False) }) session = create_session() @@ -98,13 +99,16 @@ print [(item.description, item.price) for item in order.items] # print customers who bought 'MySQL Crowbar' on sale -result = session.query(Order).join(['itemassociations', 'item']).filter(and_(Item.description=='MySQL Crowbar', Item.price>OrderItem.price)) -print [order.customer_name for order in result] +#result = session.query(Order).join(['itemassociations', 'item']).filter(and_(Item.description=='MySQL Crowbar', Item.price>OrderItem.price)) +#print [order.customer_name for order in result] # print customers who got the special T-shirt discount -result = session.query(Order).join(['itemassociations', 'item']).filter(and_(Item.description=='SA T-Shirt', Item.price>OrderItem.price)) -print [order.customer_name for order in result] +#result = session.query(Order).join(['itemassociations', 'item']).filter(and_(Item.description=='SA T-Shirt', Item.price>OrderItem.price)) +#print [order.customer_name for order in result] +# Get items of the 'john smith' order +i = session.query(OrderItem).filter_by(customer_name='john smith') +print [(item.item.description, item.price) for item in i] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---