class documentation

class ColumnAdapter(ClauseAdapter):

Known subclasses: sqlalchemy.orm.util.ORMAdapter

View In Hierarchy

Extends ClauseAdapter with extra utility functions.

Key aspects of ColumnAdapter include:

  • Expressions that are adapted are stored in a persistent .columns collection; so that an expression E adapted into an expression E1, will return the same object E1 when adapted a second time. This is important in particular for things like Label objects that are anonymized, so that the ColumnAdapter can be used to present a consistent "adapted" view of things.
  • Exclusion of items from the persistent collection based on include/exclude rules, but also independent of hash identity. This because "annotated" items all have the same hash identity as their parent.
  • "wrapping" capability is added, so that the replacement of an expression E can proceed through a series of adapters. This differs from the visitor's "chaining" feature in that the resulting object is passed through all replacing functions unconditionally, rather than stopping at the first one that returns non-None.
  • An adapt_required option, used by eager loading to indicate that We don't trust a result row column that is not translated. This is to prevent a column from being interpreted as that of the child row in a self-referential scenario, see inheritance/test_basic.py->EagerTargetingTest.test_adapt_stringency
Class _​Include​Exclude​Mapping Undocumented
Method __getstate__ Undocumented
Method __init__ Undocumented
Method __setstate__ Undocumented
Method ​_locate​_col Undocumented
Method adapt​_check​_present Undocumented
Method traverse Traverse and visit the given expression structure.
Method wrap Undocumented
Instance Variable ​_wrap Undocumented
Instance Variable adapt​_required Undocumented
Instance Variable allow​_label​_resolve Undocumented
Instance Variable columns Undocumented

Inherited from ClauseAdapter:

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 CloningExternalTraversal (via ClauseAdapter, ReplacingExternalTraversal):

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

Inherited from ExternalTraversal (via ClauseAdapter, 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 __getstate__(self):

Undocumented

def __init__(self, selectable, equivalents=None, adapt_required=False, include_fn=None, exclude_fn=None, adapt_on_names=False, allow_label_resolve=True, anonymize_labels=False, adapt_from_selectables=None):
def __setstate__(self, state):

Undocumented

def _locate_col(self, col):

Undocumented

def adapt_check_present(self, col):

Undocumented

def traverse(self, obj):
Traverse and visit the given expression structure.
def wrap(self, adapter):

Undocumented

_wrap =

Undocumented

adapt_required =

Undocumented

allow_label_resolve =

Undocumented

columns =

Undocumented