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


Python table.update方法代码示例

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


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

示例1: _froms

# 需要导入模块: from sqlalchemy import table [as 别名]
# 或者: from sqlalchemy.table import update [as 别名]
def _froms(self):
        # would love to cache this,
        # but there's just enough edge cases, particularly now that
        # declarative encourages construction of SQL expressions
        # without tables present, to just regen this each time.
        froms = []
        seen = set()
        translate = self._from_cloned

        for item in itertools.chain(
            _from_objects(*self._raw_columns),
            _from_objects(self._whereclause)
            if self._whereclause is not None else (),
            self._from_obj
        ):
            if item is self:
                raise exc.InvalidRequestError(
                    "select() construct refers to itself as a FROM")
            if translate and item in translate:
                item = translate[item]
            if not seen.intersection(item._cloned_set):
                froms.append(item)
            seen.update(item._cloned_set)

        return froms 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:27,代码来源:selectable.py

示例2: update

# 需要导入模块: from sqlalchemy import table [as 别名]
# 或者: from sqlalchemy.table import update [as 别名]
def update(
            self, dml, whereclause=None, values=None, inline=False, **kwargs):
        """Generate an :func:`.update` construct against this
        :class:`.TableClause`.

        E.g.::

            table.update().where(table.c.id==7).values(name='foo')

        See :func:`.update` for argument and usage information.

        """

        return dml.Update(self, whereclause=whereclause,
                          values=values, inline=inline, **kwargs) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:17,代码来源:selectable.py

示例3: _populate_column_collection

# 需要导入模块: from sqlalchemy import table [as 别名]
# 或者: from sqlalchemy.table import update [as 别名]
def _populate_column_collection(self, sqlutil):
        columns = [c for c in self.left.columns] + \
            [c for c in self.right.columns]

        self.primary_key.extend(sqlutil.reduce_columns(
            (c for c in columns if c.primary_key), self.onclause))
        self._columns.update((col._label, col) for col in columns)
        self.foreign_keys.update(itertools.chain(
            *[col.foreign_keys for col in columns])) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:11,代码来源:selectable.py

示例4: parse_legacy_select

# 需要导入模块: from sqlalchemy import table [as 别名]
# 或者: from sqlalchemy.table import update [as 别名]
def parse_legacy_select(self, arg):
        """Parse the for_update arugment of :func:`.select`.

        :param mode: Defines the lockmode to use.

            ``None`` - translates to no lockmode

            ``'update'`` - translates to ``FOR UPDATE``
            (standard SQL, supported by most dialects)

            ``'nowait'`` - translates to ``FOR UPDATE NOWAIT``
            (supported by Oracle, PostgreSQL 8.1 upwards)

            ``'read'`` - translates to ``LOCK IN SHARE MODE`` (for MySQL),
            and ``FOR SHARE`` (for PostgreSQL)

            ``'read_nowait'`` - translates to ``FOR SHARE NOWAIT``
            (supported by PostgreSQL). ``FOR SHARE`` and
            ``FOR SHARE NOWAIT`` (PostgreSQL).

        """
        if arg in (None, False):
            return None

        nowait = read = False
        if arg == 'nowait':
            nowait = True
        elif arg == 'read':
            read = True
        elif arg == 'read_nowait':
            read = nowait = True
        elif arg is not True:
            raise exc.ArgumentError("Unknown for_update argument: %r" % arg)

        return ForUpdateArg(read=read, nowait=nowait) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:37,代码来源:selectable.py

示例5: _refresh_for_new_column

# 需要导入模块: from sqlalchemy import table [as 别名]
# 或者: from sqlalchemy.table import update [as 别名]
def _refresh_for_new_column(self, column):
        col = self.left._refresh_for_new_column(column)
        if col is None:
            col = self.right._refresh_for_new_column(column)
        if col is not None:
            if self._cols_populated:
                self._columns[col._label] = col
                self.foreign_keys.update(col.foreign_keys)
                if col.primary_key:
                    self.primary_key.add(col)
                return col
        return None 
开发者ID:Agentscreech,项目名称:ShelbySearch,代码行数:14,代码来源:selectable.py

示例6: parse_legacy_select

# 需要导入模块: from sqlalchemy import table [as 别名]
# 或者: from sqlalchemy.table import update [as 别名]
def parse_legacy_select(self, arg):
        """Parse the for_update argument of :func:`.select`.

        :param mode: Defines the lockmode to use.

            ``None`` - translates to no lockmode

            ``'update'`` - translates to ``FOR UPDATE``
            (standard SQL, supported by most dialects)

            ``'nowait'`` - translates to ``FOR UPDATE NOWAIT``
            (supported by Oracle, PostgreSQL 8.1 upwards)

            ``'read'`` - translates to ``LOCK IN SHARE MODE`` (for MySQL),
            and ``FOR SHARE`` (for PostgreSQL)

            ``'read_nowait'`` - translates to ``FOR SHARE NOWAIT``
            (supported by PostgreSQL). ``FOR SHARE`` and
            ``FOR SHARE NOWAIT`` (PostgreSQL).

        """
        if arg in (None, False):
            return None

        nowait = read = False
        if arg == 'nowait':
            nowait = True
        elif arg == 'read':
            read = True
        elif arg == 'read_nowait':
            read = nowait = True
        elif arg is not True:
            raise exc.ArgumentError("Unknown for_update argument: %r" % arg)

        return ForUpdateArg(read=read, nowait=nowait) 
开发者ID:Agentscreech,项目名称:ShelbySearch,代码行数:37,代码来源:selectable.py


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