Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 检查属性是否为SqlAlchemy hybrid_属性_Python_Python 2.7_Sqlalchemy - Fatal编程技术网

Python 检查属性是否为SqlAlchemy hybrid_属性

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

我有一个与下面类似的mixin,我需要区分
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会非常好