class documentation

class TruncDate(TruncBase):

View In Hierarchy

Undocumented

Method as​_sql Responsible for returning a (sql, [params]) tuple to be included in the current query.
Class Variable kind Undocumented
Class Variable lookup​_name Undocumented
Class Variable output​_field Return the output type of this expressions.

Inherited from TruncBase:

Method __init__ Undocumented
Method convert​_value Expressions provide their own converters because users have the option of manually specifying the output_field which may be a different type from the one the database returns.
Method resolve​_expression Provide the chance to do any preprocessing or validation before being added to the query.
Instance Variable is​_dst Undocumented
Instance Variable tzinfo Undocumented

Inherited from TimezoneMixin (via TruncBase):

Method get​_tzname Undocumented

Inherited from Transform (via TruncBase):

Method get​_bilateral​_transforms Undocumented
Class Variable arity Undocumented
Class Variable bilateral Undocumented
Property lhs Undocumented

Inherited from RegisterLookupMixin (via TruncBase, Transform):

Class Method get​_lookups Undocumented
Class Method register​_lookup Undocumented
Static Method merge​_dicts Merge dicts in reverse to preference the order of the original list. e.g., merge_dicts([a, b]) will preference the keys in 'a' over those in 'b'.
Class Method ​_clear​_cached​_lookups Undocumented
Class Method ​_get​_lookup Undocumented
Class Method ​_unregister​_lookup Remove given lookup from cls lookups. For use in tests only as it's not thread-safe.
Method get​_lookup Undocumented
Method get​_transform Undocumented

Inherited from Func (via TruncBase, Transform):

Method __repr__ Undocumented
Method ​_get​_repr​_options Return a dict of extra __init__() options to include in the repr.
Method copy Undocumented
Method get​_source​_expressions Undocumented
Method set​_source​_expressions Undocumented
Class Variable arg​_joiner Undocumented
Class Variable function Undocumented
Class Variable template Undocumented
Instance Variable extra Undocumented
Instance Variable source​_expressions Undocumented

Inherited from SQLiteNumericMixin (via TruncBase, Transform, Func):

Method as​_sqlite Undocumented

Inherited from Expression (via TruncBase, Transform, Func):

Method __eq__ Undocumented
Method __hash__ Undocumented
Property identity Undocumented

Inherited from BaseExpression (via TruncBase, Transform, Func, Expression):

Static Method ​_convert​_value​_noop Undocumented
Method __getstate__ Undocumented
Method ​_parse​_expressions Undocumented
Method ​_resolve​_output​_field Attempt to infer the output type of the expression. If the output fields of all source fields match then, simply infer the same type here. This isn't always correct, but it makes sense most of the time.
Method asc Undocumented
Method desc Undocumented
Method flatten Recursively yield this expression and all subexpressions, in depth-first order.
Method get​_db​_converters Undocumented
Method get​_group​_by​_cols Undocumented
Method get​_lookup Undocumented
Method get​_source​_fields Return the underlying field types used by this aggregate.
Method get​_transform Undocumented
Method relabeled​_clone Undocumented
Method reverse​_ordering Undocumented
Method select​_format Custom format for select clauses. For example, EXISTS expressions need to be wrapped in CASE WHEN on Oracle.
Class Variable ​_output​_field​_resolved​_to​_none Undocumented
Class Variable filterable Undocumented
Class Variable is​_summary Undocumented
Class Variable window​_compatible Undocumented
Property ​_output​_field​_or​_none Return the output field of this expression, or None if _resolve_output_field() didn't return an output type.
Property conditional Undocumented
Property contains​_aggregate Undocumented
Property contains​_column​_references Undocumented
Property contains​_over​_clause Undocumented
Property field Undocumented

Inherited from Combinable (via TruncBase, Transform, Func, Expression):

Constant ADD Undocumented
Constant BITAND Undocumented
Constant BITLEFTSHIFT Undocumented
Constant BITOR Undocumented
Constant BITRIGHTSHIFT Undocumented
Constant BITXOR Undocumented
Constant DIV Undocumented
Constant MOD Undocumented
Constant MUL Undocumented
Constant POW Undocumented
Constant SUB Undocumented
Method __add__ Undocumented
Method __and__ Undocumented
Method __mod__ Undocumented
Method __mul__ Undocumented
Method __neg__ Undocumented
Method __or__ Undocumented
Method __pow__ Undocumented
Method __radd__ Undocumented
Method __rand__ Undocumented
Method __rmod__ Undocumented
Method __rmul__ Undocumented
Method __ror__ Undocumented
Method __rpow__ Undocumented
Method __rsub__ Undocumented
Method __rtruediv__ Undocumented
Method __sub__ Undocumented
Method __truediv__ Undocumented
Method ​_combine Undocumented
Method bitand Undocumented
Method bitleftshift Undocumented
Method bitor Undocumented
Method bitrightshift Undocumented
Method bitxor Undocumented
def as_sql(self, compiler, connection):

Responsible for returning a (sql, [params]) tuple to be included in the current query.

Different backends can provide their own implementation, by providing an as_{vendor} method and patching the Expression:

``` def override_as_sql(self, compiler, connection):

# custom logic return super().as_sql(compiler, connection)

setattr(Expression, 'as_' + connection.vendor, override_as_sql) ```

Arguments:
  • compiler: the query compiler responsible for generating the query. Must have a compile method, returning a (sql, [params]) tuple. Calling compiler(value) will return a quoted value.
  • connection: the database connection used for the current query.
Return: (sql, params)
Where sql is a string containing ordered sql parameters to be replaced with the elements of the list params.
kind: str =
lookup_name: str =

Undocumented

output_field =
Return the output type of this expressions.