summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2017-05-22 16:25:20 -0400
committerGerrit Code Review <gerrit@awstats.zzzcomputing.com>2017-05-22 16:25:20 -0400
commit92f789eba4a46a5c33c807c2f02c45b03cf9ee79 (patch)
treea316e2c64039f7d6fd40f827e7dcea4d18de2228 /lib
parent9f0fb6c601829cb7c9f449d57e12e8b95dab51f5 (diff)
parent0a67c1305266ba9c4558e371fa9b193788c65bea (diff)
downloadsqlalchemy-92f789eba4a46a5c33c807c2f02c45b03cf9ee79.tar.gz
Merge "Detect no params w/ manual version_id counter and set to itself"
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/persistence.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index 588a1d696..86125d6f2 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -511,12 +511,19 @@ def _collect_update_commands(
continue
col = mapper.version_id_col
+ no_params = not params and not value_params
params[col._label] = update_version_id
if (bulk or col.key not in params) and \
mapper.version_id_generator is not False:
val = mapper.version_id_generator(update_version_id)
params[col.key] = val
+ elif mapper.version_id_generator is False and no_params:
+ # no version id generator, no values set on the table,
+ # and version id wasn't manually incremented.
+ # set version id to itself so we get an UPDATE
+ # statement
+ params[col.key] = update_version_id
elif not (params or value_params):
continue