]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Precede sp_columns with EXEC
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Feb 2021 14:34:25 +0000 (09:34 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Feb 2021 14:34:25 +0000 (09:34 -0500)
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

doc/build/changelog/unreleased_13/5921.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py

diff --git a/doc/build/changelog/unreleased_13/5921.rst b/doc/build/changelog/unreleased_13/5921.rst
new file mode 100644 (file)
index 0000000..90600a4
--- /dev/null
@@ -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.
+
index bab3943247c88690a71ee9bac82598b75b21eda3..22f3297308fd37a198de19cb1e44997cc8af3284 100644 (file)
@@ -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},