diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2022-12-09 19:08:19 +0100 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2022-12-14 22:35:47 +0100 |
| commit | d27764d5bc63ae2ebc2e0db1d88af9a0e0f2f590 (patch) | |
| tree | 900856ae23b55044aba22ececa009ef61c8657a9 /doc | |
| parent | a8d76cff39dbaf6354d42d35cd68332df469d124 (diff) | |
| download | sqlalchemy-d27764d5bc63ae2ebc2e0db1d88af9a0e0f2f590.tar.gz | |
Improve v2 documentation
Fixes: #7659
Change-Id: Ic9b758c7eed568f33dd0a745031f96de7666baf1
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/core/connections.rst | 3 | ||||
| -rw-r--r-- | doc/build/orm/extensions/mypy.rst | 13 |
2 files changed, 9 insertions, 7 deletions
diff --git a/doc/build/core/connections.rst b/doc/build/core/connections.rst index 4d97f82bc..643b7e705 100644 --- a/doc/build/core/connections.rst +++ b/doc/build/core/connections.rst @@ -956,6 +956,7 @@ As an example, we will examine the logging produced by the following program:: from sqlalchemy import create_engine from sqlalchemy import ForeignKey from sqlalchemy import Integer + from sqlalchemy import select from sqlalchemy import String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship @@ -987,7 +988,7 @@ As an example, we will examine the logging produced by the following program:: s.add_all([A(bs=[B(), B(), B()]), A(bs=[B(), B(), B()]), A(bs=[B(), B(), B()])]) s.commit() - for a_rec in s.query(A): + for a_rec in s.scalars(select(A)): print(a_rec.bs) When run, each SQL statement that's logged will include a bracketed diff --git a/doc/build/orm/extensions/mypy.rst b/doc/build/orm/extensions/mypy.rst index 9dfb4c58b..6639924e9 100644 --- a/doc/build/orm/extensions/mypy.rst +++ b/doc/build/orm/extensions/mypy.rst @@ -11,7 +11,7 @@ the :func:`_orm.mapped_column` construct introduced in SQLAlchemy 2.0. .. topic:: SQLAlchemy Mypy Plugin Status Update - **Updated June 27, 2022** + **Updated December 2022** For SQLAlchemy 2.0, the Mypy plugin continues to work at the level at which it reached in the SQLAlchemy 1.4 release. However, SQLAlchemy 2.0, @@ -20,12 +20,13 @@ the :func:`_orm.mapped_column` construct introduced in SQLAlchemy 2.0. for ORM Declarative models that removes the need for the Mypy plugin and delivers much more consistent behavior with generally superior capabilities. Note that this new capability is **not - part of SQLAlchemy 1.4, it is only in SQLAlchemy 2.0, which is not released - yet as of June 27, 2022**. + part of SQLAlchemy 1.4, it is only in SQLAlchemy 2.0, which is out with beta + releases as of December 2022**. The SQLAlchemy Mypy plugin, while it has technically never left the "alpha" - stage, should **now be considered as legacy, even though it is still - necessary for full Mypy support when using SQLAlchemy 1.4**. + stage, should **now be considered as deprecated in SQLAlchemy 2.0, even + though it is still necessary for full Mypy support when using + SQLAlchemy 1.4**. The Mypy plugin itself does not solve the issue of supplying correct typing with other typing tools such as Pylance/Pyright, Pytype, Pycharm, etc, which @@ -52,7 +53,7 @@ the :func:`_orm.mapped_column` construct introduced in SQLAlchemy 2.0. :ref:`whatsnew_20_orm_declarative_typing` for background on how this migration may proceed. - Code that is running exclusively on **not-released-yet** SQLAlchemy version + Code that is running exclusively on SQLAlchemy version 2.0 and has fully migrated to the new declarative constructs will enjoy full compliance with pep-484 as well as working correctly within IDEs and other typing tools, without the need for plugins. |
