From: Mike Bayer Date: Mon, 14 Jul 2014 23:16:11 +0000 (-0400) Subject: - Fixed a regression from 0.9.5 caused by :ticket:`3025` where the X-Git-Tag: rel_1_0_0b1~317 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fd0bc7c62849a1dc34ca7d93aeeaaff25897648;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed a regression from 0.9.5 caused by :ticket:`3025` where the query used to determine "default schema" is invalid in SQL Server 2000. For SQL Server 2000 we go back to defaulting to the "schema name" parameter of the dialect, which is configurable but defaults to 'dbo'. fixes #3025 --- diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst index a2fc84b120..8be2346f6e 100644 --- a/doc/build/changelog/changelog_09.rst +++ b/doc/build/changelog/changelog_09.rst @@ -14,6 +14,16 @@ :version: 0.9.7 :released: + .. change:: + :tags: bug, mssql + :tickets: 3025 + + Fixed a regression from 0.9.5 caused by :ticket:`3025` where the + query used to determine "default schema" is invalid in SQL Server 2000. + For SQL Server 2000 we go back to defaulting to the "schema name" + parameter of the dialect, which is configurable but defaults + to 'dbo'. + .. change:: :tags: bug, orm :tickets: 3083, 2736 diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index eebd35405b..473f7df06d 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1365,6 +1365,9 @@ class MSDialect(default.DefaultDialect): self.supports_multivalues_insert = True def _get_default_schema_name(self, connection): + if self.server_version_info < MS_2005_VERSION: + return self.schema_name + query = sql.text(""" SELECT default_schema_name FROM sys.database_principals