- Fixed the error message for "could not find a FROM clause"

in query.join() which would fail to issue correctly
if the query was against a pure SQL construct.
[ticket:1522]
This commit is contained in:
Mike Bayer
2009-09-01 22:14:22 +00:00
parent fed57bc9dd
commit aa73243fde
3 changed files with 12 additions and 1 deletions
+5
View File
@@ -437,6 +437,11 @@ CHANGES
- Fixed incorrect exception raise in
Weak/StrongIdentityMap.add()
[ticket:1506]
- Fixed the error message for "could not find a FROM clause"
in query.join() which would fail to issue correctly
if the query was against a pure SQL construct.
[ticket:1522]
- Fixed a somewhat hypothetical issue which would result
in the wrong primary key being calculated for a mapper
+1 -1
View File
@@ -1036,7 +1036,7 @@ class Query(object):
if not clause:
clause = left_selectable
if not clause:
if not clause and left_entity:
for ent in self._entities:
if ent.corresponds_to(left_entity):
clause = ent.selectable
+6
View File
@@ -1214,6 +1214,12 @@ class JoinTest(QueryTest):
result = sess.query(ualias).join((oalias1, ualias.orders), (oalias2, ualias.orders)).\
filter(or_(oalias1.user_id==9, oalias2.user_id==7)).all()
eq_(result, [User(id=7,name=u'jack'), User(id=9,name=u'fred')])
def test_pure_expression_error(self):
sess = create_session()
assert_raises_message(sa.exc.InvalidRequestError, "Could not find a FROM clause to join from", sess.query(users).join, addresses)
def test_orderby_arg_bug(self):
sess = create_session()