Problem querying with mutiple joins to the same table
Issue #554
resolved
Our application has a state transition table, where legal transitions are represented by rows containing 'source' and 'destination' fields, each of which are foreign keys to the same table.
With this model, the same two very similar lines of code do not behave the same - querying by ID returns the expected result but querying by object returns None.
Both these calls should give the same result, right?
print 'query by ID: %s' % ValidStateTransition.get_by(src_id=state1.id, dst_id=state2.id)
print 'query by object: %s' % ValidStateTransition.get_by(src=state1, dst=state2)
I will attach a full test case.
Comments (2)
-
Account Deleted -
repo owner - changed status to resolved
whereas the results of the
join_by
condition previously returned((order_state.id = ?) AND order_state.id = valid_state_transition.src_id) AND ((order_state.id = ?) AND order_state.id = valid_state_transition.dst_id)
it now leverages the same mechanism as the new
with_parent()
call to produce(? = valid_state_transition.src_id) AND (? = valid_state_transition.dst_id)
- Log in to comment
If you need it, my email address is barry@exchangeframe.com. Thanks!