Last active
August 29, 2015 14:16
-
-
Save silenius/300729e312dad6b9b847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool_account_result_mapper = orm.mapper( | |
PoolAccountResult, | |
table['pool_invite_result'], | |
properties = { | |
'result' : orm.relationship(Result, | |
backref='pool_account_result_assoc'), | |
'pool' : orm.relationship( | |
Pool, | |
primaryjoin=sql.and_( | |
table['pool_invite_result'].c.pool_invite_pool_id == | |
table['pool_invite'].c.pool_id, | |
table['pool_invite'].c.pool_id == table['pool'].c.id | |
), | |
uselist = False, | |
innerjoin = True | |
), | |
'invited_user' : orm.relationship( | |
Human, | |
primaryjoin=sql.and_( | |
table['pool_invite_result'].c.pool_invite_account_id == | |
table['pool_invite'].c.account_id, | |
table['pool_invite'].c.account_id == table['account'].c.id | |
), | |
uselist = False, | |
innerjoin = True | |
) | |
}) | |
# Fail with: | |
# sqlalchemy.exc.ArgumentError: Could not locate any simple equality expressions involving locally mapped foreign key columns for primary join condition 'pool_invite_result.pool_invite_pool_id = pool_invite.pool_id AND pool_invite.pool_id = pool.id' on relationship PoolAccountResult.pool. Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or are annotated in the join condition with the foreign() annotation. To allow comparison operators other than '==', the relationship can be marked as viewonly=True. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment