Python sqlalchemy.orm 模块,join() 实例源码

我们从Python开源项目中,提取了以下48个代码示例,用于说明如何使用sqlalchemy.orm.join()

项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:beproudbot    作者:beproud    | 项目源码 | 文件源码
def get_term(message, command):
    """????????????????????

    :param message: slackbot.dispatcher.Message
    :param str command: ?????????
    """
    name = command.name
    if command.terms:
        msg = ['???? `${}` ???? {} ?????'.format(
            name, len(command.terms))]
        for t in command.terms:
            msg.append(t.word)
        message.send('\n'.join(msg))
    else:
        msg = ('???? `${0}` ??????????????\n'
               '`${0} add (??)` ????????????'.format(name))
        message.send(msg)
项目:beproudbot    作者:beproud    | 项目源码 | 文件源码
def search_term(message, command, keyword):
    """???????????????????????????????

    :param message: slackbot.dispatcher.Message
    :param str command: ?????????
    :param str keyword: ?????????????????
    """
    s = Session()
    terms = (s.query(Term)
             .filter(Term.create_command == command.id)
             .filter(Term.word.like('%' + keyword + '%')))

    name = command.name
    if terms.count() > 0:
        msg = ['???? `${}` ? `{}` ?????? {} ?????'.format(
            name, keyword, terms.count())]
        for t in terms:
            msg.append(t.word)
        message.send('\n'.join(msg))
    else:
        message.send('???? `${}` ? `{}` ???????????'.format(
            name, keyword))
项目:beproudbot    作者:beproud    | 项目源码 | 文件源码
def add_term(message, command, word):
    """????????????

    :param message: slackbot.dispatcher.Message
    :param str command: ?????????
    :param str word: ??????
    """
    s = Session()
    term = (s.query(Term)
            .select_from(join(Term, CreateCommand))
            .filter(CreateCommand.id == command.id)
            .filter(Term.word == word)
            .one_or_none())

    name = command.name
    if term:
        message.send('???? `${}` ??{}????????'.format(name, word))
    else:
        s.add(Term(create_command=command.id, creator=message.body['user'], word=word))
        s.commit()
        message.send('???? `${}` ??{}????????'.format(name, word))
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:ShelbySearch    作者:Agentscreech    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Callandtext    作者:iaora    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:python_ddd_flask    作者:igorvinnicius    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:QualquerMerdaAPI    作者:tiagovizoto    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:gardenbot    作者:GoestaO    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:flask-zhenai-mongo-echarts    作者:Fretice    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Data-visualization    作者:insta-code1    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:micro-blog    作者:nickChenyx    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:python-flask-security    作者:weinbergdavid    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:watcher    作者:nosmokingbandit    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Lixiang_zhaoxin    作者:hejaxian    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:flask    作者:bobohope    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Chorus    作者:DonaldBough    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Hawkeye    作者:tozhengxq    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Alfred    作者:jkachhadia    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:ngx_status    作者:YoYoAdorkable    | 项目源码 | 文件源码
def _splice_into_center(self, other):
        """Splice a join into the center.

        Given join(a, b) and join(b, c), return join(a, b).join(c)

        """
        leftmost = other
        while isinstance(leftmost, sql.Join):
            leftmost = leftmost.left

        assert self.right is leftmost

        left = _ORMJoin(
            self.left, other.left,
            self.onclause, isouter=self.isouter,
            _left_memo=self._left_memo,
            _right_memo=other._left_memo
        )

        return _ORMJoin(
            left,
            other.right,
            other.onclause, isouter=other.isouter,
            _right_memo=other._right_memo
        )
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def __new__(cls, value_list):
        if isinstance(value_list, util.string_types) or value_list is None:
            return cls.from_string(value_list)
        values = set(value_list)
        if values.difference(cls._allowed_cascades):
            raise sa_exc.ArgumentError(
                "Invalid cascade option(s): %s" %
                ", ".join([repr(x) for x in
                           sorted(values.difference(cls._allowed_cascades))]))

        if "all" in values:
            values.update(cls._add_w_all_cascades)
        if "none" in values:
            values.clear()
        values.discard('all')

        self = frozenset.__new__(CascadeOptions, values)
        self.save_update = 'save-update' in values
        self.delete = 'delete' in values
        self.refresh_expire = 'refresh-expire' in values
        self.merge = 'merge' in values
        self.expunge = 'expunge' in values
        self.delete_orphan = "delete-orphan" in values

        if self.delete_orphan and not self.delete:
            util.warn("The 'delete-orphan' cascade "
                      "option requires 'delete'.")
        return self
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def __repr__(self):
        return "CascadeOptions(%r)" % (
            ",".join([x for x in sorted(self)])
        )
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
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)
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def join(self, right, onclause=None, isouter=False, join_to_left=None):
        return _ORMJoin(self, right, onclause, isouter)
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def outerjoin(left, right, onclause=None, join_to_left=None):
    """Produce a left outer join between left and right clauses.

    This is the "outer join" version of the :func:`.orm.join` function,
    featuring the same behavior except that an OUTER JOIN is generated.
    See that function's documentation for other usage details.

    """
    return _ORMJoin(left, right, onclause, True)
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
def __new__(cls, value_list):
        if isinstance(value_list, util.string_types) or value_list is None:
            return cls.from_string(value_list)
        values = set(value_list)
        if values.difference(cls._allowed_cascades):
            raise sa_exc.ArgumentError(
                "Invalid cascade option(s): %s" %
                ", ".join([repr(x) for x in
                           sorted(values.difference(cls._allowed_cascades))]))

        if "all" in values:
            values.update(cls._add_w_all_cascades)
        if "none" in values:
            values.clear()
        values.discard('all')

        self = frozenset.__new__(CascadeOptions, values)
        self.save_update = 'save-update' in values
        self.delete = 'delete' in values
        self.refresh_expire = 'refresh-expire' in values
        self.merge = 'merge' in values
        self.expunge = 'expunge' in values
        self.delete_orphan = "delete-orphan" in values

        if self.delete_orphan and not self.delete:
            util.warn("The 'delete-orphan' cascade "
                      "option requires 'delete'.")
        return self
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
def __repr__(self):
        return "CascadeOptions(%r)" % (
            ",".join([x for x in sorted(self)])
        )
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
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)
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
def join(self, right, onclause=None, isouter=False, join_to_left=None):
        return _ORMJoin(self, right, onclause, isouter)
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
def outerjoin(left, right, onclause=None, join_to_left=None):
    """Produce a left outer join between left and right clauses.

    This is the "outer join" version of the :func:`.orm.join` function,
    featuring the same behavior except that an OUTER JOIN is generated.
    See that function's documentation for other usage details.

    """
    return _ORMJoin(left, right, onclause, True)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def __new__(cls, arg):
        values = set([
            c for c
            in re.split('\s*,\s*', arg or "")
            if c
        ])

        if values.difference(cls._allowed_cascades):
            raise sa_exc.ArgumentError(
                "Invalid cascade option(s): %s" %
                ", ".join([repr(x) for x in
                           sorted(
                    values.difference(cls._allowed_cascades)
                )])
            )

        if "all" in values:
            values.update(cls._add_w_all_cascades)
        if "none" in values:
            values.clear()
        values.discard('all')

        self = frozenset.__new__(CascadeOptions, values)
        self.save_update = 'save-update' in values
        self.delete = 'delete' in values
        self.refresh_expire = 'refresh-expire' in values
        self.merge = 'merge' in values
        self.expunge = 'expunge' in values
        self.delete_orphan = "delete-orphan" in values

        if self.delete_orphan and not self.delete:
            util.warn("The 'delete-orphan' cascade "
                      "option requires 'delete'.")
        return self
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def __repr__(self):
        return "CascadeOptions(%r)" % (
            ",".join([x for x in sorted(self)])
        )
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def join(self, right, onclause=None, isouter=False, join_to_left=None):
        return _ORMJoin(self, right, onclause, isouter)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def __new__(cls, arg):
        values = set([
            c for c
            in re.split('\s*,\s*', arg or "")
            if c
        ])

        if values.difference(cls._allowed_cascades):
            raise sa_exc.ArgumentError(
                "Invalid cascade option(s): %s" %
                ", ".join([repr(x) for x in
                           sorted(
                    values.difference(cls._allowed_cascades)
                )])
            )

        if "all" in values:
            values.update(cls._add_w_all_cascades)
        if "none" in values:
            values.clear()
        values.discard('all')

        self = frozenset.__new__(CascadeOptions, values)
        self.save_update = 'save-update' in values
        self.delete = 'delete' in values
        self.refresh_expire = 'refresh-expire' in values
        self.merge = 'merge' in values
        self.expunge = 'expunge' in values
        self.delete_orphan = "delete-orphan" in values

        if self.delete_orphan and not self.delete:
            util.warn("The 'delete-orphan' cascade "
                      "option requires 'delete'.")
        return self
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def __repr__(self):
        return "CascadeOptions(%r)" % (
            ",".join([x for x in sorted(self)])
        )
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def join(self, right, onclause=None, isouter=False, join_to_left=None):
        return _ORMJoin(self, right, onclause, isouter)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def __new__(cls, value_list):
        if isinstance(value_list, util.string_types) or value_list is None:
            return cls.from_string(value_list)
        values = set(value_list)
        if values.difference(cls._allowed_cascades):
            raise sa_exc.ArgumentError(
                "Invalid cascade option(s): %s" %
                ", ".join([repr(x) for x in
                           sorted(values.difference(cls._allowed_cascades))]))

        if "all" in values:
            values.update(cls._add_w_all_cascades)
        if "none" in values:
            values.clear()
        values.discard('all')

        self = frozenset.__new__(CascadeOptions, values)
        self.save_update = 'save-update' in values
        self.delete = 'delete' in values
        self.refresh_expire = 'refresh-expire' in values
        self.merge = 'merge' in values
        self.expunge = 'expunge' in values
        self.delete_orphan = "delete-orphan" in values

        if self.delete_orphan and not self.delete:
            util.warn("The 'delete-orphan' cascade "
                      "option requires 'delete'.")
        return self
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def __repr__(self):
        return "CascadeOptions(%r)" % (
            ",".join([x for x in sorted(self)])
        )
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
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)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def join(self, right, onclause=None, isouter=False, join_to_left=None):
        return _ORMJoin(self, right, onclause, isouter)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def outerjoin(left, right, onclause=None, join_to_left=None):
    """Produce a left outer join between left and right clauses.

    This is the "outer join" version of the :func:`.orm.join` function,
    featuring the same behavior except that an OUTER JOIN is generated.
    See that function's documentation for other usage details.

    """
    return _ORMJoin(left, right, onclause, True)
项目:ShelbySearch    作者:Agentscreech    | 项目源码 | 文件源码
def __new__(cls, value_list):
        if isinstance(value_list, util.string_types) or value_list is None:
            return cls.from_string(value_list)
        values = set(value_list)
        if values.difference(cls._allowed_cascades):
            raise sa_exc.ArgumentError(
                "Invalid cascade option(s): %s" %
                ", ".join([repr(x) for x in
                           sorted(values.difference(cls._allowed_cascades))]))

        if "all" in values:
            values.update(cls._add_w_all_cascades)
        if "none" in values:
            values.clear()
        values.discard('all')

        self = frozenset.__new__(CascadeOptions, values)
        self.save_update = 'save-update' in values
        self.delete = 'delete' in values
        self.refresh_expire = 'refresh-expire' in values
        self.merge = 'merge' in values
        self.expunge = 'expunge' in values
        self.delete_orphan = "delete-orphan" in values

        if self.delete_orphan and not self.delete:
            util.warn("The 'delete-orphan' cascade "
                      "option requires 'delete'.")
        return self