From 3757c0cdfb1c5078c8829abe3f6a995126de8ce6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 26 Jan 2017 16:54:02 -0500 Subject: Don't check isolation level prior to SQL Server 2005 Added a version check to the "get_isolation_level" feature, which is invoked upon first connect, so that it skips for SQL Server version 2000, as the necessary system view is not available prior to SQL Server 2005. Change-Id: If4f860513f0aae6625803f449714aedfc5075f57 Fixes: #3898 --- lib/sqlalchemy/dialects/mssql/base.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 3e16e6e35..6975754c6 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1685,6 +1685,10 @@ class MSDialect(default.DefaultDialect): cursor.close() def get_isolation_level(self, connection): + if self.server_version_info < MS_2005_VERSION: + raise NotImplementedError( + "Can't fetch isolation level prior to SQL Server 2005") + cursor = connection.cursor() cursor.execute(""" SELECT CASE transaction_isolation_level -- cgit v1.2.1