]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix changelog for types, add date rendering to whatsnew
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Dec 2022 16:10:02 +0000 (11:10 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Dec 2022 16:10:02 +0000 (11:10 -0500)
this change is likely somehting people want to see so make
it more prominent, also there's no "types" category in changelog
so these should be "sql".

Change-Id: I9104c210448f3ba0304f1e09d0613240fe8dcf4e
References: #8998

doc/build/changelog/changelog_20.rst
doc/build/changelog/unreleased_14/8989.rst
doc/build/changelog/whatsnew_20.rst

index 5b3e83750ff7939f3b4f0371792f47a55aeac566..11220ba4297e17a84792eb36feb98ab7057974c5 100644 (file)
         also gains the same capability using native cx_Oracle or OracleDB features.
 
     .. change::
-        :tags: bug, pool
+        :tags: bug, engine
         :tickets: 8523
 
         The :class:`_pool.QueuePool` now ignores ``max_overflow`` when
         that of psycopg2 or most MySQL dialects.
 
     .. change::
-        :tags: feature, types
+        :tags: feature, sql
         :tickets: 7212
 
         Added new backend-agnostic :class:`_types.Uuid` datatype generalized from
         accompany the existing ``def visit_concat_op_binary()`` method.
 
     .. change::
-        :tags: feature, types
+        :tags: feature, sql
         :tickets: 5465
 
         Added :class:`.Double`, :class:`.DOUBLE`, :class:`.DOUBLE_PRECISION`
             :ref:`change_7086`
 
     .. change::
-        :tags: usecase, datatypes
+        :tags: usecase, sql
         :tickets: 5052
 
         Added modified ISO-8601 rendering (i.e. ISO-8601 with the T converted to a
         Previously this rendering was not implemented for dialect-specific
         compilation.
 
+        .. seealso::
+
+            :ref:`change_5052`
+
     .. change::
         :tags: removed, engine
         :tickets: 7258
         cx_Oracle 7 is now the minimum version for cx_Oracle.
 
     .. change::
-        :tags: bug, types
+        :tags: bug, sql
         :tickets: 7551
 
         Python string values for which a SQL type is determined from the type of
index 4c38fdf0190cc0e379d12c27b58b650e340652d9..2287bec7b4df905269d3222638471be5affb625c 100644 (file)
@@ -1,5 +1,5 @@
 .. change::
-    :tags: bug, types
+    :tags: bug, sql
     :tickets: 8989
     :versions: 2.0.0b5
 
index d141ea7a07bb1f0a8ddef7484a49824c05121850..8c23c24cd989d359edaafcb819998e407668854d 100644 (file)
@@ -1546,6 +1546,53 @@ backend::
 
 :ticket:`7631`
 
+.. _change_5052:
+
+DATE, TIME, DATETIME datatypes now support literal rendering on all backends
+-----------------------------------------------------------------------------
+
+Literal rendering is now implemented for date and time types for backend
+specific compilation, including PostgreSQL and Oracle::
+
+    >>> import datetime
+
+    >>> from sqlalchemy import DATETIME
+    >>> from sqlalchemy import literal
+    >>> from sqlalchemy.dialects import oracle
+    >>> from sqlalchemy.dialects import postgresql
+
+    >>> date_literal = literal(datetime.datetime.now(), DATETIME)
+
+    >>> print(
+    ...     date_literal.compile(
+    ...         dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True}
+    ...     )
+    ... )
+    '2022-12-17 11:02:13.575789'
+
+    >>> print(
+    ...     date_literal.compile(
+    ...         dialect=oracle.dialect(), compile_kwargs={"literal_binds": True}
+    ...     )
+    ... )
+    TO_TIMESTAMP('2022-12-17 11:02:13.575789', 'YYYY-MM-DD HH24:MI:SS.FF')
+
+Previously, such literal rendering only worked when stringifying statements
+without any dialect given; when attempting to render with a dialect-specific
+type, a ``NotImplementedError`` would be raised, up until
+SQLAlchemy 1.4.45 where this became a :class:`.CompileError` (part of
+:ticket:`8800`).
+
+The default rendering is modified ISO-8601 rendering (i.e. ISO-8601 with the T
+converted to a space) when using ``literal_binds`` with the SQL compilers
+provided by the PostgreSQL, MySQL, MariaDB, MSSQL, Oracle dialects. For Oracle,
+the ISO format is wrapped inside of an appropriate TO_DATE() function call.
+The rendering for SQLite is unchanged as this dialect always included string
+rendering for date values.
+
+
+
+:ticket:`5052`
 
 .. _change_8710: