18036 Commits

Author SHA1 Message Date
Léo Gallot ffc32e517d Replace logging.WARN by logging.WARNING (#13277) 2026-05-05 21:01:21 +02:00
Matti Picus f353f62327 limit pypy to one build, fix typo (#13275) 2026-05-04 14:51:32 +02:00
Federico Caselli a50a9097d3 restore skip of 3.14t with cext and greenlet
Change-Id: Ia75ab15c73f5a93f5eb2b6b99870aab824d0a43d
2026-05-03 21:27:32 +02:00
dependabot[bot] 583e2c4a0c Bump pypa/cibuildwheel from 3.3.0 to 3.4.1 (#13271)
* Bump pypa/cibuildwheel from 3.3.0 to 3.4.1

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 3.3.0 to 3.4.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v3.3.0...v3.4.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* remove wheels for 3.13t since it's deprecated

Change-Id: I51157a09e7b01d5b23adc10d9a4b386776dedf7e

* remove tests from 3.13t

Change-Id: I73bb2761d07b0c8f549a4ba8ee7299dec6907df7

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Federico Caselli <cfederico87@gmail.com>
2026-05-02 20:33:39 +02:00
dependabot[bot] db9b991551 Bump actions/checkout from 4 to 6 (#13273)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-30 21:57:42 +02:00
dependabot[bot] 649dad490e Bump docker/setup-qemu-action from 3 to 4 (#13272)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-30 21:54:35 +02:00
dependabot[bot] 57ccf3e4ed Bump actions/setup-python from 5 to 6 (#13270)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-30 21:53:11 +02:00
Léo Gallot 046c434d33 docs: fix typo pool_echo -> echo_pool (#13269) 2026-04-30 21:51:19 +02:00
Léo Gallot 65192be2a4 docs: fix incorrect execution context class reference (#13254) 2026-04-29 21:56:29 +02:00
Michael Bayer ec07581c43 Merge "Remove unused TypeVars and compat import from typing modules" into main 2026-04-24 21:38:50 +00:00
bekapono 95eb9510fb configurable chunksize parameter for selectinload
Added :paramref:`.selectinload.chunksize` parameter to :func`.selectinload`
allowing users to configure the number of primary keys sent per IN clause
when loading reltaionships. Pull request courtesy bekapono.

Fixes: #11450
Closes: #13235
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13235
Pull-request-sha: 360585a48c

Change-Id: Id09776b7ba53c630a780f128fc67dfdc085a4062
2026-04-23 14:26:22 -04:00
Shamil Abdulaev 15f1d6dce6 Remove unused TypeVars and compat import from typing modules
## Summary

Removes 4 dead symbols from SQLAlchemy's typing modules. Each symbol has **zero references** across `lib/`, `test/`, `doc/`, `tools/`, and `examples/` — verified by grep for direct references, string forward references, and `getattr`-style dynamic access.

## Changes

**`lib/sqlalchemy/util/typing.py`**
- Remove `from . import compat` — unused module import; the only occurrence of `compat` in the file is in a code comment on line 221
- Remove `_KT_co = TypeVar("_KT_co", covariant=True)` — unused TypeVar
- Remove `_KT_contra = TypeVar("_KT_contra", contravariant=True)` — unused TypeVar

**`lib/sqlalchemy/orm/_typing.py`**
- Remove `_T_co = TypeVar("_T_co", bound=Any, covariant=True)` — orphaned; `orm.base` imports `_T_co` from `sql._typing` instead, and other orm modules (`interfaces.py`, `attributes.py`) define their own local `_T_co`

Total: **-7 lines**, no additions.

## Verification

For each removed symbol:

| Symbol | Repo-wide grep result |
|---|---|
| `compat` (in `util/typing.py`) | 0 references to `compat.` or `util.typing.compat` outside the import itself |
| `_KT_co` | 1 hit total (the removed definition line) |
| `_KT_contra` | 1 hit total (the removed definition line) |
| `_T_co` (in `orm/_typing.py`) | No `from sqlalchemy.orm._typing import _T_co` or `from ..orm._typing import _T_co` anywhere; all consumers import from `sql._typing` or define locally |

Additionally checked:
- No `__all__` references
- No string forward references (e.g. `"_KT_co"`)
- No `getattr(..., "_T_co")` or similar dynamic access
- No re-exports via `util/__init__.py` or any other module
- `test/base/test_typing_utils.py` (which imports `util.typing as sa_typing`) does not touch any of these names

## Test plan

- [x] `pre-commit` hooks pass (black, zimports, flake8)
- [x] `import sqlalchemy`, `sqlalchemy.orm`, `sqlalchemy.util.typing`, `sqlalchemy.orm._typing`, `sqlalchemy.sql._typing`, `sqlalchemy.dialects._typing` — all import cleanly
- [x] Broad import smoke test: `Mapped`, `DeclarativeBase`, `relationship`, `Session`, `Mapper`, `mapped_column`, `Column`, `select`, `create_engine`, `MetaData`, `QueuePool`, `hybrid_property`, `association_proxy` — all import cleanly
- [x] Full `tox` / test suite — would appreciate CI confirmation

## Not included (intentionally)

- `LiteralString` re-export in `util/typing.py:54` — has 0 in-tree consumers but is an explicit `as X as X` public re-export; kept for API stability
- `is_origin_of` rename to `_is_origin_of` — used only internally by `is_union`, but renaming is a minor breaking change not worth the churn

Closes: #13244
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13244
Pull-request-sha: 8242f37368

Change-Id: Iae389447ac46599df27ab9776ff5ad19dfef4e2c
2026-04-23 13:09:07 -04:00
Michael Bayer deb949fe05 Merge "Accept OrderByLists in order_by" into main 2026-04-22 13:01:26 +00:00
Federico Caselli cab3ffad9d Use python to invoke pip
Fixes #13246 (hopefully)

Change-Id: If57a59e92ec933a1611c64534669a602ff2f3a92
2026-04-21 22:26:06 +02:00
Michael Bayer f2ab0b1886 Merge "narrow scope of _correct_for_mysql_bugs_88718_96365" into main 2026-04-21 17:17:36 +00:00
Tobias Petersen e4e2f94629 Accept OrderByLists in order_by
Add OrderByRole to acceptable arguments for order_by

Fixes: #13248

### Description
Add OrderByRole to acceptable arguments for order_by to solve typing regression

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [x] A documentation / typographical / small typing error fix
	- Good to go, no issue or tests are needed
- [x] A short code fix
	- please include the issue number, and create an issue if none exists, which
	  must include a complete example of the issue.  one line code fixes without an
	  issue and demonstration will not be accepted.
	- Please include: `Fixes: #<issue number>` in the commit message
	- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
	- please include the issue number, and create an issue if none exists, which must
	  include a complete example of how the feature would look.
	- Please include: `Fixes: #<issue number>` in the commit message
	- please include tests.

**Have a nice day!**

Closes: #13251
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13251
Pull-request-sha: 267e33f311

Change-Id: I0778cdecfebfb12bafc5b6027763ae5f5dcf02a2
2026-04-21 12:48:17 -04:00
Mike Bayer 530e1f71e7 narrow scope of _correct_for_mysql_bugs_88718_96365
Narrowed the scope of the internal workaround for MySQL bugs `#88718
<https://bugs.mysql.com/bug.php?id=88718>`_ and `#96365
<https://bugs.mysql.com/bug.php?id=96365>`_ so that it is only applied
where needed: MySQL 8.0.1 through 8.0.13 (where bug 88718 is present), and
on systems with ``lower_case_table_names=2`` (where bug 96365 applies,
typically macOS).  Previously the workaround was applied unconditionally
for all MySQL 8.0+ versions, which caused a ``KeyError`` during foreign key
reflection when the database user lacked SELECT privileges on referred
tables.

Fixes: #13243
Change-Id: I7c29f67d1653c5cd32f29e098f038fea1d56117b
2026-04-21 10:57:46 -04:00
Bojun Chai 053a90668a docs: fix typo 'nad' -> 'and' in DefaultDialect.construct_arguments docstring (#13245)
Co-authored-by: Bojun Chai <bojunchai@microsoft.com>
2026-04-20 22:30:20 +02:00
Mike Bayer 70de878023 handle asyncpg InternalClientError
Fixed issue where the asyncpg driver could throw an insufficiently-handled
exception ``InternalClientError`` under some circumstances, leading to
connections not being properly marked as invalidated.

Fixes: #13241
References: https://github.com/MagicStack/asyncpg/issues/1069
Change-Id: Iaaf551b3d7b062cce62e13b441161583a484615f
2026-04-17 16:13:53 -04:00
Mike Bayer 5559c5e5ae Version 2.1.0b3 placeholder 2026-04-16 16:16:54 -04:00
Mike Bayer 5237d923dd - 2.1.0b2 rel_2_1_0b2 2026-04-16 16:04:09 -04:00
Mike Bayer e5ec8f3b0a doc edits
Change-Id: I2a30ceba5d27eba858396ab98ccb25e62d3dc3dc
2026-04-16 16:02:37 -04:00
Federico Caselli b7f3168580 Merge "Add mypy ignore comments for Python 3.14 module imports" into main 2026-04-16 19:45:42 +00:00
Federico Caselli 956cbcbf48 add missing versionadded annotation
Change-Id: Id3ae0bcd9fef956bec0aa9c19ffc375472840774
References: #13238
2026-04-16 21:06:55 +02:00
Mukunda Rao Katta 1f27a0deef Fix 'compatiblity' typo in sqlite dialect docstring (#13237)
Co-authored-by: MukundaKatta <mukundakatta@users.noreply.github.com>
2026-04-16 20:56:30 +02:00
Shamil Abdulaev 77c91b8df5 Add mypy ignore comments for Python 3.14 module imports
Fixes #13240

Use `sys.version_info >= (3, 14)` instead of the `py314` variable for
the py314-only imports block (`annotationlib`, `string.templatelib`).

mypy has built-in support for `sys.version_info` guards and only
type-checks the reachable branch, while a plain variable like `py314`
causes mypy to check both branches — leading to `import-not-found` on
<3.14 and `unused-ignore` on 3.14 if `type: ignore` comments are added.

Closes: #13239
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13239
Pull-request-sha: f58bfc1169

Change-Id: Ib5e2361e849a3f14f90d0da34800c1d31f8bf201
2026-04-16 14:56:23 -04:00
Michael Bayer 7dce9fec9d Merge "Improve pg two-phase transactions" into main 2026-04-15 18:20:23 +00:00
Federico Caselli 08cef20f4a Improve pg two-phase transactions
Improve handling of two phase transaction identifiers for PostgreSQL
when the identifier is provided by the user.
As part of this change the psycopg dialect was updated to use the DBAPI
two phase transaction API instead of executing the SQL directly.

Fixes: #13229
Change-Id: If8301a7253b4a0c88e5323c9a052c3a9fa258780
2026-04-14 21:46:28 +02:00
Federico Caselli 87f17c2e59 Improve escaping in pysqlcipher
Escape key and pragma values when utilizing the pysqlcipher dialect.

Fixes: #13230
Change-Id: I7583577a3e00e2f2986e50f32136a9ef005eb28a
2026-04-13 22:26:48 +02:00
Michael Bayer d3a85fbd07 Merge "Add JSON type support for Oracle dialect" into main 2026-04-03 19:19:48 +00:00
abdallah elhdad 7d3b4f9049 Add JSON type support for Oracle dialect
Added support for the :class:`_sqltypes.JSON` datatype when using the
Oracle database with the oracledb dialect.  JSON values are serialized and
deserialized using configurable strategies that accommodate Oracle's native
JSON type available as of Oracle 21c.  Pull request courtesy Abdallah
Alhadad.

This fix also includes new dialect-level indicators for JSON support;
some attention given to issue #13213 indicates we can close that issue.

Fixes: #10375
Closes: #13065
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13065
Pull-request-sha: 9a89237f4f

Change-Id: I8cbe35bc632dc9419642ddca8bf4ba9c20c0ae37
2026-04-03 14:53:53 -04:00
Mike Bayer bda3c309b4 cherry-pick changelog update for 2.0.50 2026-04-03 12:38:35 -04:00
Mike Bayer 555f461d4e cherry-pick changelog from 2.0.49 2026-04-03 12:38:35 -04:00
Mike Bayer 6a54490c9d update for mypy 1.20.0
Change-Id: I95f72b8a1818b79d01d26531202199f24fe3b808
2026-04-01 19:48:10 +00:00
Mike Bayer aae603beab really remove cx_oracle from test setup
in 6282bcef11 we tried to disable cx_oracle
testing bug failed because pyproject was still pulling it in.
really fix this time

Change-Id: If5a46bf1ad9a9ee48e8693cccdc4b8b40cee392d
2026-04-01 15:45:53 -04:00
Michael Bayer 41b025d7c3 Merge "accommodate subclass mapper in post-loader entity_isa check" into main 2026-03-31 16:24:58 +00:00
bekapono 9ad90693bc Coercion warning feedback for unary distinct outside aggregate function
A warning is emitted when using the standalone :func:`_.sql.distinct`
function in a :func:`_sql.select` columns list outside of an aggregate
function; this function is not intended as a replacement for the use of
:meth:`.Select.distinct`. Pull request courtesy bekapono.

Fixes: #11526
Closes: #13162
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13162
Pull-request-sha: c6e8be7a49

Change-Id: Ibbdd64a922c62a7a9ead566590ad854db4066565
2026-03-31 10:45:18 -04:00
Mike Bayer 2ac8c1a7c7 accommodate subclass mapper in post-loader entity_isa check
Fixed issue where using chained loader options such as
:func:`_orm.selectinload` after :func:`_orm.joinedload` with
:meth:`_orm.PropComparator.of_type` for a polymorphic relationship would
not properly apply the chained loader option. The loader option is now
correctly applied when using a call such as
``joinedload(A.b.of_type(poly)).selectinload(poly.SubClass.c)`` to eagerly
load related objects.

Fixes: #13209
Change-Id: I2d14838f1b1a9a2b18dc52137910dab0bccf0dd5
2026-03-29 13:46:39 -04:00
Michael Bayer f244d5c3a9 Merge "fix: Session.get() with with_for_update=False skips identity map" into main 2026-03-29 17:10:10 +00:00
Mike Bayer d3a8d4950e apply _path_with_polymorphic in prepend as well
Fixed issue where using :meth:`_orm.Load.options` to apply a chained loader
option such as :func:`_orm.joinedload` or :func:`_orm.selectinload` with
:meth:`_orm.PropComparator.of_type` for a polymorphic relationship would
not generate the necessary clauses for the polymorphic subclasses. The
polymorphic loading strategy is now correctly propagated when using a call
such as ``joinedload(A.b).options(joinedload(B.c.of_type(poly)))`` to match
the behavior of direct chaining e.g.
``joinedload(A.b).joinedload(B.c.of_type(poly))``.

Fixes: #13202
Change-Id: I7b2ce2dd10a7f8583ff99495b0a65fa1a895ee29
2026-03-27 16:55:57 -04:00
joshuaswanson d466d37588 fix: Session.get() with with_for_update=False skips identity map
Fixes #13176.

`Session.get()` checks `with_for_update is None` to decide whether to look up the identity map. Passing `with_for_update=False` fails this check and always hits the database, even though `ForUpdateArg._from_argument` already treats `False` and `None` identically (both return `None`). Changed to `with_for_update in (None, False)` to match.

Closes: #13199
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13199
Pull-request-sha: c639b87238

Change-Id: I0584873f46099afadcdd760c0a267ae4d30528eb
2026-03-27 19:03:38 +01:00
Federico Caselli a49a4f021a use getattr for metadata, registry and type_annotation_map
The ``metadata``, ``type_annotation_map``, or ``registry`` can now be
set up in a declarative base also via a mixin class, not only by
directly setting them on the subclass like before.
The declarative class setup now uses ``getattr()`` to look for these
attributes, instead of relying only on the class ``__dict__``.

Fixes: #13198
Change-Id: I032f0064aefb36e5c5a2f1186d7edd30d2863047
2026-03-26 10:01:05 -04:00
Michael Bayer 1aa259f2d7 Merge "detect and accommodate reverse condition for loader strategy" into main 2026-03-23 21:21:49 +00:00
Federico Caselli a0baf90b2e link insert.value to data insert tutorial
Change-Id: I892fd7357f88c0e8d16e8e6fb74f18f4541ff795
2026-03-23 21:59:23 +01:00
Mike Bayer 3cf6c1112e detect and accommodate reverse condition for loader strategy
Fixed issue where chained :func:`_orm.joinedload` options would not be
applied correctly when the final relationship in the chain is declared on a
base mapper and accessed through a subclass mapper in a
:func:`_orm.with_polymorphic` query. The path registry now correctly
computes the natural path when a property declared on a base class is
accessed through a path containing a subclass mapper, ensuring the loader
option can be located during query compilation.

Fixes: #13193
Change-Id: I9ec83a0f184caed2bf6dd087b20c3538d6c23597
2026-03-23 15:20:53 -04:00
Michael Bayer 38e0fc2dd0 Merge "Add frame exclusion support for window functions" into main 2026-03-23 12:29:36 +00:00
Michael Bayer 912726f996 Merge "mssql: fall back to base type for alias types during reflection" into main 2026-03-20 20:37:40 +00:00
Carlos Serrano 1c78168f8a mssql: fall back to base type for alias types during reflection
Fixed regression from version 2.0.42 caused by 🎫`12654` where the
updated column reflection query would receive SQL Server "type alias" names
for special types such as ``sysname``, whereas previously the base name
would be received (e.g. ``nvarchar`` for ``sysname``), leading to warnings
that such types could not be reflected and resulting in :class:`.NullType`,
rather than the expected :class:`.NVARCHAR` for a type like ``sysname``.
The column reflection query now joins ``sys.types`` a second time to look
up the base type when the user type name is not present in
:attr:`.MSDialect.ischema_names`, and both names are checked in
:attr:`.MSDialect.ischema_names` for a match. Pull request courtesy Carlos
Serrano.

Fixes: #13181
Fixes: #13182
Closes: #13178
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13178
Pull-request-sha: be5c385059

Change-Id: I7fe86b80dfa45b208f7d97003ee5b1df3f07bfe7
2026-03-20 15:29:08 -04:00
Michael Bayer f2b30ed957 Merge "Remove version warning in SQL Server" into main 2026-03-20 19:24:52 +00:00
Michael Bayer dc5327d94c Merge "Allow escaped quotes in Postgres quoted identifier" into main 2026-03-20 19:23:30 +00:00