]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added in MSSQL reserved words list. Fixes #1310
authorMichael Trier <mtrier@gmail.com>
Sun, 12 Apr 2009 02:12:41 +0000 (02:12 +0000)
committerMichael Trier <mtrier@gmail.com>
Sun, 12 Apr 2009 02:12:41 +0000 (02:12 +0000)
CHANGES
lib/sqlalchemy/databases/mssql.py

diff --git a/CHANGES b/CHANGES
index 6a5189399d50190078cea4a50d2032a233753b2f..8d09876612433306980f193b7d39bc69336596d9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -57,6 +57,9 @@ CHANGES
       construct (i.e. declarative columns).  [ticket:1353]
 
 - mssql
+    - Added in reserved words for MSSQL that covers version 2008
+      and all prior versions. [ticket:1310]
+
     - Corrected problem with information schema not working with a
       binary collation based database. Cleaned up information schema
       since it is only used by mssql now. [ticket:1343]
index 396e8dd24107aa8ba3a242975e8515e7dc39861a..0442ddfcaf5f97ee21525f8e5686af6be57f3e51 100644 (file)
@@ -249,7 +249,36 @@ from sqlalchemy import types as sqltypes
 from decimal import Decimal as _python_Decimal
 
 
-MSSQL_RESERVED_WORDS = set(['function'])
+RESERVED_WORDS = set(
+    ['add', 'all', 'alter', 'and', 'any', 'as', 'asc', 'authorization',
+     'backup', 'begin', 'between', 'break', 'browse', 'bulk', 'by', 'cascade',
+     'case', 'check', 'checkpoint', 'close', 'clustered', 'coalesce',
+     'collate', 'column', 'commit', 'compute', 'constraint', 'contains',
+     'containstable', 'continue', 'convert', 'create', 'cross', 'current',
+     'current_date', 'current_time', 'current_timestamp', 'current_user',
+     'cursor', 'database', 'dbcc', 'deallocate', 'declare', 'default',
+     'delete', 'deny', 'desc', 'disk', 'distinct', 'distributed', 'double',
+     'drop', 'dump', 'else', 'end', 'errlvl', 'escape', 'except', 'exec',
+     'execute', 'exists', 'exit', 'external', 'fetch', 'file', 'fillfactor',
+     'for', 'foreign', 'freetext', 'freetexttable', 'from', 'full',
+     'function', 'goto', 'grant', 'group', 'having', 'holdlock', 'identity',
+     'identity_insert', 'identitycol', 'if', 'in', 'index', 'inner', 'insert',
+     'intersect', 'into', 'is', 'join', 'key', 'kill', 'left', 'like',
+     'lineno', 'load', 'merge', 'national', 'nocheck', 'nonclustered', 'not',
+     'null', 'nullif', 'of', 'off', 'offsets', 'on', 'open', 'opendatasource',
+     'openquery', 'openrowset', 'openxml', 'option', 'or', 'order', 'outer',
+     'over', 'percent', 'pivot', 'plan', 'precision', 'primary', 'print',
+     'proc', 'procedure', 'public', 'raiserror', 'read', 'readtext',
+     'reconfigure', 'references', 'replication', 'restore', 'restrict',
+     'return', 'revert', 'revoke', 'right', 'rollback', 'rowcount',
+     'rowguidcol', 'rule', 'save', 'schema', 'securityaudit', 'select',
+     'session_user', 'set', 'setuser', 'shutdown', 'some', 'statistics',
+     'system_user', 'table', 'tablesample', 'textsize', 'then', 'to', 'top',
+     'tran', 'transaction', 'trigger', 'truncate', 'tsequal', 'union',
+     'unique', 'unpivot', 'update', 'updatetext', 'use', 'user', 'values',
+     'varying', 'view', 'waitfor', 'when', 'where', 'while', 'with',
+     'writetext',
+    ])
 
 
 class _StringType(object):
@@ -1724,7 +1753,7 @@ class MSSQLSchemaDropper(compiler.SchemaDropper):
 
 
 class MSSQLIdentifierPreparer(compiler.IdentifierPreparer):
-    reserved_words = compiler.IdentifierPreparer.reserved_words.union(MSSQL_RESERVED_WORDS)
+    reserved_words = RESERVED_WORDS
 
     def __init__(self, dialect):
         super(MSSQLIdentifierPreparer, self).__init__(dialect, initial_quote='[', final_quote=']')