]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- clarify documentation on timezone flag, since Oracle has both
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 22 Sep 2016 15:08:09 +0000 (11:08 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 22 Sep 2016 15:08:09 +0000 (11:08 -0400)
DATE / TIMESTAMP separately the timezone flag will not bump the
type to TIMESTAMP WITH TIMEZONE on that backend.

Change-Id: I185992093472e1620b8cf84872631a4d48f8edc3

doc/build/core/type_basics.rst
lib/sqlalchemy/sql/sqltypes.py

index 9edba0061c90d1c94a26130468cda1fbbfcf6856..e4f5c74c25943d77b844a55f767aaeb62aa008c5 100644 (file)
@@ -173,6 +173,7 @@ its exact name in DDL with ``CREATE TABLE`` is issued.
 
 
 .. autoclass:: TIMESTAMP
+    :members:
 
 
 .. autoclass:: VARBINARY
index b55d435ad02ba74691c997dd41b06152a5629a8e..66e5f3e93775bb876bba6791264986faf7f37e08 100644 (file)
@@ -735,6 +735,13 @@ class DateTime(_DateAffinity, TypeEngine):
     SQLite, date and time types are stored as strings which are then
     converted back to datetime objects when rows are returned.
 
+    For the time representation within the datetime type, some
+    backends include additional options, such as timezone support and
+    fractional seconds support.  For fractional seconds, use the
+    dialect-specific datatype, such as :class:`.mysql.TIME`.  For
+    timezone support, use at least the :class:`~.types.TIMESTAMP` datatype,
+    if not the dialect-specific datatype object.
+
     """
 
     __visit_name__ = 'datetime'
@@ -742,10 +749,14 @@ class DateTime(_DateAffinity, TypeEngine):
     def __init__(self, timezone=False):
         """Construct a new :class:`.DateTime`.
 
-        :param timezone: boolean.  If True, and supported by the
-         backend, will produce 'TIMESTAMP WITH TIMEZONE'. For backends
-         that don't support timezone aware timestamps, has no
-         effect.
+        :param timezone: boolean.  Indicates that the datetime type should
+         enable timezone support, if available on the
+         **base date/time-holding type only**.   It is recommended
+         to make use of the :class:`~.types.TIMESTAMP` datatype directly when
+         using this flag, as some databases include separate generic
+         date/time-holding types distinct from the timezone-capable
+         TIMESTAMP datatype, such as Oracle.
+
 
         """
         self.timezone = timezone
@@ -2229,10 +2240,30 @@ class BIGINT(BigInteger):
 
 class TIMESTAMP(DateTime):
 
-    """The SQL TIMESTAMP type."""
+    """The SQL TIMESTAMP type.
+
+    :class:`~.types.TIMESTAMP` datatypes have support for timezone
+    storage on some backends, such as Postgresql and Oracle.  Use the
+    :paramref:`~types.TIMESTAMP.timezone` argument in order to enable
+    "TIMESTAMP WITH TIMEZONE" for these backends.
+
+    """
 
     __visit_name__ = 'TIMESTAMP'
 
+    def __init__(self, timezone=False):
+        """Construct a new :class:`.TIMESTAMP`.
+
+        :param timezone: boolean.  Indicates that the TIMESTAMP type should
+         enable timezone support, if available on the target database.
+         On a per-dialect basis is similar to "TIMESTAMP WITH TIMEZONE".
+         If the target database does not support timezones, this flag is
+         ignored.
+
+
+        """
+        super(TIMESTAMP, self).__init__(timezone=timezone)
+
     def get_dbapi_type(self, dbapi):
         return dbapi.TIMESTAMP