diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-08-31 13:34:43 -0400 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2021-09-02 14:01:56 +0000 |
commit | bf1fe670513abeb1596bc5266f50db1ffe62f3bd (patch) | |
tree | 95509c88bfe615271d5953db74b019ec7fb37b79 /lib/sqlalchemy/engine/default.py | |
parent | a4fc07fae69aa130fc032e7b5204f2e1fe3acaa3 (diff) | |
download | sqlalchemy-bf1fe670513abeb1596bc5266f50db1ffe62f3bd.tar.gz |
Fix and test sequences w/ executemany in pre-exec scenarios
Fixed issue where an engine that had ``implicit_returning`` set to False
would fail to function when PostgreSQL's "fast insertmany" feature were
used in conjunction with a ``Sequence``, as well as if any kind of
"executemany" with "return_defaults()" were used in conjunction with a
``Sequence``. Note that PostgreSQL "fast insertmany" uses "RETURNING" by
definition, when the SQL statement is passed to the driver; overall, the
``implicit_returning`` flag is legacy and has no real use in modern
SQLAlchemy, and will be deprecated in a separate change.
Fixes: #6963
Change-Id: Id8e3dd50a21b9124f338067b0fdb57b8f608dca8
Diffstat (limited to 'lib/sqlalchemy/engine/default.py')
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 8d6f40ff6..8bd8a121b 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -1835,8 +1835,9 @@ class DefaultExecutionContext(interfaces.ExecutionContext): # to avoid many calls of get_insert_default()/ # get_update_default() for c in insert_prefetch: - if c.default and c.default.is_scalar: + if c.default and not c.default.is_sequence and c.default.is_scalar: scalar_defaults[c] = c.default.arg + for c in update_prefetch: if c.onupdate and c.onupdate.is_scalar: scalar_defaults[c] = c.onupdate.arg |