I'm looking for a way to set up a mapper like in this sqlalchemy
example:

class User(object):
    pass
class Address(object):
    pass

mapper(Address, addresses_table)
mapper(User, users_table, properties={
    'boston_addresses': relation(Address, primaryjoin=
                and_(users_table.c.user_id==addresses_table.c.user_id,
                addresses_table.c.city=='Boston'))
})



The difference is that I don't have the part:
users_table.c.user_id==addresses_table.c.user_id,

This yields the following mapper configuration:

mapper(User, users_table, properties={
    'boston_addresses': relation(Address, primaryjoin=
                addresses_table.c.city=='Boston')
})


That is, I want a collection boston_addresses on the Users object that
is calculated through a cross join with the condition city='boston'.
But mapping results in the error "Could not determine relationship
direction for primaryjoin condition ... Ensure that the referencing
Column objects have a ForeignKey present ...


But there are deliberately no foreign keys. What else can I do to get
this work?

Best regards,
prinz

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to