diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-04-04 10:13:23 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-04-07 10:47:53 -0400 |
| commit | 2acc9ec1281b2818bd44804f040d94ec46215688 (patch) | |
| tree | 40e77ef66a8682b4a1d885575412a78152806397 /lib/sqlalchemy/dialects/postgresql | |
| parent | 3b4d62f4f72e8dfad7f38db192a6a90a8551608c (diff) | |
| download | sqlalchemy-2acc9ec1281b2818bd44804f040d94ec46215688.tar.gz | |
cx_Oracle modernize
Full "RETURNING" support is implemented for the cx_Oracle dialect, meaning
multiple RETURNING rows are now recived for DML statements that produce
more than one row for RETURNING.
cx_Oracle 7 is now the minimum version for cx_Oracle.
Getting Oracle to do multirow returning took about 5 minutes. however,
getting Oracle's RETURNING system to integrate with ORM-enabled
insert, update, delete, is a big deal because that architecture wasn't
really working very robustly, including some recent changes in 1.4
for FromStatement were done in a hurry, so this patch also cleans up
the FromStatement situation and begins to establish it more concretely
as the base for all ReturnsRows / TextClause ORM scenarios.
Fixes: #6245
Change-Id: I2b4e6007affa51ce311d2d5baa3917f356ab961f
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/psycopg2.py | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 9bfde4768..999452804 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2401,10 +2401,11 @@ class PGCompiler(compiler.SQLCompiler): return tmp - def returning_clause(self, stmt, returning_cols): - + def returning_clause( + self, stmt, returning_cols, *, populate_result_map, **kw + ): columns = [ - self._label_returning_column(stmt, c) + self._label_returning_column(stmt, c, populate_result_map) for c in expression._select_iterables(returning_cols) ] diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 391368c5f..07783ced7 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -478,7 +478,7 @@ class PGExecutionContext_psycopg2(_PGExecutionContext_common_psycopg): if ( self._psycopg2_fetched_rows and self.compiled - and self.compiled.returning + and self.compiled.effective_returning ): # psycopg2 execute_values will provide for a real cursor where # cursor.description works correctly. however, it executes the @@ -736,7 +736,7 @@ class PGDialect_psycopg2(_PGDialect_common_psycopg): statement, parameters, template=executemany_values, - fetch=bool(context.compiled.returning), + fetch=bool(context.compiled.effective_returning), **kwargs, ) |
