class documentation

class InternalTraversal(util.with_metaclass(_InternalTraversalType, object)):

Known subclasses: sqlalchemy.sql.traversals._CopyInternals, sqlalchemy.sql.traversals._GetChildren, sqlalchemy.sql.traversals.TraversalComparatorStrategy, sqlalchemy.sql.visitors.ExtendedInternalTraversal

View In Hierarchy

Defines visitor symbols used for internal traversal.

The .InternalTraversal class is used in two ways. One is that it can serve as the superclass for an object that implements the various visit methods of the class. The other is that the symbols themselves of .InternalTraversal are used within the _traverse_internals collection. Such as, the .Case object defines _traverse_internals as

_traverse_internals = [
    ("value", InternalTraversal.dp_clauseelement),
    ("whens", InternalTraversal.dp_clauseelement_tuples),
    ("else_", InternalTraversal.dp_clauseelement),
]

Above, the .Case class indicates its internal state as the attributes named value, whens, and else_. They each link to an .InternalTraversal method which indicates the type of datastructure referred towards.

Using the _traverse_internals structure, objects of type .InternalTraversible will have the following methods automatically implemented:

  • .Traversible.get_children
  • .Traversible._copy_internals
  • .Traversible._gen_cache_key

Subclasses can also implement these methods directly, particularly for the .Traversible._copy_internals method, when special steps are needed.

New in version 1.4.
Method dispatch Given a method from .InternalTraversal, return the corresponding method on a subclass.
Class Variable dp​_annotations​_key Visit the _annotations_cache_key element.
Class Variable dp​_anon​_name Visit a potentially "anonymized" string value.
Class Variable dp​_boolean Visit a boolean value.
Class Variable dp​_clauseelement Visit a _expression.ClauseElement object.
Class Variable dp​_clauseelement​_list Visit a list of _expression.ClauseElement objects.
Class Variable dp​_clauseelement​_tuple Visit a tuple of _expression.ClauseElement objects.
Class Variable dp​_clauseelement​_tuples Visit a list of tuples which contain _expression.ClauseElement objects.
Class Variable dp​_dialect​_options Visit a dialect options structure.
Class Variable dp​_dml​_multi​_values Visit the values() multi-valued list of dictionaries of an _expression.Insert object.
Class Variable dp​_dml​_ordered​_values Visit the values() ordered tuple list of an _expression.Update object.
Class Variable dp​_dml​_values Visit the values() dictionary of a .ValuesBase (e.g. Insert or Update) object.
Class Variable dp​_fromclause​_canonical​_column​_collection Visit a _expression.FromClause object in the context of the columns attribute.
Class Variable dp​_fromclause​_ordered​_set Visit an ordered set of _expression.FromClause objects.
Class Variable dp​_has​_cache​_key Visit a .HasCacheKey object.
Class Variable dp​_has​_cache​_key​_list Visit a list of .HasCacheKey objects.
Class Variable dp​_named​_ddl​_element Visit a simple named DDL element.
Class Variable dp​_operator Visit an operator.
Class Variable dp​_plain​_dict Visit a dictionary with string keys.
Class Variable dp​_plain​_obj Visit a plain python object.
Class Variable dp​_prefix​_sequence Visit the sequence represented by _expression.HasPrefixes or _expression.HasSuffixes.
Class Variable dp​_propagate​_attrs Visit the propagate attrs dict. This hardcodes to the particular elements we care about right now.
Class Variable dp​_statement​_hint​_list Visit the _statement_hints collection of a _expression.Select object.
Class Variable dp​_string Visit a plain string value.
Class Variable dp​_string​_clauseelement​_dict Visit a dictionary of string keys to _expression.ClauseElement objects.
Class Variable dp​_string​_list Visit a list of strings.
Class Variable dp​_string​_multi​_dict Visit a dictionary of string keys to values which may either be plain immutable/hashable or .HasCacheKey objects.
Class Variable dp​_table​_hint​_list Visit the _hints collection of a _expression.Select object.
Class Variable dp​_type Visit a .TypeEngine object
Class Variable dp​_unknown​_structure Visit an unknown structure.
Method generate​_dispatch Undocumented
Method run​_generated​_dispatch Undocumented
Class Variable dp​_executable​_options Undocumented
Class Variable dp​_memoized​_select​_entities Undocumented
Class Variable dp​_setup​_join​_tuple Undocumented
Class Variable dp​_with​_context​_options Undocumented
def dispatch(self, visit_symbol):
Given a method from .InternalTraversal, return the corresponding method on a subclass.
dp_annotations_key =

Visit the _annotations_cache_key element.

This is a dictionary of additional information about a ClauseElement that modifies its role. It should be included when comparing or caching objects, however generating this key is relatively expensive. Visitors should check the "_annotations" dict for non-None first before creating this key.

dp_anon_name =

Visit a potentially "anonymized" string value.

The string value is considered to be significant for cache key generation.

dp_boolean =

Visit a boolean value.

The boolean value is considered to be significant for cache key generation.

dp_clauseelement =
Visit a _expression.ClauseElement object.
dp_clauseelement_list =
Visit a list of _expression.ClauseElement objects.
dp_clauseelement_tuple =
Visit a tuple of _expression.ClauseElement objects.
dp_clauseelement_tuples =
Visit a list of tuples which contain _expression.ClauseElement objects.
dp_dialect_options =
Visit a dialect options structure.
dp_dml_multi_values =
Visit the values() multi-valued list of dictionaries of an _expression.Insert object.
dp_dml_ordered_values =
Visit the values() ordered tuple list of an _expression.Update object.
dp_dml_values =
Visit the values() dictionary of a .ValuesBase (e.g. Insert or Update) object.
dp_fromclause_canonical_column_collection =

Visit a _expression.FromClause object in the context of the columns attribute.

The column collection is "canonical", meaning it is the originally defined location of the .ColumnClause objects. Right now this means that the object being visited is a _expression.TableClause or _schema.Table object only.

dp_fromclause_ordered_set =
Visit an ordered set of _expression.FromClause objects.
dp_has_cache_key =
Visit a .HasCacheKey object.
dp_has_cache_key_list =
Visit a list of .HasCacheKey objects.
dp_named_ddl_element =

Visit a simple named DDL element.

The current object used by this method is the .Sequence.

The object is only considered to be important for cache key generation as far as its name, but not any other aspects of it.

dp_operator =

Visit an operator.

The operator is a function from the sqlalchemy.sql.operators module.

The operator value is considered to be significant for cache key generation.

dp_plain_dict =

Visit a dictionary with string keys.

The keys of the dictionary should be strings, the values should be immutable and hashable. The dictionary is considered to be significant for cache key generation.

dp_plain_obj =

Visit a plain python object.

The value should be immutable and hashable, such as an integer. The value is considered to be significant for cache key generation.

dp_prefix_sequence =
Visit the sequence represented by _expression.HasPrefixes or _expression.HasSuffixes.
dp_propagate_attrs =
Visit the propagate attrs dict. This hardcodes to the particular elements we care about right now.
dp_statement_hint_list =
Visit the _statement_hints collection of a _expression.Select object.
dp_string =

Visit a plain string value.

Examples include table and column names, bound parameter keys, special keywords such as "UNION", "UNION ALL".

The string value is considered to be significant for cache key generation.

dp_string_clauseelement_dict =
Visit a dictionary of string keys to _expression.ClauseElement objects.
dp_string_list =
Visit a list of strings.
dp_string_multi_dict =
Visit a dictionary of string keys to values which may either be plain immutable/hashable or .HasCacheKey objects.
dp_table_hint_list =
Visit the _hints collection of a _expression.Select object.
dp_type =

Visit a .TypeEngine object

The type object is considered to be significant for cache key generation.

dp_unknown_structure =
Visit an unknown structure.
def generate_dispatch(self, target_cls, internal_dispatch, generate_dispatcher_name):

Undocumented

def run_generated_dispatch(self, target, internal_dispatch, generate_dispatcher_name):

Undocumented

dp_executable_options =

Undocumented

dp_memoized_select_entities =

Undocumented

dp_setup_join_tuple =

Undocumented

dp_with_context_options =

Undocumented