class documentation

class ClauseAdapter(visitors.ReplacingExternalTraversal):

Known subclasses: sqlalchemy.sql.util.ColumnAdapter

View In Hierarchy

Clones and modifies clauses based on column correspondence.

E.g.:

table1 = Table('sometable', metadata,
    Column('col1', Integer),
    Column('col2', Integer)
    )
table2 = Table('someothertable', metadata,
    Column('col1', Integer),
    Column('col2', Integer)
    )

condition = table1.c.col1 == table2.c.col1

make an alias of table1:

s = table1.alias('foo')

calling ClauseAdapter(s).traverse(condition) converts condition to read:

s.c.col1 == table2.c.col1
Method __init__ Undocumented
Method ​_corresponding​_column Undocumented
Method replace Receive pre-copied elements during a cloning traversal.
Instance Variable __traverse​_options__ Undocumented
Instance Variable adapt​_from​_selectables Undocumented
Instance Variable adapt​_on​_names Undocumented
Instance Variable equivalents Undocumented
Instance Variable exclude​_fn Undocumented
Instance Variable include​_fn Undocumented
Instance Variable selectable Undocumented

Inherited from ReplacingExternalTraversal:

Method traverse Traverse and visit the given expression structure.

Inherited from CloningExternalTraversal (via ReplacingExternalTraversal):

Method copy​_and​_process Apply cloned traversal to the given list of elements, and return the new list.

Inherited from ExternalTraversal (via ReplacingExternalTraversal, CloningExternalTraversal):

Method chain 'Chain' an additional ClauseVisitor onto this ClauseVisitor.
Method iterate Traverse the given expression structure, returning an iterator of all elements.
Method traverse​_single Undocumented
Property ​_visitor​_dict Undocumented
Property visitor​_iterator Iterate through this visitor and each 'chained' visitor.
def __init__(self, selectable, equivalents=None, include_fn=None, exclude_fn=None, adapt_on_names=False, anonymize_labels=False, adapt_from_selectables=None):

Undocumented

def _corresponding_column(self, col, require_embedded, _seen=util.EMPTY_SET):

Undocumented

@util.preload_module('sqlalchemy.sql.functions')
def replace(self, col, _include_singleton_constants=False):

Receive pre-copied elements during a cloning traversal.

If the method returns a new element, the element is used instead of creating a simple copy of the element. Traversal will halt on the newly returned element if it is re-encountered.

__traverse_options__ =
adapt_from_selectables =

Undocumented

adapt_on_names =

Undocumented

equivalents =

Undocumented

exclude_fn =

Undocumented

include_fn =

Undocumented

selectable =

Undocumented