class documentation

class WhereNode(tree.Node):

View In Hierarchy

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.

Class Method ​_contains​_aggregate Undocumented
Class Method ​_contains​_over​_clause Undocumented
Class Method ​_resolve​_node Undocumented
Static Method ​_resolve​_leaf Undocumented
Method as​_sql No summary
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

Inherited from Node:

Class Method ​_new​_instance No summary
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
@classmethod
def _contains_aggregate(cls, obj):

Undocumented

@classmethod
def _contains_over_clause(cls, obj):

Undocumented

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

Undocumented

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

Undocumented

def as_sql(self, compiler, connection):
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):
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):

Undocumented

def get_db_converters(self, connection):

Undocumented

def get_group_by_cols(self, alias=None):

Undocumented

def get_lookup(self, lookup):

Undocumented

def get_source_expressions(self):

Undocumented

def relabel_aliases(self, change_map):
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):

Undocumented

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

Undocumented

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

Undocumented

def set_source_expressions(self, children):

Undocumented

def split_having(self, negated=False):
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 =

Undocumented

resolved: bool =

Undocumented

children =

Undocumented

@cached_property
contains_aggregate =

Undocumented

@cached_property
contains_over_clause =

Undocumented

@cached_property
output_field =

Undocumented