|
10 | 10 |
|
11 | 11 | .. changelog:: |
12 | 12 | :version: 2.0.44 |
13 | | - :include_notes_from: unreleased_20 |
| 13 | + :released: October 10, 2025 |
| 14 | + |
| 15 | + .. change:: |
| 16 | + :tags: bug, sql |
| 17 | + :tickets: 12271 |
| 18 | + |
| 19 | + Improved the implementation of :meth:`.UpdateBase.returning` to use more |
| 20 | + robust logic in setting up the ``.c`` collection of a derived statement |
| 21 | + such as a CTE. This fixes issues related to RETURNING clauses that feature |
| 22 | + expressions based on returned columns with or without qualifying labels. |
| 23 | + |
| 24 | + .. change:: |
| 25 | + :tags: usecase, asyncio |
| 26 | + :tickets: 12273 |
| 27 | + |
| 28 | + Generalize the terminate logic employed by the asyncpg dialect to reuse |
| 29 | + it in the aiomysql and asyncmy dialect implementation. |
| 30 | + |
| 31 | + .. change:: |
| 32 | + :tags: bug, mssql |
| 33 | + :tickets: 12798 |
| 34 | + |
| 35 | + Improved the base implementation of the asyncio cursor such that it |
| 36 | + includes the option for the underlying driver's cursor to be actively |
| 37 | + closed in those cases where it requires ``await`` in order to complete the |
| 38 | + close sequence, rather than relying on garbage collection to "close" it, |
| 39 | + when a plain :class:`.Result` is returned that does not use ``await`` for |
| 40 | + any of its methods. The previous approach of relying on gc was fine for |
| 41 | + MySQL and SQLite dialects but has caused problems with the aioodbc |
| 42 | + implementation on top of SQL Server. The new option is enabled |
| 43 | + for those dialects which have an "awaitable" ``cursor.close()``, which |
| 44 | + includes the aioodbc, aiomysql, and asyncmy dialects (aiosqlite is also |
| 45 | + modified for 2.1 only). |
| 46 | + |
| 47 | + .. change:: |
| 48 | + :tags: bug, ext |
| 49 | + :tickets: 12802 |
| 50 | + |
| 51 | + Fixed issue caused by an unwanted functional change while typing |
| 52 | + the :class:`.MutableList` class. |
| 53 | + This change also reverts all other functional changes done in |
| 54 | + the same change. |
| 55 | + |
| 56 | + .. change:: |
| 57 | + :tags: bug, typing |
| 58 | + :tickets: 12813 |
| 59 | + |
| 60 | + Fixed typing bug where the :meth:`.Session.execute` method advertised that |
| 61 | + it would return a :class:`.CursorResult` if given an insert/update/delete |
| 62 | + statement. This is not the general case as several flavors of ORM |
| 63 | + insert/update do not actually yield a :class:`.CursorResult` which cannot |
| 64 | + be differentiated at the typing overload level, so the method now yields |
| 65 | + :class:`.Result` in all cases. For those cases where |
| 66 | + :class:`.CursorResult` is known to be returned and the ``.rowcount`` |
| 67 | + attribute is required, please use ``typing.cast()``. |
| 68 | + |
| 69 | + .. change:: |
| 70 | + :tags: usecase, orm |
| 71 | + :tickets: 12829 |
| 72 | + |
| 73 | + The way ORM Annotated Declarative interprets Python :pep:`695` type aliases |
| 74 | + in ``Mapped[]`` annotations has been refined to expand the lookup scheme. A |
| 75 | + :pep:`695` type can now be resolved based on either its direct presence in |
| 76 | + :paramref:`_orm.registry.type_annotation_map` or its immediate resolved |
| 77 | + value, as long as a recursive lookup across multiple :pep:`695` types is |
| 78 | + not required for it to resolve. This change reverses part of the |
| 79 | + restrictions introduced in 2.0.37 as part of :ticket:`11955`, which |
| 80 | + deprecated (and disallowed in 2.1) the ability to resolve any :pep:`695` |
| 81 | + type that was not explicitly present in |
| 82 | + :paramref:`_orm.registry.type_annotation_map`. Recursive lookups of |
| 83 | + :pep:`695` types remains deprecated in 2.0 and disallowed in version 2.1, |
| 84 | + as do implicit lookups of ``NewType`` types without an entry in |
| 85 | + :paramref:`_orm.registry.type_annotation_map`. |
| 86 | + |
| 87 | + Additionally, new support has been added for generic :pep:`695` aliases that |
| 88 | + refer to :pep:`593` ``Annotated`` constructs containing |
| 89 | + :func:`_orm.mapped_column` configurations. See the sections below for |
| 90 | + examples. |
| 91 | + |
| 92 | + .. seealso:: |
| 93 | + |
| 94 | + :ref:`orm_declarative_type_map_pep695_types` |
| 95 | + |
| 96 | + :ref:`orm_declarative_mapped_column_generic_pep593` |
| 97 | + |
| 98 | + .. change:: |
| 99 | + :tags: bug, postgresql |
| 100 | + :tickets: 12847 |
| 101 | + |
| 102 | + Fixed issue where selecting an enum array column containing NULL values |
| 103 | + would fail to parse properly in the PostgreSQL dialect. The |
| 104 | + :func:`._split_enum_values` function now correctly handles NULL entries by |
| 105 | + converting them to Python ``None`` values. |
| 106 | + |
| 107 | + .. change:: |
| 108 | + :tags: bug, typing |
| 109 | + :tickets: 12855 |
| 110 | + |
| 111 | + Added new decorator :func:`_orm.mapped_as_dataclass`, which is a function |
| 112 | + based form of :meth:`_orm.registry.mapped_as_dataclass`; the method form |
| 113 | + :meth:`_orm.registry.mapped_as_dataclass` does not seem to be correctly |
| 114 | + recognized within the scope of :pep:`681` in recent mypy versions. |
| 115 | + |
| 116 | + .. change:: |
| 117 | + :tags: bug, sqlite |
| 118 | + :tickets: 12864 |
| 119 | + |
| 120 | + Fixed issue where SQLite table reflection would fail for tables using |
| 121 | + ``WITHOUT ROWID`` and/or ``STRICT`` table options when the table contained |
| 122 | + generated columns. The regular expression used to parse ``CREATE TABLE`` |
| 123 | + statements for generated column detection has been updated to properly |
| 124 | + handle these SQLite table options that appear after the column definitions. |
| 125 | + Pull request courtesy Tip ten Brink. |
| 126 | + |
| 127 | + .. change:: |
| 128 | + :tags: bug, postgresql |
| 129 | + :tickets: 12874 |
| 130 | + |
| 131 | + Fixed issue where the :func:`_sql.any_` and :func:`_sql.all_` aggregation |
| 132 | + operators would not correctly coerce the datatype of the compared value, in |
| 133 | + those cases where the compared value were not a simple int/str etc., such |
| 134 | + as a Python ``Enum`` or other custom value. This would lead to execution |
| 135 | + time errors for these values. This issue is essentially the same as |
| 136 | + :ticket:`6515` which was for the now-legacy :meth:`.ARRAY.any` and |
| 137 | + :meth:`.ARRAY.all` methods. |
| 138 | + |
| 139 | + .. change:: |
| 140 | + :tags: bug, engine |
| 141 | + :tickets: 12881 |
| 142 | + |
| 143 | + Implemented initial support for free-threaded Python by adding new tests |
| 144 | + and reworking the test harness to include Python 3.13t and Python 3.14t in |
| 145 | + test runs. Two concurrency issues have been identified and fixed: the first |
| 146 | + involves initialization of the ``.c`` collection on a ``FromClause``, a |
| 147 | + continuation of :ticket:`12302`, where an optional mutex under |
| 148 | + free-threading is added; the second involves synchronization of the pool |
| 149 | + "first_connect" event, which first received thread synchronization in |
| 150 | + :ticket:`2964`, however under free-threading the creation of the mutex |
| 151 | + itself runs under the same free-threading mutex. Support for free-threaded |
| 152 | + wheels on Pypi is implemented as well within the 2.1 series only. Initial |
| 153 | + pull request and test suite courtesy Lysandros Nikolaou. |
| 154 | + |
| 155 | + .. change:: |
| 156 | + :tags: bug, schema |
| 157 | + :tickets: 12884 |
| 158 | + |
| 159 | + Fixed issue where :meth:`_schema.MetaData.reflect` did not forward |
| 160 | + dialect-specific keyword arguments to the :class:`_engine.Inspector` |
| 161 | + methods, causing options like ``oracle_resolve_synonyms`` to be ignored |
| 162 | + during reflection. The method now ensures that all extra kwargs passed to |
| 163 | + :meth:`_schema.MetaData.reflect` are forwarded to |
| 164 | + :meth:`_engine.Inspector.get_table_names` and related reflection methods. |
| 165 | + Pull request courtesy Lukáš Kožušník. |
| 166 | + |
| 167 | + .. change:: |
| 168 | + :tags: bug, mssql |
| 169 | + :tickets: 12894 |
| 170 | + |
| 171 | + Fixed issue where the index reflection for SQL Server would |
| 172 | + not correctly return the order of the column inside an index |
| 173 | + when the order of the columns in the index did not match the |
| 174 | + order of the columns in the table. |
| 175 | + Pull request courtesy of Allen Chen. |
| 176 | + |
| 177 | + .. change:: |
| 178 | + :tags: bug, orm |
| 179 | + :tickets: 12905 |
| 180 | + |
| 181 | + Fixed a caching issue where :func:`_orm.with_loader_criteria` would |
| 182 | + incorrectly reuse cached bound parameter values when used with |
| 183 | + :class:`_sql.CompoundSelect` constructs such as :func:`_sql.union`. The |
| 184 | + issue was caused by the cache key for compound selects not including the |
| 185 | + execution options that are part of the :class:`_sql.Executable` base class, |
| 186 | + which :func:`_orm.with_loader_criteria` uses to apply its criteria |
| 187 | + dynamically. The fix ensures that compound selects and other executable |
| 188 | + constructs properly include execution options in their cache key traversal. |
| 189 | + |
| 190 | + .. change:: |
| 191 | + :tags: bug, mssql, reflection |
| 192 | + :tickets: 12907 |
| 193 | + |
| 194 | + Fixed issue in the MSSQL dialect's foreign key reflection query where |
| 195 | + duplicate rows could be returned when a foreign key column and its |
| 196 | + referenced primary key column have the same name, and both the referencing |
| 197 | + and referenced tables have indexes with the same name. This resulted in an |
| 198 | + "ForeignKeyConstraint with duplicate source column references are not |
| 199 | + supported" error when attempting to reflect such tables. The query has been |
| 200 | + corrected to exclude indexes on the child table when looking for unique |
| 201 | + indexes referenced by foreign keys. |
| 202 | + |
| 203 | + .. change:: |
| 204 | + :tags: bug, platform |
| 205 | + |
| 206 | + Unblocked automatic greenlet installation for Python 3.14 now that |
| 207 | + there are greenlet wheels on pypi for python 3.14. |
14 | 208 |
|
15 | 209 | .. changelog:: |
16 | 210 | :version: 2.0.43 |
|
0 commit comments