Change8

rel_2_0_47

📦 sqlalchemyView on GitHub →
1 features🐛 7 fixes1 deprecations🔧 5 symbols

Summary

This release focuses heavily on bug fixes across PostgreSQL and SQLite dialects related to ON CONFLICT handling and batching, alongside an ORM fix for Python 3.14 annotations and a new feature allowing raw connections to be used as context managers.

Migration Steps

  1. When using the MariaDB dialect, update configuration to use `mariadb_with_parser` and `mariadb_using` instead of (or in addition to) `mysql_with_parser` and `mysql_using` to avoid deprecation warnings.

✨ New Features

  • The connection object returned by `_engine.Engine.raw_connection()` now supports the context manager protocol, automatically returning the connection to the pool upon exiting the context.

🐛 Bug Fixes

  • Fixed issue in ORM mappings when using Python 3.14+ (PEP 649) where introspection of `__init__` failed if non-present identifiers were in annotations, by amending vendored `getfullargspec()` to use `Format.FORWARDREF`.
  • Fixed PostgreSQL foreign key constraint reflection to correctly parse `onupdate` and `ondelete` values regardless of their order in the constraint definition string.
  • Fixed PostgreSQL `engine_insertmanyvalues` feature with `ON CONFLICT` and `_dml.Insert.returning.sort_by_parameter_order` enabled, preventing invalid SQL generation when using implicit sentinel autoincrement primary keys.
  • Fixed issue where PostgreSQL `_postgresql.Insert.on_conflict_do_update()` parameters did not respect compilation options like `literal_binds=True`.
  • Fixed issue where PostgreSQL `_postgresql.Insert.on_conflict_do_update()` with parametrized bound parameters in the `set_` clause failed with executemany batching; now disables insertmanyvalues for psycopg2 when ON CONFLICT is present, and uses row-at-a-time mode for RETURNING clauses with parametrized bindparams.
  • Fixed SQLite `_sqlite.Insert.on_conflict_do_update()` parameters not respecting compilation options like `literal_binds=True`.
  • Fixed issue where SQLite `_sqlite.Insert.on_conflict_do_update()` with parametrized bound parameters in the `set_` clause failed with executemany batching; now uses row-at-a-time mode for ON CONFLICT statements with RETURNING that contain parametrized bindparams.

Affected Symbols

⚡ Deprecations

  • Using `mysql_with_parser` or `mysql_using` options with the MariaDB dialect without also specifying `mariadb_with_parser` and `mariadb_using` will emit a deprecation warning. Users should update to use the `mariadb_` prefixed options when using the `mariadb://` dialect.