diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-01-26 16:54:02 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-01-26 16:54:02 -0500 |
| commit | 3757c0cdfb1c5078c8829abe3f6a995126de8ce6 (patch) | |
| tree | 6022d2ec9e243aed0837136fb2c63d474c00c816 | |
| parent | a24801ae8de469f1e78bdb0c02b28de263c2310e (diff) | |
| download | sqlalchemy-3757c0cdfb1c5078c8829abe3f6a995126de8ce6.tar.gz | |
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
| -rw-r--r-- | doc/build/changelog/changelog_11.rst | 9 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst index a969d616f..33eca2eca 100644 --- a/doc/build/changelog/changelog_11.rst +++ b/doc/build/changelog/changelog_11.rst @@ -21,6 +21,15 @@ .. changelog:: :version: 1.1.6 + .. change:: 3898 + :tags: bug, mssql + :tickets: 3898 + + 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:: 3893 :tags: bug, orm :tickets: 3893 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 |
