class documentation

class hybrid_method(interfaces.InspectionAttrInfo):

View In Hierarchy

A decorator which allows definition of a Python object method with both instance-level and class-level behavior.
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.
def __init__(self, func, expr=None):

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)
def expression(self, expr):
Provide a modifying decorator that defines a SQL-expression producing method.
def __get__(self, instance, owner):

Undocumented

is_attribute: 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

expr =

Undocumented

func =

Undocumented