當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。