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


Python expression._select_iterables函数代码示例

本文整理汇总了Python中sqlalchemy.sql.expression._select_iterables函数的典型用法代码示例。如果您正苦于以下问题:Python _select_iterables函数的具体用法?Python _select_iterables怎么用?Python _select_iterables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: returning_clause

    def returning_clause(self, stmt, returning_cols):
        columns = [
                self._label_select_column(None, c, True, False, {})
                for c in expression._select_iterables(returning_cols)
            ]

        return 'RETURNING ' + ', '.join(columns)
开发者ID:wangzhengbo1204,项目名称:Python,代码行数:7,代码来源:base.py

示例2: returning_clause

    def returning_clause(self, stmt, returning_cols):
        self.returning_cols = list(
            expression._select_iterables(returning_cols))

        # within_columns_clause=False so that labels (foo AS bar) don't render
        columns = [self.process(c, within_columns_clause=False,
                                result_map=self.result_map)
                   for c in self.returning_cols]

        if not hasattr(self, 'returning_parameters'):
            self.returning_parameters = []

        binds = []
        for i, col in enumerate(self.returning_cols):
            dbtype = col.type.dialect_impl(
                self.dialect).get_dbapi_type(self.dialect.dbapi)
            self.returning_parameters.append((i + 1, dbtype))

            bindparam = sql.bindparam(
                "ret_%d" % i, value=ReturningParam(dbtype))
            self.binds[bindparam.key] = bindparam
            binds.append(
                self.bindparam_string(self._truncate_bindparam(bindparam)))

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds)
开发者ID:AdamShechter9,项目名称:user_dashboard,代码行数:25,代码来源:zxjdbc.py

示例3: returning_clause

    def returning_clause(self, stmt, returning_cols):

        columns = [
            self.process(
                self.label_select_column(None, c, asfrom=False), within_columns_clause=True, result_map=self.result_map
            )
            for c in expression._select_iterables(returning_cols)
        ]
        return "RETURNING " + ", ".join(columns)
开发者ID:Greaky,项目名称:CouchPotatoServer,代码行数:9,代码来源:base.py

示例4: returning_clause

    def returning_clause(self, stmt, returning_cols):
        def create_out_param(col, i):
            bindparam = sql.outparam("ret_%d" % i, type_=col.type)
            self.binds[bindparam.key] = bindparam
            return self.bindparam_string(self._truncate_bindparam(bindparam))

        columnlist = list(expression._select_iterables(returning_cols))

        # within_columns_clause =False so that labels (foo AS bar) don't render
        columns = [self.process(c, within_columns_clause=False, result_map=self.result_map) for c in columnlist]

        binds = [create_out_param(c, i) for i, c in enumerate(columnlist)]

        return "RETURNING " + ", ".join(columns) + " INTO " + ", ".join(binds)
开发者ID:pszafer,项目名称:dlna_upnp_invention,代码行数:14,代码来源:base.py

示例5: returning_clause

    def returning_clause(self, stmt, returning_cols):
        columns = []
        binds = []
        for i, column in enumerate(expression._select_iterables(returning_cols)):
            if column.type._has_column_expression:
                col_expr = column.type.column_expression(column)
            else:
                col_expr = column
            outparam = sql.outparam("ret_%d" % i, type_=column.type)
            self.binds[outparam.key] = outparam
            binds.append(self.bindparam_string(self._truncate_bindparam(outparam)))
            columns.append(self.process(col_expr, within_columns_clause=False))
            self.result_map[outparam.key] = (
                outparam.key,
                (column, getattr(column, "name", None), getattr(column, "key", None)),
                column.type,
            )

        return "RETURNING " + ", ".join(columns) + " INTO " + ", ".join(binds)
开发者ID:redwallInteractive,项目名称:neighborfood,代码行数:19,代码来源:base.py

示例6: returning_clause

    def returning_clause(self, stmt, returning_cols):

        if self.isinsert or self.isupdate:
            target = stmt.table.alias("inserted")
        else:
            target = stmt.table.alias("deleted")

        adapter = sql_util.ClauseAdapter(target)

        def col_label(col):
            adapted = adapter.traverse(col)
            if isinstance(col, expression._Label):
                return adapted.label(c.key)
            else:
                return self.label_select_column(None, adapted, asfrom=False)

        columns = [
            self.process(col_label(c), within_columns_clause=True, result_map=self.result_map)
            for c in expression._select_iterables(returning_cols)
        ]
        return "OUTPUT " + ", ".join(columns)
开发者ID:hgroll,项目名称:yocto-autobuilder,代码行数:21,代码来源:base.py


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