From: Mike Bayer Date: Fri, 5 Feb 2021 14:34:25 +0000 (-0500) Subject: Precede sp_columns with EXEC X-Git-Tag: rel_1_3_24~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=146efafcb436660e7891d3b34d05cd794c45268d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Precede sp_columns with EXEC Fixed issue regarding SQL Server reflection for older SQL Server 2005 version, a call to sp_columns would not proceed correctly without being prefixed with the EXEC keyword. This method is not used in current 1.4 series. Fixes: #5921 Change-Id: I2ffcda97d570879719ec5c1ea9fb7507dc87756f --- diff --git a/doc/build/changelog/unreleased_13/5921.rst b/doc/build/changelog/unreleased_13/5921.rst new file mode 100644 index 0000000000..90600a4bd8 --- /dev/null +++ b/doc/build/changelog/unreleased_13/5921.rst @@ -0,0 +1,9 @@ +.. change:: + :tags: bug, mssql, reflection + :tickets: 5921 + + Fixed issue regarding SQL Server reflection for older SQL Server 2005 + version, a call to sp_columns would not proceed correctly without being + prefixed with the EXEC keyword. This method is not used in current 1.4 + series. + diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index bab3943247..22f3297308 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -17,7 +17,7 @@ External Dialects In addition to the above DBAPI layers with native SQLAlchemy support, there are third-party dialects for other DBAPI layers that are compatible with SQL Server. See the "External Dialects" list on the -:ref:`dialect_toplevel` page. +:ref:`dialect_toplevel` page. .. _mssql_identity: @@ -2750,7 +2750,7 @@ class MSDialect(default.DefaultDialect): # We also run an sp_columns to check for identity columns: cursor = connection.execute( sql.text( - "sp_columns @table_name = :table_name, " + "EXEC sp_columns @table_name = :table_name, " "@table_owner = :table_owner", ), {"table_name": tablename, "table_owner": owner},