diff options
| -rw-r--r-- | CHANGES | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/databases/mssql.py | 10 |
2 files changed, 12 insertions, 4 deletions
@@ -27,9 +27,9 @@ CHANGES ILIKE on postgres, lower(x) LIKE lower(y) on all others. [ticket:727] - - Added "now()" as a generic function; on SQLite and Oracle - compiles as "CURRENT_TIMESTAMP"; "now()" on all others - [ticket:943] + - Added "now()" as a generic function; on SQLite, Oracle + and MSSQL compiles as "CURRENT_TIMESTAMP"; "now()" on + all others. [ticket:943] - The startswith(), endswith(), and contains() operators now concatenate the wildcard operator with the given operand in diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 6063e8469..b9706da74 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -41,11 +41,12 @@ Known issues / TODO: import datetime, operator, random, re, sys from sqlalchemy import sql, schema, exceptions, util -from sqlalchemy.sql import compiler, expression, operators as sqlops +from sqlalchemy.sql import compiler, expression, operators as sqlops, functions as sql_functions from sqlalchemy.engine import default, base from sqlalchemy import types as sqltypes from sqlalchemy.util import Decimal as _python_Decimal + MSSQL_RESERVED_WORDS = util.Set(['function']) class MSNumeric(sqltypes.Numeric): @@ -874,6 +875,13 @@ class MSSQLCompiler(compiler.DefaultCompiler): operators = compiler.OPERATORS.copy() operators[sqlops.concat_op] = '+' + functions = compiler.DefaultCompiler.functions.copy() + functions.update ( + { + sql_functions.now: 'CURRENT_TIMESTAMP' + } + ) + def __init__(self, *args, **kwargs): super(MSSQLCompiler, self).__init__(*args, **kwargs) self.tablealiases = {} |
