From ec2151fd5915d35ba9a8b9f09b9b677a209a66ad Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 25 Jan 2023 21:40:04 +0100 Subject: [PATCH] Improve examples, make typing beta, remove beta from asyncio Change-Id: Icbde11dcaae5fa6f5e83cd50b6a301081a3ab962 --- doc/build/changelog/whatsnew_20.rst | 33 ++++++++++++++-------------- doc/build/orm/extensions/asyncio.rst | 5 ----- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/doc/build/changelog/whatsnew_20.rst b/doc/build/changelog/whatsnew_20.rst index 9eca9789c5..2fe7d78c98 100644 --- a/doc/build/changelog/whatsnew_20.rst +++ b/doc/build/changelog/whatsnew_20.rst @@ -71,6 +71,11 @@ where new :ref:`declarative ` forms allo for fully typed ORM models that integrate all the way from statement to result set. +.. tip:: Typing support should be considered **beta level** software + for the 2.0 series. Typing details are subject to change however + significant backwards-incompatible changes are not planned. + + SQL Expression / Statement / Result Set Typing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -611,19 +616,17 @@ the same type, such as ``str``, may be used which each provide variants of :class:`_types.String`, as below where use of an ``Annotated`` ``str`` called ``str50`` will indicate ``String(50)``:: - from typing_extensions import Annotated - from sqlalchemy.orm import DeclarativeBase + from typing_extensions import Annotated + from sqlalchemy.orm import DeclarativeBase - str50 = Annotated[str, 50] + str50 = Annotated[str, 50] - # declarative base with a type-level override, using a type that is - # expected to be used in multiple places - class Base(DeclarativeBase): - registry = registry( - type_annotation_map={ - str50: String(50), - } - ) + # declarative base with a type-level override, using a type that is + # expected to be used in multiple places + class Base(DeclarativeBase): + type_annotation_map = { + str50: String(50), + } Second, Declarative will extract full :func:`_orm.mapped_column` definitions from the left hand type if @@ -650,11 +653,9 @@ example below adds additional ``Annotated`` types in addition to our class Base(DeclarativeBase): - registry = registry( - type_annotation_map={ - str50: String(50), - } - ) + type_annotation_map = { + str50: String(50), + } # set up mapped_column() overrides, using whole column styles that are diff --git a/doc/build/orm/extensions/asyncio.rst b/doc/build/orm/extensions/asyncio.rst index 234104f2e4..45da8ef36e 100644 --- a/doc/build/orm/extensions/asyncio.rst +++ b/doc/build/orm/extensions/asyncio.rst @@ -11,11 +11,6 @@ included, using asyncio-compatible dialects. .. warning:: Please read :ref:`asyncio_install` for important platform installation notes for many platforms, including **Apple M1 Architecture**. -.. tip:: The asyncio extension as of SQLAlchemy 1.4.3 can now be considered to - be **beta level** software. API details are subject to change however at this - point it is unlikely for there to be significant backwards-incompatible - changes. - .. seealso:: :ref:`change_3414` - initial feature announcement -- 2.47.2