summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-01-14 02:45:30 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-01-14 02:45:30 +0000
commit9e1a35ef3daaee6590830ae5f2c0c9045d682b9d (patch)
treedcb7064c5b4559b05254de602608cbf7e7e370db /lib/sqlalchemy/sql/util.py
parent188c2ac8e500054f1bfe54f91b0914f14854d311 (diff)
downloadsqlalchemy-9e1a35ef3daaee6590830ae5f2c0c9045d682b9d.tar.gz
- 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"
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r--lib/sqlalchemy/sql/util.py19
1 files changed, 19 insertions, 0 deletions
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):