[EDIT: Duh, forgot the attachment. Here it is.]

Hello,

I ran into a problem with relationships and polymorphism. I've attached a
test case which runs on its own and shows my models.

The version as given results in an exception for me:

"ArgumentError: Could not determine join condition between parent/child
tables on relationship UserAddresses.user.  Specify a 'primaryjoin'
expression.  If 'secondary' is present, 'secondaryjoin' is needed as well."

So I go ahead and add the primaryjoins:

primaryjoin = (User.id == user_id)
primaryjoin = (Address.id == address_id)

With the primaryjoin in place the code works in 0.7b4, but it throws
another exception in 0.6.6:

"ArgumentError: Could not determine relationship direction for primaryjoin
condition 'content.id = useraddresses.user_id', on relationship
UserAddresses.user. Ensure that the referencing Column objects have a
ForeignKey present, or are otherwise part of a ForeignKeyConstraint on
their parent Table, or specify the foreign_keys parameter to this
relationship."

Now my main question is: "Why do I need to add the primaryjoins at all?
Shouldn't SQLAlchemy be able to generate it from the information given?".
My other question is: "Is there any specific reason why its working in
0.7b4 and not in 0.6.6?".

It seems like I am missing something here.

-Matthias

--
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Attachment: sqlatest.py
Description: Binary data

Reply via email to