mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-04 23:06:24 -04:00
- 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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user