From: Mike Bayer Date: Wed, 13 Nov 2019 15:09:54 +0000 (-0500) Subject: Base mssql.DATETIMEOFFSET on DateTime X-Git-Tag: rel_1_4_0b1~622^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2644d4cb51ed580cb9c4eb3cb600a056a2c893a3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Base mssql.DATETIMEOFFSET on DateTime Fixed the base class of the :class:`.mssql.DATETIMEOFFSET` datatype to be based on the :class:`.DateTime` class hierarchy, as this is a datetime-holding datatype. Note however that at the moment the pyodbc driver has only limited support for this datatype and will not work with all ODBC drivers. References: https://github.com/mkleehammer/pyodbc/issues/134 Fixes: #4980 Change-Id: I946cf22642eea4beee2a605d91218c6fd817740c --- diff --git a/doc/build/changelog/unreleased_14/4980.rst b/doc/build/changelog/unreleased_14/4980.rst new file mode 100644 index 0000000000..cfb827c4db --- /dev/null +++ b/doc/build/changelog/unreleased_14/4980.rst @@ -0,0 +1,8 @@ +.. change:: + :tags: bug, mssql + :tickets: 4980 + + Fixed the base class of the :class:`.mssql.DATETIMEOFFSET` datatype to + be based on the :class:`.DateTime` class hierarchy, as this is a + datetime-holding datatype. + diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 261ebe5c28..ded90c3487 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1019,11 +1019,11 @@ class DATETIME2(_DateTimeBase, sqltypes.DateTime): self.precision = precision -# TODO: is this not an Interval ? -class DATETIMEOFFSET(sqltypes.TypeEngine): +class DATETIMEOFFSET(_DateTimeBase, sqltypes.DateTime): __visit_name__ = "DATETIMEOFFSET" - def __init__(self, precision=None, **kwargs): + def __init__(self, precision=None, **kw): + super(DATETIMEOFFSET, self).__init__(**kw) self.precision = precision