summaryrefslogtreecommitdiff
path: root/alembic/runtime
diff options
context:
space:
mode:
authorKe Zhu <kzhu@us.ibm.com>2020-02-28 16:00:57 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-03-01 11:14:58 -0500
commit5287da2b69ec7e091d8d796161c391f6a90678f7 (patch)
tree341f1a698de0772ac42ad203062836d01eda2c8d /alembic/runtime
parentdfc4c550614928172ef31df3e97b73a05b985012 (diff)
downloadalembic-5287da2b69ec7e091d8d796161c391f6a90678f7.tar.gz
Respects ResultProxy.supports_sane_rowcount()
The check for matched rowcount when the alembic_version table is updated or deleted from is now conditional based on whether or not the dialect supports the concept of "rowcount" for UPDATE or DELETE rows matched. Some third party dialects do not support this concept. Pull request courtesy Ke Zhu. Closes: #667 Pull-request: https://github.com/sqlalchemy/alembic/pull/667 Pull-request-sha: a0d45ed0f5de582314faae2210eeec881670488e Change-Id: I09c9b540d8e21a94728085270eb20ba2273cbdb1
Diffstat (limited to 'alembic/runtime')
-rw-r--r--alembic/runtime/migration.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/alembic/runtime/migration.py b/alembic/runtime/migration.py
index 0a1e646..49eef71 100644
--- a/alembic/runtime/migration.py
+++ b/alembic/runtime/migration.py
@@ -676,7 +676,11 @@ class HeadMaintainer(object):
== literal_column("'%s'" % version)
)
)
- if not self.context.as_sql and ret.rowcount != 1:
+ if (
+ not self.context.as_sql
+ and self.context.dialect.supports_sane_rowcount
+ and ret.rowcount != 1
+ ):
raise util.CommandError(
"Online migration expected to match one "
"row when deleting '%s' in '%s'; "
@@ -697,7 +701,11 @@ class HeadMaintainer(object):
== literal_column("'%s'" % from_)
)
)
- if not self.context.as_sql and ret.rowcount != 1:
+ if (
+ not self.context.as_sql
+ and self.context.dialect.supports_sane_rowcount
+ and ret.rowcount != 1
+ ):
raise util.CommandError(
"Online migration expected to match one "
"row when updating '%s' to '%s' in '%s'; "