本文整理汇总了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)