class documentation

An SQL WHERE clause. The class is tied to the Query class that created it (in order to create the correct SQL). A child is usually an expression producing boolean values. Most likely the expression is a Lookup instance. However, a child could also be any class with as_sql() and either relabeled_clone() method or relabel_aliases() and clone() methods and contains_aggregate attribute.

Method as_sql Return the SQL version of the where clause and the value to be substituted in. Return '', [] if this node matches everything, None, [] if this node is empty, and raise EmptyResultSet if this node can't match anything.
Method clone Create a clone of the tree. Must only be called on root nodes (nodes with empty subtree_parents). Childs must be either (Constraint, lookup, value) tuples, or objects supporting .clone().
Method copy Undocumented
Method get_db_converters Undocumented
Method get_group_by_cols Undocumented
Method get_lookup Undocumented
Method get_source_expressions Undocumented
Method relabel_aliases Relabel the alias values of any children. 'change_map' is a dictionary mapping old (current) alias values to the new values.
Method relabeled_clone Undocumented
Method resolve_expression Undocumented
Method select_format Undocumented
Method set_source_expressions Undocumented
Method split_having Return two possibly None nodes: one for those parts of self that should be included in the WHERE clause and one for those parts of self that must be included in the HAVING clause.
Class Variable conditional Undocumented
Class Variable resolved Undocumented
Instance Variable children Undocumented
Property contains_aggregate Undocumented
Property contains_over_clause Undocumented
Property output_field Undocumented
Class Method _contains_aggregate Undocumented
Class Method _contains_over_clause Undocumented
Class Method _resolve_node Undocumented
Static Method _resolve_leaf Undocumented

Inherited from Node:

Method __bool__ Return whether or not this node has children.
Method __contains__ Return True if 'other' is a direct child of this instance.
Method __deepcopy__ Undocumented
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Construct a new Node. If no connector is given, use the default.
Method __len__ Return the number of children this node has.
Method __repr__ Undocumented
Method __str__ Undocumented
Method add Combine this tree and the data represented by data using the connector conn_type. The combine is done by squashing the node other away if possible.
Method negate Negate the sense of the root connector.
Class Variable default Undocumented
Instance Variable connector Undocumented
Instance Variable negated Undocumented
Class Method _new_instance Create a new instance of this class when new Nodes (or subclasses) are needed in the internal code in this class. Normally, it just shadows __init__(). However, subclasses with an __init__ signature that aren't an extension of Node...
def as_sql(self, compiler, connection): (source)

Return the SQL version of the where clause and the value to be substituted in. Return '', [] if this node matches everything, None, [] if this node is empty, and raise EmptyResultSet if this node can't match anything.

def clone(self): (source)

Create a clone of the tree. Must only be called on root nodes (nodes with empty subtree_parents). Childs must be either (Constraint, lookup, value) tuples, or objects supporting .clone().

def copy(self): (source)

Undocumented

def get_db_converters(self, connection): (source)

Undocumented

def get_group_by_cols(self, alias=None): (source)

Undocumented

def get_lookup(self, lookup): (source)

Undocumented

def get_source_expressions(self): (source)

Undocumented

def relabel_aliases(self, change_map): (source)

Relabel the alias values of any children. 'change_map' is a dictionary mapping old (current) alias values to the new values.

def relabeled_clone(self, change_map): (source)

Undocumented

def resolve_expression(self, *args, **kwargs): (source)

Undocumented

def select_format(self, compiler, sql, params): (source)

Undocumented

def set_source_expressions(self, children): (source)

Undocumented

def split_having(self, negated=False): (source)

Return two possibly None nodes: one for those parts of self that should be included in the WHERE clause and one for those parts of self that must be included in the HAVING clause.

conditional: bool = (source)

Undocumented

resolved: bool = (source)

Undocumented

children = (source)

Undocumented

@cached_property
contains_aggregate = (source)

Undocumented

@cached_property
contains_over_clause = (source)

Undocumented

Undocumented

@classmethod
def _contains_aggregate(cls, obj): (source)

Undocumented

@classmethod
def _contains_over_clause(cls, obj): (source)

Undocumented

@classmethod
def _resolve_node(cls, node, query, *args, **kwargs): (source)

Undocumented

@staticmethod
def _resolve_leaf(expr, query, *args, **kwargs): (source)

Undocumented