From 9e1a35ef3daaee6590830ae5f2c0c9045d682b9d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 14 Jan 2008 02:45:30 +0000 Subject: - applying some refined versions of the ideas in the smarter_polymorphic branch - slowly moving Query towards a central "aliasing" paradigm which merges the aliasing of polymorphic mappers to aliasing against arbitrary select_from(), to the eventual goal of polymorphic mappers which can also eagerload other relations - supports many more join() scenarios involving polymorphic mappers in most configurations - PropertyAliasedClauses doesn't need "path", EagerLoader doesn't need to guess about "towrap" --- lib/sqlalchemy/sql/util.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/sqlalchemy/sql/util.py') diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index b45c0425c..c2ac26557 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -186,6 +186,25 @@ class ClauseAdapter(AbstractClauseProcessor): self.exclude = exclude self.equivalents = equivalents + def copy_and_chain(self, adapter): + """create a copy of this adapter and chain to the given adapter. + + currently this adapter must be unchained to start, raises + an exception if it's already chained. + + Does not modify the given adapter. + """ + + if adapter is None: + return self + + if hasattr(self, '_next_acp') or hasattr(self, '_next'): + raise NotImplementedError("Can't chain_to on an already chained ClauseAdapter (yet)") + + ca = ClauseAdapter(self.selectable, self.include, self.exclude, self.equivalents) + ca._next_acp = adapter + return ca + def convert_element(self, col): if isinstance(col, expression.FromClause): if self.selectable.is_derived_from(col): -- cgit v1.2.1