SQL Server Key Word Issue

Issue #1310 resolved
Former user created an issue

'key' is a keyword/reserved word in mssql and it is not being properly escaped. Below is the diff of the change that I made and it resolved the issue I had:

Index: lib/sqlalchemy/databases/mssql.py
===================================================================
--- lib/sqlalchemy/databases/mssql.py   (revision 5780)
+++ lib/sqlalchemy/databases/mssql.py   (working copy)
@@ -249,7 +249,7 @@
 from decimal import Decimal as _python_Decimal


-MSSQL_RESERVED_WORDS = set(['function']('function'))
+MSSQL_RESERVED_WORDS = set(['key']('function',))


 class _StringType(object):

Comments (4)

  1. Michael Trier

    Yeah I actually have a fix for this I need to get in. SQL Server itself can tell us the keywords based on the version the user is using. Which is a much better solution than manually coming up with the list.

  2. Former user Account Deleted

    Thanks for the quick response. Is there anything that I can do to help with that?

  3. Log in to comment