Change8

rel_2_1_0b3

📦 sqlalchemyView on GitHub →
4 features🐛 4 fixes1 deprecations🔧 17 symbols

Summary

This release introduces performance improvements across ORM loading strategies, notably optimizing `selectinload` by skipping unnecessary `.unique()` calls and processing rows as tuples. It also enhances session execution option propagation and fixes several bugs related to declarative metadata resolution and result filtering compatibility.

Migration Steps

  1. If you rely on implicit schema resolution for unqualified table names in relationship parameters (`secondary`, `primaryjoin`, `secondaryjoin`) when a `MetaData` has a default schema set, be aware that this behavior will change; explicitly qualify table names if necessary to maintain current behavior until the next major version.

✨ New Features

  • Added `selectinload.chunksize` parameter to `selectinload()` to configure the number of primary keys sent per IN clause when loading relationships.
  • The `populate_existing` execution option is now honored when passed in the `Session.get.execution_options` dict by `Session.get()` and analogous session methods.
  • Updated `_orm.ORMExecuteState.user_defined_options` to include options added to the statement before calling `Select.with_only_columns()` or `_orm.Query.with_entities()`.
  • Session level `_orm.Session.execution_options` now take effect for Core level SQL emitted by unit of work operations.

🐛 Bug Fixes

  • Fixed issue where the declarative class registry would not consider class-level `MetaData` objects set on abstract mixin classes when resolving string-based table references in `relationship()` configurations.
  • Fixed issue where the `_engine.Result.unique()` filter was not properly validated against the `_engine.Result.yield_per()` method when both were called on the result object, now correctly raising `InvalidRequestError` as they are incompatible.
  • A warning is now emitted when a Declarative attribute name is named `metadata` or `registry` due to potential unintended interactions with Declarative reserved names.
  • Fixed issue where the declarative class resolver would not consider the `MetaData.schema` default schema when resolving an unqualified string table name for `relationship.secondary`, `relationship.primaryjoin`, and `relationship.secondaryjoin` expressions.

Affected Symbols

⚡ Deprecations

  • A deprecation warning is emitted when an unqualified table name resolves to a :data:`.BLANK_SCHEMA` table in a `MetaData` that has a default schema set, as this implicit resolution (matching `ForeignKey` behavior) will change in a future version.