Python sqlalchemy.sql.expression._select_iterables() Examples

The following are 25 code examples of sqlalchemy.sql.expression._select_iterables(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy.sql.expression , or try the search function .
Example #1
Source File: zxjdbc.py    From Fluid-Designer with GNU General Public License v3.0 7 votes vote down vote up
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)
                   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) 
Example #2
Source File: base.py    From moviegrabber with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #3
Source File: zxjdbc.py    From jarvis with GNU General Public License v2.0 6 votes vote down vote up
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)
                   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) 
Example #4
Source File: base.py    From stdm with GNU General Public License v2.0 6 votes vote down vote up
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) 
Example #5
Source File: zxjdbc.py    From stdm with GNU General Public License v2.0 6 votes vote down vote up
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) 
Example #6
Source File: zxjdbc.py    From moviegrabber with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #7
Source File: base.py    From pyRevit with GNU General Public License v3.0 6 votes vote down vote up
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._add_to_result_map(
                outparam.key, outparam.key,
                (column, getattr(column, 'name', None),
                 getattr(column, 'key', None)),
                column.type
            )

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds) 
Example #8
Source File: zxjdbc.py    From pyRevit with GNU General Public License v3.0 6 votes vote down vote up
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)
                   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) 
Example #9
Source File: zxjdbc.py    From planespotter with MIT License 6 votes vote down vote up
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)
                   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) 
Example #10
Source File: zxjdbc.py    From android_universal with MIT License 6 votes vote down vote up
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)
                   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) 
Example #11
Source File: base.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
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._add_to_result_map(
                outparam.key, outparam.key,
                (column, getattr(column, 'name', None),
                 getattr(column, 'key', None)),
                column.type
            )

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds) 
Example #12
Source File: base.py    From jbox with MIT License 6 votes vote down vote up
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._add_to_result_map(
                outparam.key, outparam.key,
                (column, getattr(column, 'name', None),
                 getattr(column, 'key', None)),
                column.type
            )

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds) 
Example #13
Source File: zxjdbc.py    From jbox with MIT License 6 votes vote down vote up
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)
                   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) 
Example #14
Source File: base.py    From android_universal with MIT License 5 votes vote down vote up
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) 
Example #15
Source File: base.py    From android_universal with MIT License 5 votes vote down vote up
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._add_to_result_map(
                getattr(col_expr, 'name', col_expr.anon_label),
                getattr(col_expr, 'name', col_expr.anon_label),
                (column, getattr(column, 'name', None),
                 getattr(column, 'key', None)),
                column.type
            )

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds) 
Example #16
Source File: base.py    From jbox with MIT License 5 votes vote down vote up
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) 
Example #17
Source File: base.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #18
Source File: base.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
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._add_to_result_map(
                getattr(col_expr, 'name', col_expr.anon_label),
                getattr(col_expr, 'name', col_expr.anon_label),
                (column, getattr(column, 'name', None),
                 getattr(column, 'key', None)),
                column.type
            )

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds) 
Example #19
Source File: base.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #20
Source File: base.py    From sqlalchemy with MIT License 5 votes vote down vote up
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) 
Example #21
Source File: base.py    From stdm with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #22
Source File: base.py    From pyRevit with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #23
Source File: base.py    From planespotter with MIT License 5 votes vote down vote up
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._add_to_result_map(
                getattr(col_expr, 'name', col_expr.anon_label),
                getattr(col_expr, 'name', col_expr.anon_label),
                (column, getattr(column, 'name', None),
                 getattr(column, 'key', None)),
                column.type
            )

        return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds) 
Example #24
Source File: base.py    From planespotter with MIT License 5 votes vote down vote up
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) 
Example #25
Source File: base.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
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)