class documentation

A decorator which allows definition of a Python object method with both instance-level and class-level behavior.

Method __get__ Undocumented
Method __init__ Create a new :class:`.hybrid_method`.
Method expression Provide a modifying decorator that defines a SQL-expression producing method.
Class Variable is_attribute True if this object is a Python :term:`descriptor`.
Instance Variable expr Undocumented
Instance Variable func Undocumented
Property inplace Return the inplace mutator for this :class:`.hybrid_method`.

Inherited from InspectionAttrInfo:

Class Variable __slots__ Undocumented
Property info Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`.

Inherited from InspectionAttr (via InspectionAttrInfo):

Class Variable is_aliased_class True if this object is an instance of :class:`.AliasedClass`.
Class Variable is_bundle True if this object is an instance of :class:`.Bundle`.
Class Variable is_clause_element True if this object is an instance of :class:`_expression.ClauseElement`.
Class Variable is_instance True if this object is an instance of :class:`.InstanceState`.
Class Variable is_mapper True if this object is an instance of :class:`_orm.Mapper`.
Class Variable is_property True if this object is an instance of :class:`.MapperProperty`.
Class Variable is_selectable Return True if this object is an instance of :class:`_expression.Selectable`.
Class Variable _is_internal_proxy True if this object is an internal proxy object.
@overload
def __get__(self, instance: Literal[None], owner: Type[object]) -> Callable[_P, SQLCoreOperations[_R]]:
@overload
def __get__(self, instance: object, owner: Type[object]) -> Callable[_P, _R]:
(source)

Undocumented

def __init__(self, func: Callable[Concatenate[Any, _P], _R], expr: Optional[Callable[Concatenate[Any, _P], SQLCoreOperations[_R]]] = None): (source)

Create a new :class:`.hybrid_method`. Usage is typically via decorator:: from sqlalchemy.ext.hybrid import hybrid_method class SomeClass: @hybrid_method def value(self, x, y): return self._value + x + y @value.expression @classmethod def value(cls, x, y): return func.some_function(cls._value, x, y)

def expression(self, expr: Callable[Concatenate[Any, _P], SQLCoreOperations[_R]]) -> hybrid_method[_P, _R]: (source)

Provide a modifying decorator that defines a SQL-expression producing method.

is_attribute: bool = (source)

True if this object is a Python :term:`descriptor`. This can refer to one of many types. Usually a :class:`.QueryableAttribute` which handles attributes events on behalf of a :class:`.MapperProperty`. But can also be an extension type such as :class:`.AssociationProxy` or :class:`.hybrid_property`. The :attr:`.InspectionAttr.extension_type` will refer to a constant identifying the specific subtype. .. seealso:: :attr:`_orm.Mapper.all_orm_descriptors`

Undocumented

Undocumented

@property
inplace: Self = (source)

Return the inplace mutator for this :class:`.hybrid_method`. The :class:`.hybrid_method` class already performs "in place" mutation when the :meth:`.hybrid_method.expression` decorator is called, so this attribute returns Self. .. versionadded:: 2.0.4 .. seealso:: :ref:`hybrid_pep484_naming`