From: Mike Bayer Date: Wed, 1 Feb 2023 17:11:59 +0000 (-0500) Subject: - 2.0.1 X-Git-Tag: rel_2_0_1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b5aacf114dbab663ef228aeee732dde9425de47;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - 2.0.1 --- diff --git a/doc/build/changelog/changelog_20.rst b/doc/build/changelog/changelog_20.rst index ae3b9eb342..c212ee9faa 100644 --- a/doc/build/changelog/changelog_20.rst +++ b/doc/build/changelog/changelog_20.rst @@ -10,7 +10,182 @@ .. changelog:: :version: 2.0.1 - :include_notes_from: unreleased_20 + :released: February 1, 2023 + + .. change:: + :tags: bug, typing + :tickets: 9174 + + Opened up typing on :paramref:`.Select.with_for_update.of` to also accept + table and mapped class arguments, as seems to be available for the MySQL + dialect. + + .. change:: + :tags: bug, orm, regression + :tickets: 9164 + + Fixed regression where ORM models that used joined table inheritance with a + composite foreign key would encounter an internal error in the mapper + internals. + + + + .. change:: + :tags: bug, sql + :tickets: 7664 + + Corrected the fix for :ticket:`7664`, released in version 2.0.0, to also + include :class:`.DropSchema` which was inadvertently missed in this fix, + allowing stringification without a dialect. The fixes for both constructs + is backported to the 1.4 series as of 1.4.47. + + + .. change:: + :tags: bug, orm + :tickets: 9175 + + Added support for :pep:`484` ``NewType`` to be used in the + :paramref:`_orm.registry.type_annotation_map` as well as within + :class:`.Mapped` constructs. These types will behave in the same way as + custom subclasses of types right now; they must appear explicitly within + the :paramref:`_orm.registry.type_annotation_map` to be mapped. + + .. change:: + :tags: bug, typing + :tickets: 9183 + + Fixed typing for limit/offset methods including :meth:`.Select.limit`, + :meth:`.Select.offset`, :meth:`_orm.Query.limit`, :meth:`_orm.Query.offset` + to allow ``None``, which is the documented API to "cancel" the current + limit/offset. + + + + .. change:: + :tags: bug, orm + :tickets: 9179 + + When using the :class:`.MappedAsDataclass` superclass, all classes within + the hierarchy that are subclasses of this class will now be run through the + ``@dataclasses.dataclass`` function whether or not they are actually + mapped, so that non-ORM fields declared on non-mapped classes within the + hierarchy will be used when mapped subclasses are turned into dataclasses. + This behavior applies both to intermediary classes mapped with + ``__abstract__ = True`` as well as to the user-defined declarative base + itself, assuming :class:`.MappedAsDataclass` is present as a superclass for + these classes. + + This allows non-mapped attributes such as ``InitVar`` declarations on + superclasses to be used, without the need to run the + ``@dataclasses.dataclass`` decorator explicitly on each non-mapped class. + The new behavior is considered as correct as this is what the :pep:`681` + implementation expects when using a superclass to indicate dataclass + behavior. + + .. change:: + :tags: bug, typing + :tickets: 9170 + + Fixed typing issue where :func:`_orm.mapped_column` objects typed as + :class:`_orm.Mapped` wouldn't be accepted in schema constraints such as + :class:`_schema.ForeignKey`, :class:`_schema.UniqueConstraint` or + :class:`_schema.Index`. + + .. change:: + :tags: bug, orm + :tickets: 9187 + + Added support for :pep:`586` ``Literal[]`` to be used in the + :paramref:`_orm.registry.type_annotation_map` as well as within + :class:`.Mapped` constructs. To use custom types such as these, they must + appear explicitly within the :paramref:`_orm.registry.type_annotation_map` + to be mapped. Pull request courtesy Frederik Aalund. + + As part of this change, the support for :class:`.sqltypes.Enum` in the + :paramref:`_orm.registry.type_annotation_map` has been expanded to include + support for ``Literal[]`` types consisting of string values to be used, + in addition to ``enum.Enum`` datatypes. If a ``Literal[]`` datatype + is used within ``Mapped[]`` that is not linked in + :paramref:`_orm.registry.type_annotation_map` to a specific datatype, + a :class:`.sqltypes.Enum` will be used by default. + + .. seealso:: + + :ref:`orm_declarative_mapped_column_enums` + + + .. change:: + :tags: bug, orm + :tickets: 9200 + + Fixed issue involving the use of :class:`.sqltypes.Enum` within the + :paramref:`_orm.registry.type_annotation_map` where the + :paramref:`_sqltypes.Enum.native_enum` parameter would not be correctly + copied to the mapped column datatype, if it were overridden + as stated in the documentation to set this parameter to False. + + + + .. change:: + :tags: bug, orm, regression + :tickets: 9171 + + Fixed regression in :class:`.DeclarativeBase` class where the registry's + default constructor would not be applied to the base itself, which is + different from how the previous :func:`_orm.declarative_base` construct + works. This would prevent a mapped class with its own ``__init__()`` method + from calling ``super().__init__()`` in order to access the registry's + default constructor and automatically populate attributes, instead hitting + ``object.__init__()`` which would raise a ``TypeError`` on any arguments. + + + + + .. change:: + :tags: bug, sql, regression + :tickets: 9173 + + Fixed regression related to the implementation for the new + "insertmanyvalues" feature where an internal ``TypeError`` would occur in + arrangements where a :func:`_sql.insert` would be referred towards inside + of another :func:`_sql.insert` via a CTE; made additional repairs for this + use case for positional dialects such as asyncpg when using + "insertmanyvalues". + + + + .. change:: + :tags: bug, typing + :tickets: 9156 + + Fixed typing for :meth:`_expression.ColumnElement.cast` to accept + both ``Type[TypeEngine[T]]`` and ``TypeEngine[T]``; previously + only ``TypeEngine[T]`` was accepted. Pull request courtesy Yurii Karabas. + + .. change:: + :tags: bug, orm + :tickets: 9177 + + Improved the ruleset used to interpret :pep:`593` ``Annotated`` types when + used with Annotated Declarative mapping, the inner type will be checked for + "Optional" in all cases which will be added to the criteria by which the + column is set as "nullable" or not; if the type within the ``Annotated`` + container is optional (or unioned with ``None``), the column will be + considered nullable if there are no explicit + :paramref:`_orm.mapped_column.nullable` parameters overriding it. + + .. change:: + :tags: bug, orm + :tickets: 9182 + + Improved the error reporting when linking strategy options from a base + class to another attribute that's off a subclass, where ``of_type()`` + should be used. Previously, when :meth:`.Load.options` is used, the message + would lack informative detail that ``of_type()`` should be used, which was + not the case when linking the options directly. The informative detail now + emits even if :meth:`.Load.options` is used. + + .. changelog:: :version: 2.0.0 diff --git a/doc/build/changelog/unreleased_20/7664_update.rst b/doc/build/changelog/unreleased_20/7664_update.rst deleted file mode 100644 index 8f6199e9e4..0000000000 --- a/doc/build/changelog/unreleased_20/7664_update.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. change:: - :tags: bug, sql - :tickets: 7664 - - Corrected the fix for :ticket:`7664`, released in version 2.0.0, to also - include :class:`.DropSchema` which was inadvertently missed in this fix, - allowing stringification without a dialect. The fixes for both constructs - is backported to the 1.4 series as of 1.4.47. - diff --git a/doc/build/changelog/unreleased_20/9156.rst b/doc/build/changelog/unreleased_20/9156.rst deleted file mode 100644 index 956d3ca33c..0000000000 --- a/doc/build/changelog/unreleased_20/9156.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. change:: - :tags: bug, typing - :tickets: 9156 - - Fixed typing for :meth:`_expression.ColumnElement.cast` to accept - both ``Type[TypeEngine[T]]`` and ``TypeEngine[T]``; previously - only ``TypeEngine[T]`` was accepted. Pull request courtesy Yurii Karabas. diff --git a/doc/build/changelog/unreleased_20/9164.rst b/doc/build/changelog/unreleased_20/9164.rst deleted file mode 100644 index b11a27fad3..0000000000 --- a/doc/build/changelog/unreleased_20/9164.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. change:: - :tags: bug, orm, regression - :tickets: 9164 - - Fixed regression where ORM models that used joined table inheritance with a - composite foreign key would encounter an internal error in the mapper - internals. - - diff --git a/doc/build/changelog/unreleased_20/9170.rst b/doc/build/changelog/unreleased_20/9170.rst deleted file mode 100644 index f891c2d4bc..0000000000 --- a/doc/build/changelog/unreleased_20/9170.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. change:: - :tags: bug, typing - :tickets: 9170 - - Fixed typing issue where :func:`_orm.mapped_column` objects typed as - :class:`_orm.Mapped` wouldn't be accepted in schema constraints such as - :class:`_schema.ForeignKey`, :class:`_schema.UniqueConstraint` or - :class:`_schema.Index`. diff --git a/doc/build/changelog/unreleased_20/9171.rst b/doc/build/changelog/unreleased_20/9171.rst deleted file mode 100644 index 2d8c914013..0000000000 --- a/doc/build/changelog/unreleased_20/9171.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. change:: - :tags: bug, orm, regression - :tickets: 9171 - - Fixed regression in :class:`.DeclarativeBase` class where the registry's - default constructor would not be applied to the base itself, which is - different from how the previous :func:`_orm.declarative_base` construct - works. This would prevent a mapped class with its own ``__init__()`` method - from calling ``super().__init__()`` in order to access the registry's - default constructor and automatically populate attributes, instead hitting - ``object.__init__()`` which would raise a ``TypeError`` on any arguments. - - - diff --git a/doc/build/changelog/unreleased_20/9173.rst b/doc/build/changelog/unreleased_20/9173.rst deleted file mode 100644 index 0e0f595201..0000000000 --- a/doc/build/changelog/unreleased_20/9173.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. change:: - :tags: bug, sql, regression - :tickets: 9173 - - Fixed regression related to the implementation for the new - "insertmanyvalues" feature where an internal ``TypeError`` would occur in - arrangements where a :func:`_sql.insert` would be referred towards inside - of another :func:`_sql.insert` via a CTE; made additional repairs for this - use case for positional dialects such as asyncpg when using - "insertmanyvalues". - - diff --git a/doc/build/changelog/unreleased_20/9174.rst b/doc/build/changelog/unreleased_20/9174.rst deleted file mode 100644 index 5f2442e6a8..0000000000 --- a/doc/build/changelog/unreleased_20/9174.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. change:: - :tags: bug, typing - :tickets: 9174 - - Opened up typing on :paramref:`.Select.with_for_update.of` to also accept - table and mapped class arguments, as seems to be available for the MySQL - dialect. diff --git a/doc/build/changelog/unreleased_20/9175.rst b/doc/build/changelog/unreleased_20/9175.rst deleted file mode 100644 index f79184931b..0000000000 --- a/doc/build/changelog/unreleased_20/9175.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. change:: - :tags: bug, orm - :tickets: 9175 - - Added support for :pep:`484` ``NewType`` to be used in the - :paramref:`_orm.registry.type_annotation_map` as well as within - :class:`.Mapped` constructs. These types will behave in the same way as - custom subclasses of types right now; they must appear explicitly within - the :paramref:`_orm.registry.type_annotation_map` to be mapped. diff --git a/doc/build/changelog/unreleased_20/9177.rst b/doc/build/changelog/unreleased_20/9177.rst deleted file mode 100644 index 86dc1ba65d..0000000000 --- a/doc/build/changelog/unreleased_20/9177.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. change:: - :tags: bug, orm - :tickets: 9177 - - Improved the ruleset used to interpret :pep:`593` ``Annotated`` types when - used with Annotated Declarative mapping, the inner type will be checked for - "Optional" in all cases which will be added to the criteria by which the - column is set as "nullable" or not; if the type within the ``Annotated`` - container is optional (or unioned with ``None``), the column will be - considered nullable if there are no explicit - :paramref:`_orm.mapped_column.nullable` parameters overriding it. diff --git a/doc/build/changelog/unreleased_20/9179.rst b/doc/build/changelog/unreleased_20/9179.rst deleted file mode 100644 index 489812cf75..0000000000 --- a/doc/build/changelog/unreleased_20/9179.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. change:: - :tags: bug, orm - :tickets: 9179 - - When using the :class:`.MappedAsDataclass` superclass, all classes within - the hierarchy that are subclasses of this class will now be run through the - ``@dataclasses.dataclass`` function whether or not they are actually - mapped, so that non-ORM fields declared on non-mapped classes within the - hierarchy will be used when mapped subclasses are turned into dataclasses. - This behavior applies both to intermediary classes mapped with - ``__abstract__ = True`` as well as to the user-defined declarative base - itself, assuming :class:`.MappedAsDataclass` is present as a superclass for - these classes. - - This allows non-mapped attributes such as ``InitVar`` declarations on - superclasses to be used, without the need to run the - ``@dataclasses.dataclass`` decorator explicitly on each non-mapped class. - The new behavior is considered as correct as this is what the :pep:`681` - implementation expects when using a superclass to indicate dataclass - behavior. diff --git a/doc/build/changelog/unreleased_20/9182.rst b/doc/build/changelog/unreleased_20/9182.rst deleted file mode 100644 index eb0482748d..0000000000 --- a/doc/build/changelog/unreleased_20/9182.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. change:: - :tags: bug, orm - :tickets: 9182 - - Improved the error reporting when linking strategy options from a base - class to another attribute that's off a subclass, where ``of_type()`` - should be used. Previously, when :meth:`.Load.options` is used, the message - would lack informative detail that ``of_type()`` should be used, which was - not the case when linking the options directly. The informative detail now - emits even if :meth:`.Load.options` is used. - - diff --git a/doc/build/changelog/unreleased_20/9183.rst b/doc/build/changelog/unreleased_20/9183.rst deleted file mode 100644 index ef1eb80574..0000000000 --- a/doc/build/changelog/unreleased_20/9183.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. change:: - :tags: bug, typing - :tickets: 9183 - - Fixed typing for limit/offset methods including :meth:`.Select.limit`, - :meth:`.Select.offset`, :meth:`_orm.Query.limit`, :meth:`_orm.Query.offset` - to allow ``None``, which is the documented API to "cancel" the current - limit/offset. - - diff --git a/doc/build/changelog/unreleased_20/9187.rst b/doc/build/changelog/unreleased_20/9187.rst deleted file mode 100644 index 830bb16009..0000000000 --- a/doc/build/changelog/unreleased_20/9187.rst +++ /dev/null @@ -1,34 +0,0 @@ -.. change:: - :tags: bug, orm - :tickets: 9187 - - Added support for :pep:`586` ``Literal[]`` to be used in the - :paramref:`_orm.registry.type_annotation_map` as well as within - :class:`.Mapped` constructs. To use custom types such as these, they must - appear explicitly within the :paramref:`_orm.registry.type_annotation_map` - to be mapped. Pull request courtesy Frederik Aalund. - - As part of this change, the support for :class:`.sqltypes.Enum` in the - :paramref:`_orm.registry.type_annotation_map` has been expanded to include - support for ``Literal[]`` types consisting of string values to be used, - in addition to ``enum.Enum`` datatypes. If a ``Literal[]`` datatype - is used within ``Mapped[]`` that is not linked in - :paramref:`_orm.registry.type_annotation_map` to a specific datatype, - a :class:`.sqltypes.Enum` will be used by default. - - .. seealso:: - - :ref:`orm_declarative_mapped_column_enums` - - -.. change:: - :tags: bug, orm - :tickets: 9200 - - Fixed issue involving the use of :class:`.sqltypes.Enum` within the - :paramref:`_orm.registry.type_annotation_map` where the - :paramref:`_sqltypes.Enum.native_enum` parameter would not be correctly - copied to the mapped column datatype, if it were overridden - as stated in the documentation to set this parameter to False. - - diff --git a/doc/build/conf.py b/doc/build/conf.py index e15c5cf584..f8807208a2 100644 --- a/doc/build/conf.py +++ b/doc/build/conf.py @@ -236,9 +236,9 @@ copyright = "2007-2023, the SQLAlchemy authors and contributors" # noqa # The short X.Y version. version = "2.0" # The full version, including alpha/beta/rc tags. -release = "2.0.0" +release = "2.0.1" -release_date = "January 26, 2023" +release_date = "February 1, 2023" site_base = os.environ.get("RTD_SITE_BASE", "https://www.sqlalchemy.org") site_adapter_template = "docs_adapter.mako"