]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Base mssql.DATETIMEOFFSET on DateTime
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 Nov 2019 15:09:54 +0000 (10:09 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 Nov 2019 15:09:54 +0000 (10:09 -0500)
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

doc/build/changelog/unreleased_14/4980.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py

diff --git a/doc/build/changelog/unreleased_14/4980.rst b/doc/build/changelog/unreleased_14/4980.rst
new file mode 100644 (file)
index 0000000..cfb827c
--- /dev/null
@@ -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.
+
index 261ebe5c2850623318f93e421bd2bf1ace5ec345..ded90c3487c806ab5a5a328292cb5f02ab21077e 100644 (file)
@@ -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