summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-10-15 19:08:35 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-10-15 19:08:35 +0000
commitcf6c66e70ea406a27c4a8d5b79f9c629a62320fc (patch)
tree3db2c7aeaf4947bfd540396a8e92264a835f72e5 /lib
parentc5571ab19a155f0c11381d65edc07c16902f3fad (diff)
downloadsqlalchemy-cf6c66e70ea406a27c4a8d5b79f9c629a62320fc.tar.gz
- mapping to a select() construct now requires that you
make an alias() out of it distinctly. This to eliminate confusion over such issues as [ticket:1542]
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/mapper.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 13151f232..a9dad9176 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -163,11 +163,10 @@ class Mapper(object):
self.with_polymorphic = None
if isinstance(self.local_table, expression._SelectBaseMixin):
- util.warn("mapper %s creating an alias for the given "
- "selectable. References to the original selectable "
- "may be misinterpreted by queries, polymorphic_on, etc. "
- " Consider passing an explicit selectable.alias() construct instead." % self)
- self.local_table = self.local_table.alias()
+ raise sa_exc.InvalidRequestError(
+ "When mapping against a select() construct, map against an alias() of the construct instead."
+ "This because several databases don't allow a SELECT from a subquery that does not have an alias."
+ )
if self.with_polymorphic and isinstance(self.with_polymorphic[1], expression._SelectBaseMixin):
self.with_polymorphic = (self.with_polymorphic[0], self.with_polymorphic[1].alias())