当前位置: 首页>>代码示例>>Python>>正文


Python mapper.class_方法代码示例

本文整理汇总了Python中sqlalchemy.orm.mapper.class_方法的典型用法代码示例。如果您正苦于以下问题:Python mapper.class_方法的具体用法?Python mapper.class_怎么用?Python mapper.class_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sqlalchemy.orm.mapper的用法示例。


在下文中一共展示了mapper.class_方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __init__(self, entity, mapper, selectable, name,
                 with_polymorphic_mappers, polymorphic_on,
                 _base_alias, _use_mapper_path, adapt_on_names):
        self.entity = entity
        self.mapper = mapper
        self.selectable = selectable
        self.name = name
        self.with_polymorphic_mappers = with_polymorphic_mappers
        self.polymorphic_on = polymorphic_on
        self._base_alias = _base_alias or self
        self._use_mapper_path = _use_mapper_path

        self._adapter = sql_util.ColumnAdapter(
            selectable, equivalents=mapper._equivalent_columns,
            adapt_on_names=adapt_on_names, anonymize_labels=True)

        self._adapt_on_names = adapt_on_names
        self._target = mapper.class_

        for poly in self.with_polymorphic_mappers:
            if poly is not mapper:
                setattr(self.entity, poly.class_.__name__,
                        AliasedClass(poly.class_, selectable, base_alias=self,
                                     adapt_on_names=adapt_on_names,
                                     use_mapper_path=_use_mapper_path)) 
开发者ID:jpush,项目名称:jbox,代码行数:27,代码来源:util.py

示例2: __init__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __init__(self, entity, mapper, selectable, name,
                 with_polymorphic_mappers, polymorphic_on,
                 _base_alias, _use_mapper_path, adapt_on_names):
        self.entity = entity
        self.mapper = mapper
        self.selectable = selectable
        self.name = name
        self.with_polymorphic_mappers = with_polymorphic_mappers
        self.polymorphic_on = polymorphic_on
        self._base_alias = _base_alias or self
        self._use_mapper_path = _use_mapper_path

        self._adapter = sql_util.ClauseAdapter(
            selectable, equivalents=mapper._equivalent_columns,
            adapt_on_names=adapt_on_names)

        self._adapt_on_names = adapt_on_names
        self._target = mapper.class_

        for poly in self.with_polymorphic_mappers:
            if poly is not mapper:
                setattr(self.entity, poly.class_.__name__,
                        AliasedClass(poly.class_, selectable, base_alias=self,
                                     adapt_on_names=adapt_on_names,
                                     use_mapper_path=_use_mapper_path)) 
开发者ID:gltn,项目名称:stdm,代码行数:27,代码来源:util.py

示例3: __init__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __init__(self, entity, mapper, selectable, name,
                    with_polymorphic_mappers, polymorphic_on,
                    _base_alias, _use_mapper_path, adapt_on_names):
        self.entity = entity
        self.mapper = mapper
        self.selectable = selectable
        self.name = name
        self.with_polymorphic_mappers = with_polymorphic_mappers
        self.polymorphic_on = polymorphic_on
        self._base_alias = _base_alias or self
        self._use_mapper_path = _use_mapper_path

        self._adapter = sql_util.ClauseAdapter(selectable,
                            equivalents=mapper._equivalent_columns,
                            adapt_on_names=adapt_on_names)

        self._adapt_on_names = adapt_on_names
        self._target = mapper.class_

        for poly in self.with_polymorphic_mappers:
            if poly is not mapper:
                setattr(self.entity, poly.class_.__name__,
                    AliasedClass(poly.class_, selectable, base_alias=self,
                            adapt_on_names=adapt_on_names,
                            use_mapper_path=_use_mapper_path)) 
开发者ID:binhex,项目名称:moviegrabber,代码行数:27,代码来源:util.py

示例4: class_

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def class_(self):
        """Return the mapped class ultimately represented by this
        :class:`.AliasedInsp`."""
        return self.mapper.class_ 
开发者ID:jpush,项目名称:jbox,代码行数:6,代码来源:util.py

示例5: _entity_for_mapper

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [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) 
开发者ID:jpush,项目名称:jbox,代码行数:15,代码来源:util.py

示例6: __repr__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __repr__(self):
        if self.with_polymorphic_mappers:
            with_poly = "(%s)" % ", ".join(
                mp.class_.__name__ for mp in self.with_polymorphic_mappers)
        else:
            with_poly = ""
        return '<AliasedInsp at 0x%x; %s%s>' % (
            id(self), self.class_.__name__, with_poly) 
开发者ID:jpush,项目名称:jbox,代码行数:10,代码来源:util.py

示例7: __init__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __init__(self, cls, alias=None,
                 name=None,
                 flat=False,
                 adapt_on_names=False,
                 #  TODO: None for default here?
                 with_polymorphic_mappers=(),
                 with_polymorphic_discriminator=None,
                 base_alias=None,
                 use_mapper_path=False,
                 represents_outer_join=False):
        mapper = _class_to_mapper(cls)
        if alias is None:
            alias = mapper._with_polymorphic_selectable.alias(
                name=name, flat=flat)

        self._aliased_insp = AliasedInsp(
            self,
            mapper,
            alias,
            name,
            with_polymorphic_mappers
            if with_polymorphic_mappers
            else mapper.with_polymorphic_mappers,
            with_polymorphic_discriminator
            if with_polymorphic_discriminator is not None
            else mapper.polymorphic_on,
            base_alias,
            use_mapper_path,
            adapt_on_names,
            represents_outer_join
        )

        self.__name__ = 'AliasedClass_%s' % mapper.class_.__name__ 
开发者ID:yfauser,项目名称:planespotter,代码行数:35,代码来源:util.py

示例8: _entity_for_mapper

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [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) 
开发者ID:gltn,项目名称:stdm,代码行数:11,代码来源:util.py

示例9: __repr__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __repr__(self):
        return '<AliasedInsp at 0x%x; %s>' % (
            id(self), self.class_.__name__) 
开发者ID:gltn,项目名称:stdm,代码行数:5,代码来源:util.py

示例10: __init__

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def __init__(
        self,
        mapped_class_or_ac,
        alias=None,
        name=None,
        flat=False,
        adapt_on_names=False,
        #  TODO: None for default here?
        with_polymorphic_mappers=(),
        with_polymorphic_discriminator=None,
        base_alias=None,
        use_mapper_path=False,
        represents_outer_join=False,
    ):
        insp = inspection.inspect(mapped_class_or_ac)
        mapper = insp.mapper

        if alias is None:
            alias = mapper._with_polymorphic_selectable._anonymous_fromclause(
                name=name, flat=flat
            )

        self._aliased_insp = AliasedInsp(
            self,
            insp,
            alias,
            name,
            with_polymorphic_mappers
            if with_polymorphic_mappers
            else mapper.with_polymorphic_mappers,
            with_polymorphic_discriminator
            if with_polymorphic_discriminator is not None
            else mapper.polymorphic_on,
            base_alias,
            use_mapper_path,
            adapt_on_names,
            represents_outer_join,
        )

        self.__name__ = "AliasedClass_%s" % mapper.class_.__name__ 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:42,代码来源:util.py

示例11: _reconstitute_from_aliased_insp

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [as 别名]
def _reconstitute_from_aliased_insp(cls, aliased_insp):
        obj = cls.__new__(cls)
        obj.__name__ = "AliasedClass_%s" % aliased_insp.mapper.class_.__name__
        obj._aliased_insp = aliased_insp
        return obj 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:7,代码来源:util.py

示例12: _entity_for_mapper

# 需要导入模块: from sqlalchemy.orm import mapper [as 别名]
# 或者: from sqlalchemy.orm.mapper import class_ [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) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:15,代码来源:util.py


注:本文中的sqlalchemy.orm.mapper.class_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。