From b9b1e374bfbcece8259a4df5372ca68d45aaaf01 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 31 Aug 2017 13:12:50 -0400 Subject: Add new sane_rowcount_w_returning flag Added a new class of "rowcount support" for dialects that is specific to when "RETURNING", which on SQL Server looks like "OUTPUT inserted", is in use, as the PyODBC backend isn't able to give us rowcount on an UPDATE or DELETE statement when OUTPUT is in effect. This primarily affects the ORM when a flush is updating a row that contains server-calcluated values, raising an error if the backend does not return the expected row count. PyODBC now states that it supports rowcount except if OUTPUT.inserted is present, which is taken into account by the ORM during a flush as to whether it will look for a rowcount. ORM tests are implicit in existing tests run against PyODBC Fixes: #4062 Change-Id: Iff17cbe4c7a5742971ed85a4d58660c18cc569c2 --- lib/sqlalchemy/engine/default.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/sqlalchemy/engine') diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index d1b54ab01..8b72c0001 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -249,6 +249,10 @@ class DefaultDialect(interfaces.Dialect): def dialect_description(self): return self.name + "+" + self.driver + @property + def supports_sane_rowcount_returning(self): + return self.supports_sane_rowcount + @classmethod def get_pool_class(cls, url): return getattr(cls, 'poolclass', pool.QueuePool) -- cgit v1.2.1