summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-03-17 16:25:51 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-03-17 16:25:51 -0400
commit9ec01ab35a6c0cfdae6ce8a5f84d5ccaf90a3c44 (patch)
tree988f3a1097c4ae31944a6d41811b2be5c83fab61 /lib/sqlalchemy/orm/query.py
parente2214a61e84c5c6d3f5fe6963d9827465474bd67 (diff)
downloadsqlalchemy-9ec01ab35a6c0cfdae6ce8a5f84d5ccaf90a3c44.tar.gz
- Improved an error message which would occur if a query() were made
against a non-selectable, such as a :func:`.literal_column`, and then an attempt was made to use :meth:`.Query.join` such that the "left" side would be determined as ``None`` and then fail. This condition is now detected explicitly.
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r--lib/sqlalchemy/orm/query.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 81be0e63c..0f5b8bf88 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -1843,6 +1843,12 @@ class Query(object):
elif self._entities:
left = self._entities[0].entity_zero_or_selectable
+ if left is None:
+ raise sa_exc.InvalidRequestError(
+ "Don't know how to join from %s; please use "
+ "select_from() to establish the left "
+ "entity/selectable of this join" % self._entities[0])
+
if left is right and \
not create_aliases:
raise sa_exc.InvalidRequestError(