SQLAlchemy 2.1 Documentation
Changes and Migration
- What’s New in SQLAlchemy 2.1?
- 2.1 Changelog¶
- 2.0 Changelog
- 1.4 Changelog
- 1.3 Changelog
- 1.2 Changelog
- 1.1 Changelog
- 1.0 Changelog
- 0.9 Changelog
- 0.8 Changelog
- 0.7 Changelog
- 0.6 Changelog
- 0.5 Changelog
- 0.4 Changelog
- 0.3 Changelog
- 0.2 Changelog
- 0.1 Changelog
- SQLAlchemy 2.0 - Major Migration Guide
- What’s New in SQLAlchemy 2.0?
- What’s New in SQLAlchemy 1.4?
- What’s New in SQLAlchemy 1.3?
- What’s New in SQLAlchemy 1.2?
- What’s New in SQLAlchemy 1.1?
- What’s New in SQLAlchemy 1.0?
- What’s New in SQLAlchemy 0.9?
- What’s New in SQLAlchemy 0.8?
- What’s New in SQLAlchemy 0.7?
- What’s New in SQLAlchemy 0.6?
- What’s new in SQLAlchemy 0.5?
- What’s new in SQLAlchemy 0.4?
Project Versions
- Previous: What’s New in SQLAlchemy 2.1?
- Next: 2.0 Changelog
- Up: Home
- On this page:
2.1 Changelog¶
2.1.0b1¶
no release dateorm¶
The
relationship.back_populates
argument torelationship()
may now be passed as a Python callable, which resolves to either the direct linked ORM attribute, or a string value as before. ORM attributes are also accepted directly byrelationship.back_populates
. This change allows type checkers and IDEs to confirm the argument forrelationship.back_populates
is valid. Thanks to Priyanshu Parikh for the help on suggesting and helping to implement this feature.References: #10050
Removed legacy signatures dating back to 0.9 release from the
SessionEvents.after_bulk_update()
andSessionEvents.after_bulk_delete()
.References: #10721
Revised the set “binary” operators for the association proxy
set()
interface to correctly raiseTypeError
for invalid use of the|
,&
,^
, and-
operators, as well as the in-place mutation versions of these methods, to match the behavior of standard Pythonset()
as well as SQLAlchemy ORM’s “intstrumented” set implementation.References: #11349
schema¶
Deprecate Oracle only parameters
Sequence.order
,Identity.order
andIdentity.on_null
. They should be configured using the dialect kwargsoracle_order
andoracle_on_null
.References: #10247
typing¶
The
Row
object now no longer makes use of an intermediaryTuple
in order to represent its individual element types; instead, the individual element types are present directly, via new PEP 646 integration, now available in more recent versions of Mypy. Mypy 1.7 or greater is now required for statements, results and rows to be correctly typed. Pull request courtesy Yurii Karabas.References: #10635
asyncio¶
Adapted all asyncio dialects, including aiosqlite, aiomysql, asyncmy, psycopg, asyncpg to use the generic asyncio connection adapter first added in #6521 for the aioodbc DBAPI, allowing these dialects to take advantage of a common framework.
References: #10415
Added an initialize step to the import of
sqlalchemy.ext.asyncio
so thatgreenlet
will be imported only when the asyncio extension is first imported. Alternatively, thegreenlet
library is still imported lazily on first use to support use case that don’t make direct use of the SQLAlchemy asyncio extension.References: #10296
Removed the compatibility
async_fallback
mode for async dialects, since it’s no longer used by SQLAlchemy tests. Also removed the internal functionawait_fallback()
and renamed the internal functionawait_only()
toawait_()
. No change is expected to user code.
mariadb¶
Modified the MariaDB dialect so that when using the
Uuid
datatype with MariaDB >= 10.7, leaving theUuid.native_uuid
parameter at its default of True, the nativeUUID
datatype will be rendered in DDL and used for database communication, rather thanCHAR(32)
(the non-native UUID type) as was the case previously. This is a behavioral change since 2.0, where the genericUuid
datatype deliveredCHAR(32)
for all MySQL and MariaDB variants. Support for all major DBAPIs is implemented including support for less common “insertmanyvalues” scenarios where UUID values are generated in different ways for primary keys. Thanks much to Volodymyr Kochetkov for delivering the PR.References: #10339
misc¶
Python 3.8 or above is now required; support for Python 3.7 is dropped as this version is EOL.
References: #10357
The
greenlet
dependency used for asyncio support no longer installs by default. This dependency does not publish wheel files for every architecture and is not needed for applications that aren’t using asyncio features. Use thesqlalchemy[asyncio]
install target to include this dependency.References: #10197
Updated the setup manifest definition to use PEP 621-compliant pyproject.toml. Also updated the extra install dependency to comply with PEP-685. Thanks for the help of Matt Oberle and KOLANICH on this change.
flambé! the dragon and The Alchemist image designs created and generously donated by Rotem Yaari.
Created using Sphinx 7.2.6. Documentation last generated: Wed 08 May 2024 12:32:07 PM EDT