class hybrid_method(interfaces.InspectionAttrInfo, Generic[
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 |
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 |
True if this object is an instance of :class:`.AliasedClass`. |
Class Variable | is |
True if this object is an instance of :class:`.Bundle`. |
Class Variable | is |
True if this object is an instance of :class:`_expression.ClauseElement`. |
Class Variable | is |
True if this object is an instance of :class:`.InstanceState`. |
Class Variable | is |
True if this object is an instance of :class:`_orm.Mapper`. |
Class Variable | is |
True if this object is an instance of :class:`.MapperProperty`. |
Class Variable | is |
Return True if this object is an instance of :class:`_expression.Selectable`. |
Class Variable | _is |
True if this object is an internal proxy object. |
Literal[ None]
, owner: Type[ object]
) -> Callable[ _P, SQLCoreOperations[ _R]]
:(source) ¶
Undocumented
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)
Callable[ Concatenate[ Any, _P], SQLCoreOperations[ _R]]
) -> hybrid_method[ _P, _R]
:
(source)
¶
Provide a modifying decorator that defines a SQL-expression producing method.
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`