本文整理匯總了Python中sqlalchemy.orm.mapper.isa方法的典型用法代碼示例。如果您正苦於以下問題:Python mapper.isa方法的具體用法?Python mapper.isa怎麽用?Python mapper.isa使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sqlalchemy.orm.mapper
的用法示例。
在下文中一共展示了mapper.isa方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _include_fn
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _include_fn(self, elem):
entity = elem._annotations.get('parentmapper', None)
return not entity or entity.isa(self.mapper)
示例2: _entity_for_mapper
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _entity_for_mapper(self, mapper):
self_poly = self.with_polymorphic_mappers
if mapper in self_poly:
if mapper is self.mapper:
return self
else:
return getattr(
self.entity, mapper.class_.__name__)._aliased_insp
elif mapper.isa(self.mapper):
return self
else:
assert False, "mapper %s doesn't correspond to %s" % (
mapper, self)
示例3: _entity_isa
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _entity_isa(given, mapper):
"""determine if 'given' "is a" mapper, in terms of the given
would load rows of type 'mapper'.
"""
if given.is_aliased_class:
return mapper in given.with_polymorphic_mappers or \
given.mapper.isa(mapper)
elif given.with_polymorphic_mappers:
return mapper in given.with_polymorphic_mappers
else:
return given.isa(mapper)
示例4: replace
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def replace(self, elem):
entity = elem._annotations.get('parentmapper', None)
if not entity or entity.isa(self.mapper):
return sql_util.ColumnAdapter.replace(self, elem)
else:
return None
示例5: _entity_for_mapper
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _entity_for_mapper(self, mapper):
self_poly = self.with_polymorphic_mappers
if mapper in self_poly:
return getattr(self.entity, mapper.class_.__name__)._aliased_insp
elif mapper.isa(self.mapper):
return self
else:
assert False, "mapper %s doesn't correspond to %s" % (
mapper, self)
示例6: _include_fn
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _include_fn(self, elem):
entity = elem._annotations.get("parentmapper", None)
return not entity or entity.isa(self.mapper)
示例7: _entity_for_mapper
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _entity_for_mapper(self, mapper):
self_poly = self.with_polymorphic_mappers
if mapper in self_poly:
if mapper is self.mapper:
return self
else:
return getattr(
self.entity, mapper.class_.__name__
)._aliased_insp
elif mapper.isa(self.mapper):
return self
else:
assert False, "mapper %s doesn't correspond to %s" % (mapper, self)
示例8: _entity_isa
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _entity_isa(given, mapper):
"""determine if 'given' "is a" mapper, in terms of the given
would load rows of type 'mapper'.
"""
if given.is_aliased_class:
return mapper in given.with_polymorphic_mappers or given.mapper.isa(
mapper
)
elif given.with_polymorphic_mappers:
return mapper in given.with_polymorphic_mappers
else:
return given.isa(mapper)
示例9: _entity_for_mapper
# 需要導入模塊: from sqlalchemy.orm import mapper [as 別名]
# 或者: from sqlalchemy.orm.mapper import isa [as 別名]
def _entity_for_mapper(self, mapper):
self_poly = self.with_polymorphic_mappers
if mapper in self_poly:
return getattr(self.entity, mapper.class_.__name__)._aliased_insp
elif mapper.isa(self.mapper):
return self
else:
assert False, "mapper %s doesn't correspond to %s" % (mapper, self)