From 7210595a79cd33b3b0da48db2806856fe018f495 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 31 Dec 2019 11:53:07 -0500 Subject: Repair uncovered warning in persistnce.py; update versioning tests Repaired a warning in the ORM flush process that was not covered by test coverage when deleting objects that use the "version_id" feature. This warning is generally unreachable unless using a dialect that sets the "supports_sane_rowcount" flag to False, which is not typically the case however is possible for some MySQL configurations as well as older Firebird drivers, and likely some third party dialects. As part of this change, we would like to establish that versionining- related warnings are not expected to emit for the core set of test-covered dialects, and if they are we would like the check for warning emitted to be explicit, rather than an ignore. Fixes: #5068 Change-Id: Iee097554e43cbb54ced1be056635809e67cf30d6 --- lib/sqlalchemy/engine/default.py | 7 +++++++ lib/sqlalchemy/orm/persistence.py | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 7016adcf4..bfc6dfee8 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -271,6 +271,13 @@ class DefaultDialect(interfaces.Dialect): @property def supports_sane_rowcount_returning(self): + """True if this dialect supports sane rowcount even if RETURNING is + in use. + + For dialects that don't support RETURNING, this is synomous + with supports_sane_rowcount. + + """ return self.supports_sane_rowcount @classmethod diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py index 58c8bcc06..3ba4907df 100644 --- a/lib/sqlalchemy/orm/persistence.py +++ b/lib/sqlalchemy/orm/persistence.py @@ -1336,8 +1336,7 @@ def _emit_delete_statements( util.warn( "Dialect %s does not support deleted rowcount " "- versioning cannot be verified." - % connection.dialect.dialect_description, - stacklevel=12, + % connection.dialect.dialect_description ) connection.execute(statement, del_objects) else: -- cgit v1.2.1