Python 检查属性是否为SqlAlchemy hybrid_属性
我有一个与下面类似的mixin,我需要区分Python 检查属性是否为SqlAlchemy hybrid_属性,python,python-2.7,sqlalchemy,Python,Python 2.7,Sqlalchemy,我有一个与下面类似的mixin,我需要区分normal\u关系attr和specialattr class MyMixin(object): @declared_attr def normal_relationship(self): return relationship( "CustomAttributeValue", primaryjoin=my_good_join_function, backref='{0}_somethi
normal\u关系
attr和special
attr
class MyMixin(object):
@declared_attr
def normal_relationship(self):
return relationship(
"CustomAttributeValue",
primaryjoin=my_good_join_function,
backref='{0}_something_else'.format(self.__name__),
cascade='all, delete-orphan',
)
@declared_attr
def _special_relationship(self):
return relationship(
"CustomAttributeValue",
primaryjoin=my_good_join_function,
backref='{0}_something'.format(self.__name__),
cascade='all, delete-orphan',
)
@hybrid_property
def special(self):
return self._special_relationship
@special.setter
def special(self, values):
self._special_relationship.append(value*2)
因为special
的getter返回\u special\u relationship
,这与normal\u relationship
相同,我不知道如何检查这种差异
getattr(MyMixin,“特殊”)
与getattr(MyMixin”,“特殊关系”)
相同
是否有任何方法,或者我可以向特殊的hybrid属性添加任何内容来检查它是否具有自定义setter
基本上弄清楚哪些属性定义了特殊的setter会非常好