From: Mike Bayer Date: Sun, 5 Jun 2011 16:32:22 +0000 (-0400) Subject: - Fixed bug whereby DATETIME2 type would fail on X-Git-Tag: rel_0_6_8~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a34dc7eae523e182eba5329c753bee78010ea82;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed bug whereby DATETIME2 type would fail on the "adapt" step when used in result sets or bound parameters. This issue is not in 0.7. [ticket:2159] --- diff --git a/CHANGES b/CHANGES index 5fb4c8a218..dd304e3419 100644 --- a/CHANGES +++ b/CHANGES @@ -100,6 +100,11 @@ CHANGES applied to a schema-qualified table would leak into enclosing select statements [ticket:2169]. + - Fixed bug whereby DATETIME2 type would fail on + the "adapt" step when used in result sets or + bound parameters. This issue is not in 0.7. + [ticket:2159] + 0.6.7 ===== - orm diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 4f90070073..4c589a2a96 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -307,6 +307,7 @@ class DATETIME2(_DateTimeBase, sqltypes.DateTime): __visit_name__ = 'DATETIME2' def __init__(self, precision=None, **kwargs): + super(DATETIME2, self).__init__(**kwargs) self.precision = precision diff --git a/test/dialect/test_mssql.py b/test/dialect/test_mssql.py index 40ccdb86e2..17e8306ecc 100644 --- a/test/dialect/test_mssql.py +++ b/test/dialect/test_mssql.py @@ -1200,8 +1200,11 @@ class TypesTest(TestBase, AssertsExecutionResults, ComparesTables): type_, args, kw, res, requires = spec[0:5] if requires and testing._is_excluded('mssql', *requires) \ or not requires: - table_args.append(Column('c%s' % index, type_(*args, - **kw), nullable=None)) + c = Column('c%s' % index, type_(*args, + **kw), nullable=None) + testing.db.dialect.type_descriptor(c.type) + table_args.append(c) + dates_table = Table(*table_args) gen = testing.db.dialect.ddl_compiler(testing.db.dialect, schema.CreateTable(dates_table))