class hybrid_method(interfaces.InspectionAttrInfo):
Method | __init__ |
Create a new .hybrid_method . |
Method | expression |
Provide a modifying decorator that defines a SQL-expression producing method. |
Method | __get__ |
Undocumented |
Class Variable | is_attribute |
True if this object is a Python :term:`descriptor`. |
Instance Variable | expr |
Undocumented |
Instance Variable | func |
Undocumented |
Inherited from InspectionAttrInfo
:
Property | info |
Info dictionary associated with the object, allowing user-defined data to be associated with this .InspectionAttr . |
Inherited from InspectionAttr
(via InspectionAttrInfo
):
Class Variable | __slots__ |
Undocumented |
Class Variable | _is_internal_proxy |
True if this object is an internal proxy object. |
Class Variable | is_aliased_class |
True if this object is an instance of .AliasedClass . |
Class Variable | is_bundle |
True if this object is an instance of .Bundle . |
Class Variable | is_clause_element |
True if this object is an instance of _expression.ClauseElement . |
Class Variable | is_instance |
True if this object is an instance of .InstanceState . |
Class Variable | is_mapper |
True if this object is an instance of _orm.Mapper . |
Class Variable | is_property |
True if this object is an instance of .MapperProperty . |
Class Variable | is_selectable |
Return True if this object is an instance of _expression.Selectable . |
Create a new .hybrid_method
.
Usage is typically via decorator:
from sqlalchemy.ext.hybrid import hybrid_method class SomeClass(object): @hybrid_method def value(self, x, y): return self._value + x + y @value.expression def value(self, x, y): return func.some_function(self._value, x, y)
bool
=
True if this object is a Python :term:`descriptor`.
This can refer to one of many types. Usually a
.QueryableAttribute
which handles attributes events on behalf
of a .MapperProperty
. But can also be an extension type
such as .AssociationProxy
or .hybrid_property
.
The .InspectionAttr.extension_type
will refer to a constant
identifying the specific subtype.
See Also
_orm.Mapper.all_orm_descriptors