]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 weeks agoturn on plain 3.14 for GH actions
Mike Bayer [Mon, 20 Oct 2025 21:04:30 +0000 (17:04 -0400)] 
turn on plain 3.14 for GH actions

which we are assuming is released by now

there should also be 3.14t plain

Change-Id: I045984fa30531818cf51cac96aefd6db411a040a

2 weeks agoFix missing back_populates in Note.item relationship in example code (#12925)
krave1986 [Mon, 20 Oct 2025 20:06:31 +0000 (04:06 +0800)] 
Fix missing back_populates in Note.item relationship in example code (#12925)

Without back_populates, the subsequent code would not automatically populate Item.notes or generate the key, which contradicts what the documentation intends to demonstrate.

2 weeks agoMerge "refactor common reporting options a bit" into main
Michael Bayer [Mon, 20 Oct 2025 16:26:34 +0000 (16:26 +0000)] 
Merge "refactor common reporting options a bit" into main

2 weeks agoadd noxfile.py to MANIFEST
Mike Bayer [Mon, 20 Oct 2025 16:25:47 +0000 (12:25 -0400)] 
add noxfile.py to MANIFEST

this is still how we get the files to include in a build
so it has to be there

Change-Id: Ie43ed43a7f9c4c5d3d85c76a1fcf2a4737d6dbc4

2 weeks agorefactor common reporting options a bit
Mike Bayer [Sun, 19 Oct 2025 19:08:20 +0000 (15:08 -0400)] 
refactor common reporting options a bit

Change-Id: I4a7316867ceacabc4e641017c9f19e40fababdbe

2 weeks agorequire nox 2025.10.16, remove python version workaround
Mike Bayer [Sat, 18 Oct 2025 20:05:14 +0000 (16:05 -0400)] 
require nox 2025.10.16, remove python version workaround

the workaround for [1] no longer works now that the fix has
been committed.  slightly surprising but just require that version
of nox and carry on

[1] https://github.com/wntrblm/nox/pull/999

Change-Id: I4b4031c3d3d02399f55f9750237de61e5e90d179

2 weeks agoChange typing tests to use `assert_type` instead of `reveal_type`
Rebecca Chen [Sat, 18 Oct 2025 14:20:55 +0000 (10:20 -0400)] 
Change typing tests to use `assert_type` instead of `reveal_type`

Closes: #12922
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12922
Pull-request-sha: 580f6638168c33e6c50e95066312ac605433665f

Change-Id: I9f3bdb4c105971f53fa10ed8a934356203ddb080

3 weeks agore-document 12915 as not fully fixed
Mike Bayer [Fri, 17 Oct 2025 12:57:10 +0000 (08:57 -0400)] 
re-document 12915 as not fully fixed

The ORM side of this issue can't be fixed without rewriting
.params() which will be 2.1 only, so clarify changelog

References: #12915
Change-Id: I2e524d5390241aa289786f524b6a51f39bc09876

3 weeks agodelete previous coverage file
Mike Bayer [Thu, 16 Oct 2025 00:55:07 +0000 (20:55 -0400)] 
delete previous coverage file

Change-Id: Id051257a2012bc0b40bbf0a89b80f540c9a1e5a1

3 weeks agore-add .coveragerc with relative paths
Mike Bayer [Thu, 16 Oct 2025 00:14:00 +0000 (20:14 -0400)] 
re-add .coveragerc with relative paths

Change-Id: I9023c392b98333e5235995cf8899b31e89f54096

3 weeks agosave coverage database files
Mike Bayer [Wed, 15 Oct 2025 23:12:16 +0000 (19:12 -0400)] 
save coverage database files

Change-Id: Ie0260e2e96978f0c6a2824f3fb2199988091bb23

3 weeks agocreate differently named coverage files
Mike Bayer [Wed, 15 Oct 2025 22:35:50 +0000 (18:35 -0400)] 
create differently named coverage files

Change-Id: Idcdc0084037bc729151c2bbbf87c8f94c393cf79

3 weeks agowrite db_idents file. check for it, delete it too
Mike Bayer [Wed, 15 Oct 2025 22:17:59 +0000 (18:17 -0400)] 
write db_idents file.  check for it, delete it too

Change-Id: I75fee60d69ebc51d66a688f292c374db5f4753f3

3 weeks agoqualify junit files on cext, greenlet as well
Mike Bayer [Wed, 15 Oct 2025 21:06:18 +0000 (17:06 -0400)] 
qualify junit files on cext, greenlet as well

for coverage we run different combinations of these in one nox
run with multiple tags

Change-Id: Ibe4861f5f34c7c984c38ca27a21e009eb6e0295f

3 weeks agoMerge "fully copy_internals for AnnotatedFromClause for straight cloned traverse...
Michael Bayer [Wed, 15 Oct 2025 20:56:13 +0000 (20:56 +0000)] 
Merge "fully copy_internals for AnnotatedFromClause for straight cloned traverse" into main

3 weeks agofixes for 3.14t on github actions
Mike Bayer [Wed, 15 Oct 2025 20:52:21 +0000 (16:52 -0400)] 
fixes for 3.14t on github actions

Change-Id: Ibc99e3dfdfd2a516c336090570df64875d97b653

3 weeks agoUpdate collection_api.rst (#12912)
krave1986 [Wed, 15 Oct 2025 19:37:10 +0000 (03:37 +0800)] 
Update collection_api.rst (#12912)

In the Dictionary Collections section, the example code incorrectly calls .items() on the dictionary but shows dictionary output instead of the items() method's actual return value.

3 weeks agofix quotes
Mike Bayer [Wed, 15 Oct 2025 19:29:02 +0000 (15:29 -0400)] 
fix quotes

Change-Id: I9a56ce0fefc6be9cda0cdfeec2302ef30514aa0a

3 weeks agofully copy_internals for AnnotatedFromClause for straight cloned traverse
Mike Bayer [Wed, 15 Oct 2025 18:47:38 +0000 (14:47 -0400)] 
fully copy_internals for AnnotatedFromClause for straight cloned traverse

Fixed issue where using :meth:`_sql.Select.params` to replace bound
parameters in a query could fail for some cases where the parameters
were embedded in subqueries or CTEs when ORM classes were involved,
due to issues with internal query traversal for these cases.

Fixes: #12915
Change-Id: Ib63bca786a541682f6b2144fd5dd43350411ae9d

3 weeks agouse nox
Mike Bayer [Mon, 29 Sep 2025 03:44:41 +0000 (23:44 -0400)] 
use nox

The top-level test runner has been changed to use ``nox``, adding a
``noxfile.py`` as well as some included modules.   The ``tox.ini`` file
remains in place so that ``tox`` runs will continue to function in the near
term, however it will be eventually removed and improvements and
maintenance going forward will be only towards ``noxfile.py``.

Change-Id: I66639991e1dc3db582e2ff13f9348a7d6241916e

3 weeks agoMerge "Support VIRTUAL computed columns on PostgreSQL." into main
Michael Bayer [Tue, 14 Oct 2025 23:07:05 +0000 (23:07 +0000)] 
Merge "Support VIRTUAL computed columns on PostgreSQL." into main

3 weeks agoMerge "Support warnings in exclusions" into main
Michael Bayer [Tue, 14 Oct 2025 23:06:57 +0000 (23:06 +0000)] 
Merge "Support warnings in exclusions" into main

3 weeks agoSupport VIRTUAL computed columns on PostgreSQL.
Federico Caselli [Mon, 6 Oct 2025 19:39:10 +0000 (21:39 +0200)] 
Support VIRTUAL computed columns on PostgreSQL.

Support for ``VIRTUAL`` computed columns on PostgreSQL 18 and later has
been added. The default behavior when :paramref:`.Computed.persisted` is
not specified has been changed to align with PostgreSQL 18's default of
``VIRTUAL``. When :paramref:`.Computed.persisted` is not specified, no
keyword is rendered on PostgreSQL 18 and later; on older versions a
warning is emitted and ``STORED`` is used as the default. To explicitly
request ``STORED`` behavior on all PostgreSQL versions, specify
``persisted=True``.

Fixes: #12866
Change-Id: Ic2ebdbe79e230a88370cf2b3503d2d1815f72a39

3 weeks agoSupport warnings in exclusions
Mike Bayer [Tue, 14 Oct 2025 21:19:26 +0000 (17:19 -0400)] 
Support warnings in exclusions

this adds a new feature to exclusions ``warns_if()`` which applies
the expect_warnings() context manager to a test method.  Additionally,
at the class level these requirements can be extracted from a
``__requirements__`` directive and also added to global Python warnings
filter using catch_warnings().

Change-Id: Ibe28d169106309a930731c77e201402152a38810

3 weeks agopostgresql dialect table options
Federico Caselli [Wed, 18 Jun 2025 20:22:59 +0000 (16:22 -0400)] 
postgresql dialect table options

Support for storage parameters in ``CREATE TABLE`` using the ``WITH``
clause has been added. The ``postgresql_with`` dialect option of
:class:`_schema.Table` accepts a mapping of key/value options.

The PostgreSQL dialect now support reflection of table options, including
the storage parameters, table access method and table spaces. These options
are automatically reflected when autoloading a table, and are also
available via the :meth:`_engine.Inspector.get_table_options` and
:meth:`_engine.Inspector.get_multi_table_optionsmethod` methods.

Fixes: #10909
Closes: #12584
Closes: #12684
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12584
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12684
Pull-request-sha: a660459de9adcedb2d12eac72450747c04792bcd

Change-Id: I33e3d8b8eb0c02530933cb124e3d375ca4af7db2

3 weeks agocreate real sections for PG table and constraint options
Mike Bayer [Tue, 14 Oct 2025 15:52:19 +0000 (11:52 -0400)] 
create real sections for PG table and constraint options

add new docs, clarify INDEX/UNIQUE for covering indexes which
was not clear at all previously

Change-Id: Ibc11b63b87cd8a939e074973b387e1a23fc236e5

3 weeks agoMerge "Improve postgresql reflection" into main
Michael Bayer [Tue, 14 Oct 2025 15:03:03 +0000 (15:03 +0000)] 
Merge "Improve postgresql reflection" into main

3 weeks agoMerge "Reflect collation in types on PostgreSQL" into main
Michael Bayer [Tue, 14 Oct 2025 15:02:39 +0000 (15:02 +0000)] 
Merge "Reflect collation in types on PostgreSQL" into main

3 weeks agoImprove postgresql reflection
Federico Caselli [Fri, 10 Oct 2025 22:31:00 +0000 (00:31 +0200)] 
Improve postgresql reflection

Some improvements to the reflection of PostgreSQL to avoid
unnecessary queries when not needed.

Fixes: #12908
Change-Id: Ic3da50ee43670f26d3159f5ec9a235a9a1963b8a

3 weeks agoReflect collation in types on PostgreSQL
Denis Laxalde [Thu, 24 Jul 2025 19:35:09 +0000 (15:35 -0400)] 
Reflect collation in types on PostgreSQL

Added support for reflection of collation in types for PostgreSQL.
The ``collation`` will be set only if different from the default
one for the type.

References #6511
Closes: #12510
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12510
Pull-request-sha: c0a390314eb8ff2a4f729babf25cb052b6268d0a

Change-Id: I269a194d526a0689a4b38f10456d28539c73cffb

3 weeks agodoc tweaks
Mike Bayer [Sun, 12 Oct 2025 05:43:48 +0000 (01:43 -0400)] 
doc tweaks

Change-Id: I7d445cd98db7edefe705ee4eb2cd24cad72040f3

3 weeks agobump black, flake8
Mike Bayer [Sat, 11 Oct 2025 18:29:44 +0000 (14:29 -0400)] 
bump black, flake8

nothing seems to have changed...

Change-Id: I7d08b24dc2df0f8a67bd5e704c8d108392a34fa3

4 weeks agoMerge "Complete type annotations of sqlalchemy.engine.cursor module" into main
Federico Caselli [Fri, 10 Oct 2025 18:45:46 +0000 (18:45 +0000)] 
Merge "Complete type annotations of sqlalchemy.engine.cursor module" into main

4 weeks agoMerge "Improve typing and code in cursor module" into main
Federico Caselli [Fri, 10 Oct 2025 18:43:11 +0000 (18:43 +0000)] 
Merge "Improve typing and code in cursor module" into main

4 weeks agocherry-pick changelog update for 2.0.45
Mike Bayer [Fri, 10 Oct 2025 14:39:33 +0000 (10:39 -0400)] 
cherry-pick changelog update for 2.0.45

4 weeks agocherry-pick changelog from 2.0.44
Mike Bayer [Fri, 10 Oct 2025 14:39:32 +0000 (10:39 -0400)] 
cherry-pick changelog from 2.0.44

4 weeks agochangelog edits
Mike Bayer [Fri, 10 Oct 2025 14:29:32 +0000 (10:29 -0400)] 
changelog edits

Change-Id: I2d72ee3d8640c45efb6e6feb0f97df8d38d2236a

4 weeks agorestore main zzzeeksphinx new design is merged
Mike Bayer [Fri, 10 Oct 2025 13:54:27 +0000 (09:54 -0400)] 
restore main zzzeeksphinx new design is merged

Change-Id: Ifea8c4ec31332d01dda64514471c5ab5af43049e

4 weeks agothe gc_intensive blocks will continue until builds improve
Mike Bayer [Fri, 10 Oct 2025 12:22:22 +0000 (08:22 -0400)] 
the gc_intensive blocks will continue until builds improve

Change-Id: Ie62a2371eb1512ecde3a886f11a4b3de6d6cde3d

4 weeks agotry out css_tweaks branch for zzzeeksphinx
Mike Bayer [Fri, 10 Oct 2025 04:58:08 +0000 (00:58 -0400)] 
try out css_tweaks branch for zzzeeksphinx

Change-Id: Ife130a0a3bda89704886f885b23696563fc149cc

4 weeks agoComplete type annotations of sqlalchemy.engine.cursor module
Denis Laxalde [Sat, 4 Oct 2025 19:13:29 +0000 (15:13 -0400)] 
Complete type annotations of sqlalchemy.engine.cursor module

References: #6810
Closes: #12760
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12760
Pull-request-sha: 2804f49e1922d3cdc67065b733d0dd6e06554905

Change-Id: I974f966b2cd8f984b872d0aa27bbbdab78c6c1d7

4 weeks agomark more GC sensitive tests as not open for github
Mike Bayer [Thu, 9 Oct 2025 19:56:25 +0000 (15:56 -0400)] 
mark more GC sensitive tests as not open for github

Change-Id: Ib73ec54e4ed7ef2d8911bfe8ee7a719022c6cddd

4 weeks agoImprove typing and code in cursor module
Federico Caselli [Thu, 9 Oct 2025 18:45:26 +0000 (20:45 +0200)] 
Improve typing and code in cursor module

Change-Id: I56b89f303f03dfc7056c7174ac06bc1679319bb5

4 weeks agoFix mssql index column order
Allen Chen [Fri, 3 Oct 2025 02:53:34 +0000 (22:53 -0400)] 
Fix mssql index column order

Fixed issue where the index reflection for SQL Server would
not correctly return the order of the column inside an index
when the order of the columns in the index did not match the
order of the columns in the table.
Pull request courtesy of Allen Chen.

Fixes: #12894
Closes: #12895
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12895
Pull-request-sha: bd9bd43219f35a29eaeee81fedea452afc64eb5d

Change-Id: I45ed30bbd0fcfd4f67cb2b682ecb3a18029be2b7

4 weeks agodont generate skipped suite names
Mike Bayer [Thu, 9 Oct 2025 16:43:16 +0000 (12:43 -0400)] 
dont generate skipped suite names

For a suite that is ``__backend__``, if no tests will run, then
don't include that suite in the result at all, rather than
keeping them there and having them skip.  the skip suites are
producing lots of noise in junit files

Change-Id: If58af412b7d8f542d6e1903ca933745075f5c7d9

4 weeks agoMerge "correct for FK reflecting on PK / index col at the same time" into main
Michael Bayer [Wed, 8 Oct 2025 16:22:07 +0000 (16:22 +0000)] 
Merge "correct for FK reflecting on PK / index col at the same time" into main

4 weeks agoMerge "Add Executable traverse internals to Executable subclasses and turn tests...
Michael Bayer [Wed, 8 Oct 2025 15:11:24 +0000 (15:11 +0000)] 
Merge "Add Executable traverse internals to Executable subclasses and turn tests on" into main

4 weeks agocorrect for FK reflecting on PK / index col at the same time
Mike Bayer [Wed, 8 Oct 2025 15:09:59 +0000 (11:09 -0400)] 
correct for FK reflecting on PK / index col at the same time

Fixed issue in the MSSQL dialect's foreign key reflection query where
duplicate rows could be returned when a foreign key column and its
referenced primary key column have the same name, and both the referencing
and referenced tables have indexes with the same name. This resulted in an
"ForeignKeyConstraint with duplicate source column references are not
supported" error when attempting to reflect such tables. The query has been
corrected to exclude indexes on the child table when looking for unique
indexes referenced by foreign keys.

Fixes: #12907
Change-Id: I435d4cf3bfa9e861cbb5e1e5c8c81bd59c9a9d58

4 weeks agoMerge "Add type annotations to indexable extension code" into main
Federico Caselli [Wed, 8 Oct 2025 12:57:47 +0000 (12:57 +0000)] 
Merge "Add type annotations to indexable extension code" into main

4 weeks agoAdd Executable traverse internals to Executable subclasses and turn tests on
Mike Bayer [Tue, 7 Oct 2025 18:55:44 +0000 (14:55 -0400)] 
Add Executable traverse internals to Executable subclasses and turn tests on

Fixed a caching issue where :func:`_orm.with_loader_criteria` would
incorrectly reuse cached bound parameter values when used with
:class:`_sql.CompoundSelect` constructs such as :func:`_sql.union`. The
issue was caused by the cache key for compound selects not including the
execution options that are part of the :class:`_sql.Executable` base class,
which :func:`_orm.with_loader_criteria` uses to apply its criteria
dynamically. The fix ensures that compound selects and other executable
constructs properly include execution options in their cache key traversal.

Fixes: #12905
Change-Id: I24bbd96233cddabe42eb716f078eea4c84b1af05

4 weeks agotrim down GH actions jobs
Mike Bayer [Wed, 8 Oct 2025 12:05:21 +0000 (08:05 -0400)] 
trim down GH actions jobs

- remove 3.13t, it's not really viable compared to 3.14t
- fully block test_memusage

Change-Id: I78ffcde329a78a9d720569a4b46a20c071e94a5c

4 weeks agoupdate oracle profiles
Federico Caselli [Tue, 7 Oct 2025 19:49:51 +0000 (21:49 +0200)] 
update oracle profiles

Change-Id: Ie1d5a8a6e655d7fc883f07348ee56a39fdc598da

4 weeks agoadd teardown to "run_n_times"
Mike Bayer [Tue, 7 Oct 2025 18:05:49 +0000 (14:05 -0400)] 
add teardown to "run_n_times"

Change-Id: Ibeeb90f7ea3bbd32ffd27b4eb2e2988018e87a5c

4 weeks agoremove mis-applied patch
Mike Bayer [Tue, 7 Oct 2025 13:35:26 +0000 (09:35 -0400)] 
remove mis-applied patch

some scratch tests got merged in 456727df50c7dc29ddc31c6f67c1b,
revert that part

Change-Id: I4e9d4a005f586dcc6fa1eb4a3a6fe886a21d6066

4 weeks agoadd 2.1 specific freethreading changelog
Mike Bayer [Tue, 7 Oct 2025 13:31:07 +0000 (09:31 -0400)] 
add 2.1 specific freethreading changelog

additionally put all setup/installation under the "platform"
header for now

Change-Id: I9b4113d865938c164f119b6aef8648fd75ca6d5f

4 weeks agoMerge "Add explicit multi-threaded tests and support free-threaded build" into main
Michael Bayer [Tue, 7 Oct 2025 13:17:08 +0000 (13:17 +0000)] 
Merge "Add explicit multi-threaded tests and support free-threaded build" into main

4 weeks agoAdd type annotations to indexable extension code
Denis Laxalde [Fri, 3 Oct 2025 19:10:08 +0000 (15:10 -0400)] 
Add type annotations to indexable extension code

A typing test case (plain_files/ext/indexable.py) is also added.

In order to make the methods of index_property conform with type
definitions of `fget`, `fset` and `fdel` arguments of hybrid_property,
we need to make the signature of protocols
(e.g. `_HybridGetterType`) `__call__`) method positional only.

Related to #6810.

Closes: #12763
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12763
Pull-request-sha: 896b9642629fb212a71e68ed3f08705d08407dbf

Change-Id: I42980ccf20ff9c992ebd616f38545e06ede57d36

5 weeks agoAdd explicit multi-threaded tests and support free-threaded build
Lysandros Nikolaou [Fri, 26 Sep 2025 14:16:41 +0000 (10:16 -0400)] 
Add explicit multi-threaded tests and support free-threaded build

Implemented initial support for free-threaded Python by adding new tests
and reworking the test harness and GitHub Actions to include Python 3.13t
and Python 3.14t in test runs. Two concurrency issues have been identified
and fixed: the first involves initialization of the ``.c`` collection on a
``FromClause``, a continuation of :ticket:`12302`, where an optional mutex
under free-threading is added; the second involves synchronization of the
pool "first_connect" event, which first received thread synchronization in
:ticket:`2964`, however under free-threading the creation of the mutex
itself runs under the same free-threading mutex. Initial pull request and
test suite courtesy Lysandros Nikolaou.

py313t: yes
py314t: yes
Fixes: #12881
Closes: #12882
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12882
Pull-request-sha: 53d65d96b979b1afbdb49e6394979cfd598c9a34

Co-authored-by: Mike Bayer <mike_mp@zzzcomputng.com>
Change-Id: I2e4f2e9ac974ab6382cb0520cc446b396d9680a6

5 weeks agotype pysqlite
Pablo Estevez [Sat, 23 Aug 2025 12:33:47 +0000 (08:33 -0400)] 
type pysqlite

<!-- Provide a general summary of your proposed changes in the Title field above -->
type pysqlite from dialects.
type some related code on pysqlite.py

related to #6810

### Description
<!-- Describe your changes in detail -->

### 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:

- [ ] A documentation / typographical / small typing error fix
- Good to go, no issue or tests are needed
- [ ] 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: #12789
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12789
Pull-request-sha: 2c1ea7283d534dd625c8f0e4270247d2cc5ed40c

Change-Id: I4d691c4bb334957029cd47289463555034ebd866

5 weeks agoMerge "deprecate inherit_schema argument" into main
Federico Caselli [Wed, 1 Oct 2025 19:21:09 +0000 (19:21 +0000)] 
Merge "deprecate inherit_schema argument" into main

5 weeks agoMerge "fix: pass dialect-specific kwargs to MetaData.reflect" into main
Michael Bayer [Tue, 30 Sep 2025 19:46:42 +0000 (19:46 +0000)] 
Merge "fix: pass dialect-specific kwargs to MetaData.reflect" into main

5 weeks agoMerge "skip windows/macosx for GC sensitive tests" into main
Michael Bayer [Tue, 30 Sep 2025 17:29:16 +0000 (17:29 +0000)] 
Merge "skip windows/macosx for GC sensitive tests" into main

5 weeks agofix: pass dialect-specific kwargs to MetaData.reflect
Lukáš KožuÅ¡ník [Fri, 26 Sep 2025 22:37:50 +0000 (18:37 -0400)] 
fix: pass dialect-specific kwargs to MetaData.reflect

Fixed issue where :meth:`_schema.MetaData.reflect` did not forward
dialect-specific keyword arguments to the :class:`_engine.Inspector`
methods, causing options like ``oracle_resolve_synonyms`` to be ignored
during reflection. The method now ensures that all extra kwargs passed to
:meth:`_schema.MetaData.reflect` are forwarded to
:meth:`_engine.Inspector.get_table_names` and related reflection methods.
Pull request courtesy Lukáš KožuÅ¡ník.

Fixes: #12884
Closes: #12885
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12885
Pull-request-sha: 9436812223600a2459461744fe20648639afc07d

Change-Id: Idb1ca0bc624df8e175cbfa979a8f31e62de185fe

5 weeks agocopy 2.0 changelog for unblock python 3.14
Mike Bayer [Mon, 29 Sep 2025 17:17:49 +0000 (13:17 -0400)] 
copy 2.0 changelog for unblock python 3.14

Change-Id: I2f7c94a01cb8d081f1bde8dc6685eaccba19f5f2
(cherry picked from commit 7cd36dabf67c58747c76602c92f04ff8d3eac5f3)

5 weeks agoskip windows/macosx for GC sensitive tests
Mike Bayer [Mon, 29 Sep 2025 17:48:02 +0000 (13:48 -0400)] 
skip windows/macosx for GC sensitive tests

can't get these to pass on GH actions anymore,
something has changed.

Change-Id: Iecd78b7f959def69b0a016f8341fef035a0d6d39

5 weeks agoMerge "lock down format_docs_code.py to specific paths" into main
Michael Bayer [Mon, 29 Sep 2025 18:16:16 +0000 (18:16 +0000)] 
Merge "lock down format_docs_code.py to specific paths" into main

5 weeks agoSquashed commit of the following:
Mike Bayer [Mon, 29 Sep 2025 16:16:13 +0000 (12:16 -0400)] 
Squashed commit of the following:

commit 24ff4a8bbac71a174d6d7a2ab319fdf9bae04e6f
Author: yuanoOo <zhaomingyuan.zmy@digital-engine.com>
Date:   Sun Sep 28 16:28:57 2025 +0800

    docs: Add OceanBase SQLAlchemy plugin to dialects documentation

    - Add OceanBase entry to External Dialects table
    - Add link to oceanbase-sqlalchemy plugin repository
    - References: https://github.com/oceanbase/ecology-plugins/tree/main/oceanbase-sqlalchemy-plugin

Change-Id: I6d99421e5e931d8306416e3afdb14e65e88f9be1

5 weeks agolock down format_docs_code.py to specific paths
Mike Bayer [Mon, 29 Sep 2025 13:08:52 +0000 (09:08 -0400)] 
lock down format_docs_code.py to specific paths

the script too quick to pick up on dot directories,
random .py files I have in my local checkout, etc.

Change-Id: I6eb66ddd3598495a420d9e4fc0f644b60fb3ec6d

5 weeks agosome tox readability improvements
Mike Bayer [Fri, 26 Sep 2025 18:03:37 +0000 (14:03 -0400)] 
some tox readability improvements

Change-Id: Iffc9a41b4a42330eb1e71704b0efdee94387af98

6 weeks agodeprecate inherit_schema argument
Federico Caselli [Mon, 28 Jul 2025 18:14:51 +0000 (20:14 +0200)] 
deprecate inherit_schema argument

Named types such as :class:`_postgresql.ENUM` and
:class:`_postgresql.DOMAIN` (as well as the dialect-agnostic
:class:`_types.Enum` version) are now more strongly associated with the
:class:`_schema.MetaData` at the top of the table hierarchy and are
de-associated with any particular :class:`_schema.Table` they may be a part
of. This better represents how PostgreSQL named types exist independently
of any particular table, and that they may be used across many tables
simultaneously.  The change impacts the behavior of the "default schema"
for a named type, as well as the CREATE/DROP behavior in relationship to
the :class:`.MetaData` and :class:`.Table` construct.  The change also
includes a new :class:`.CheckFirst` enumeration which allows fine grained
control over "check" queries during DDL operations, as well as that the
:paramref:`_types.SchemaType.inherit_schema` parameter is deprecated and
will emit a deprecation warning when used.  See the migration notes for
full details.

Fixes: #12690
Change-Id: I9752a9d52774ae760ec3448f62fc5046c58d68f5

6 weeks agoMerge "use standard path for asyncio create w/ exception handler" into main
Michael Bayer [Tue, 23 Sep 2025 19:55:54 +0000 (19:55 +0000)] 
Merge "use standard path for asyncio create w/ exception handler" into main

6 weeks agoMerge "add create_type to Enum" into main
Michael Bayer [Tue, 23 Sep 2025 14:51:45 +0000 (14:51 +0000)] 
Merge "add create_type to Enum" into main

6 weeks agouse standard path for asyncio create w/ exception handler
Mike Bayer [Sun, 21 Sep 2025 17:54:13 +0000 (13:54 -0400)] 
use standard path for asyncio create w/ exception handler

Refactored all asyncio dialects so that exceptions which occur on failed
connection attempts are appropriately wrapped with SQLAlchemy exception
objects, allowing for consistent error handling.

Fixes: #11956
Change-Id: Ic3fdbf334f059f92b03896b6429efa50968ca8a8

6 weeks agoImprove asyncpg exception hierarchy and asyncio hierarchies overall
Mike Bayer [Sat, 20 Sep 2025 20:22:28 +0000 (16:22 -0400)] 
Improve asyncpg exception hierarchy and asyncio hierarchies overall

The "emulated" exception hierarchies for the asyncio
drivers such as asyncpg, aiomysql, aioodbc, etc. have been standardized
on a common base :class:`.EmulatedDBAPIException`, which is now what's
available from the :attr:`.StatementException.orig` attribute on a
SQLAlchemy :class:`.DBAPIException` object.   Within :class:`.EmulatedDBAPIException`
and the subclasses in its hiearchy, the original driver-level exception is
also now avaliable via the :attr:`.EmulatedDBAPIException.orig` attribute,
and is also available from :class:`.DBAPIException` directly using the
:attr:`.DBAPIException.driver_exception` attribute.

Added additional emulated error classes for the subclasses of
``asyncpg.exception.IntegrityError`` including ``RestrictViolationError``,
``NotNullViolationError``, ``ForeignKeyViolationError``,
``UniqueViolationError`` ``CheckViolationError``,
``ExclusionViolationError``.  These exceptions are not directly thrown by
SQLAlchemy's asyncio emulation, however are available from the
newly added :attr:`.DBAPIException.driver_exception` attribute when a
:class:`.IntegrityError` is caught.

Fixes: #8047
Change-Id: I6a34e85b055265c087b0615f7c573be8582b3486

6 weeks agoadd create_type to Enum
Mike Bayer [Sun, 21 Sep 2025 16:13:21 +0000 (12:13 -0400)] 
add create_type to Enum

Added new parameter :paramref:`.Enum.create_type` to the Core
:class:`.Enum` class. This parameter is automatically passed to the
corresponding :class:`_postgresql.ENUM` native type during DDL operations,
allowing control over whether the PostgreSQL ENUM type is implicitly
created or dropped within DDL operations that are otherwise targeting
tables only. This provides control over the
:paramref:`_postgresql.ENUM.create_type` behavior without requiring
explicit creation of a :class:`_postgresql.ENUM` object.

Fixes: #10604
Change-Id: I450003ec2a2a65c119fe7ca8ff201392ce6b91e1

6 weeks agoMerge "Apply nested for joined eager m2o w/ GROUP BY, DISTINCT" into main
Michael Bayer [Sun, 21 Sep 2025 16:14:46 +0000 (16:14 +0000)] 
Merge "Apply nested for joined eager m2o w/ GROUP BY, DISTINCT" into main

6 weeks agoApply nested for joined eager m2o w/ GROUP BY, DISTINCT
Mike Bayer [Sun, 21 Sep 2025 14:59:51 +0000 (10:59 -0400)] 
Apply nested for joined eager m2o w/ GROUP BY, DISTINCT

Fixed issue where joined eager loading would fail to use the "nested" form
of the query when GROUP BY or DISTINCT were present if the eager joins
being added were many-to-ones, leading to additional columns in the columns
clause which would then cause errors.  The check for "nested" is tuned to
be enabled for these queries even for many-to-one joined eager loaders, and
the "only do nested if it's one to many" aspect is now localized to when
the query only has LIMIT or OFFSET added.

Fixes: #11226
Change-Id: I0b4b71cacfe1c6a25d0924e0954ceced1e399ca1

6 weeks agoremove _py3k suffixes from test files
Mike Bayer [Sat, 20 Sep 2025 22:31:25 +0000 (18:31 -0400)] 
remove _py3k suffixes from test files

on the theme of 2.0/2.1 are relatively similar right now, do
some more cleanup removing the py3k suffixes that we dont need anymore.

I'm not sure that the logic that would search for these suffixes is
even present anymore and I would guess we removed it when we removed
py2k support.  However, I am planning on possibly bringing it back
for some of the py314 stuff, so I still want to be able to do
suffix stuff.  that will be for another patch.

Change-Id: I929e6edd922f8d5f943acce77191fb1e3035b42c

6 weeks agoMerge "deprecate ARRAY.any(), ARRAY.all(), postgresql.Any(), postgresql.All()" into...
Michael Bayer [Sat, 20 Sep 2025 21:29:29 +0000 (21:29 +0000)] 
Merge "deprecate ARRAY.any(), ARRAY.all(), postgresql.Any(), postgresql.All()" into main

6 weeks agodeprecate ARRAY.any(), ARRAY.all(), postgresql.Any(), postgresql.All()
Mike Bayer [Sat, 20 Sep 2025 16:22:48 +0000 (12:22 -0400)] 
deprecate ARRAY.any(), ARRAY.all(), postgresql.Any(), postgresql.All()

The :meth:`_types.ARRAY.Comparator.any` and
:meth:`_types.ARRAY.Comparator.all` methods for the :class:`_types.ARRAY`
type are now deprecated for removal; these two methods along with
:func:`_postgresql.Any` and :func:`_postgresql.All` have been legacy for
some time as they are superseded by the :func:`_sql.any_` and
:func:`_sql.all_` functions, which feature more intutive use.

Fixes: #10821
Change-Id: I8eb3bbcb98af4ee60a21767dc3bdac771cbc0b4c

6 weeks agoMerge "Use ARRAY type for any_(), all_() coercion" into main
Michael Bayer [Sat, 20 Sep 2025 20:34:07 +0000 (20:34 +0000)] 
Merge "Use ARRAY type for any_(), all_() coercion" into main

6 weeks agoUse ARRAY type for any_(), all_() coercion
Mike Bayer [Sat, 20 Sep 2025 18:08:55 +0000 (14:08 -0400)] 
Use ARRAY type for any_(), all_() coercion

Fixed issue where the :func:`_sql.any_` and :func:`_sql.all_` aggregation
operators would not correctly coerce the datatype of the compared value, in
those cases where the compared value were not a simple int/str etc., such
as a Python ``Enum`` or other custom value.   This would lead to execution
time errors for these values.  This issue is essentially the same as
:ticket:`6515` which was for the now-legacy :meth:`.ARRAY.any` and
:meth:`.ARRAY.all` methods.

Fixes: #12874
Change-Id: I980894c23b9974bc84d584a1a4c5fae72dded6d3

6 weeks agoMerge "refactor test_sqlite into a package" into main
Michael Bayer [Sat, 20 Sep 2025 18:12:11 +0000 (18:12 +0000)] 
Merge "refactor test_sqlite into a package" into main

6 weeks agoMerge "raise for ENUM/DOMAIN with reserved type name and no schema" into main
Michael Bayer [Sat, 20 Sep 2025 18:11:57 +0000 (18:11 +0000)] 
Merge "raise for ENUM/DOMAIN with reserved type name and no schema" into main

6 weeks agoraise for ENUM/DOMAIN with reserved type name and no schema
KapilDagur [Sat, 13 Sep 2025 18:37:31 +0000 (14:37 -0400)] 
raise for ENUM/DOMAIN with reserved type name and no schema

A :class:`.CompileError` is raised if attempting to create a PostgreSQL
:class:`_postgresql.ENUM` or :class:`_postgresql.DOMAIN` datatype using a
name that matches a known pg_catalog datatype name, and a default schema is
not specified.   These types must be explicit within a schema in order to
be differentiated from the built-in pg_catalog type.  The "public" or
otherwise default schema is not chosen by default here since the type can
only be reflected back using the explicit schema name as well (it is
otherwise not visible due to the pg_catalog name).  Pull request courtesy
Kapil Dagur.

We originally thought we were going to do some default logic for the
default / "public" schema however this produces a type that is not
symmetric to its reflection, since the schema name must be explicit
for our current reflection queries.

So since it's an extremely bad idea to make an ENUM/DOMAIN with a
reserved type name anyway, we raise a compileerror if the type
has a known name.   this is not robust against other names that
might exist in pg_catalog or other schemas that are in the search
path with these names.  People just have to know what they're doing
here, the error here only covers a small subset of real world cases.

Fixes: #12761
Closes: #12822
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12822
Pull-request-sha: 793cf27be28a37e8882d89ba6b79570c79f936ac

Change-Id: I9df9c216ab4102f06685a64ae7e55db1b3a9535e

6 weeks agorefactor test_sqlite into a package
Mike Bayer [Sat, 20 Sep 2025 15:27:12 +0000 (11:27 -0400)] 
refactor test_sqlite into a package

this is many years overdue, let's do it while 2.1/2.0 are in
sync and we are far away from 1.4 now

Change-Id: Icf90f957e4d56382a4c91250f55bec4c7abc9d79

6 weeks agolimit STRICT to appropraite sqlite versions
Mike Bayer [Fri, 19 Sep 2025 20:35:44 +0000 (16:35 -0400)] 
limit STRICT to appropraite sqlite versions

Change-Id: Id7c302e9a182b0aa2cddd255d44afc3aa7bb77f4

7 weeks agofix tests for aggregate_order_by
Mike Bayer [Fri, 19 Sep 2025 19:18:39 +0000 (15:18 -0400)] 
fix tests for aggregate_order_by

forgot this doesnt work on sqlite older than 3.44

Change-Id: Icebc2ffaceb078a436a8f61ba583bc05b77f680d

7 weeks agoMerge "Add note regarding indexes with subscription of jsonb" into main
Michael Bayer [Fri, 19 Sep 2025 18:58:51 +0000 (18:58 +0000)] 
Merge "Add note regarding indexes with subscription of jsonb" into main

7 weeks agoAdd note regarding indexes with subscription of jsonb
Federico Caselli [Wed, 17 Sep 2025 17:12:39 +0000 (19:12 +0200)] 
Add note regarding indexes with subscription of jsonb

Fixes: #12868
Change-Id: I2a5a6a94a7a8f8796d898d4b7e69967a981c59e8

7 weeks agoadd RegistryEvents
Mike Bayer [Sun, 31 Aug 2025 22:53:01 +0000 (18:53 -0400)] 
add RegistryEvents

Added :class:`_orm.RegistryEvents` event class that allows event listeners
to be established on a :class:`_orm.registry` object. The new class
provides three events: :meth:`_orm.RegistryEvents.resolve_type_annotation`
which allows customization of type annotation resolution that can
supplement or replace the use of the
:paramref:`.registry.type_annotation_map` dictionary, including that it can
be helpful with custom resolution for complex types such as those of
:pep:`695`, as well as :meth:`_orm.RegistryEvents.before_configured` and
:meth:`_orm.RegistryEvents.after_configured`, which are registry-local
forms of the mapper-wide version of these hooks.

note this change was prematurely merged in 7111dc0cbaae and reverted
for re-review and additional changes.

Fixes: #9832
(cherry picked from commit 7111dc0cbaae2070173e9f4a054745ee7d036dfa)
Change-Id: I8d69f5c7e0d004f98b7449fefe87a03bb0f29e39

7 weeks agoMerge "Add FunctionElement.aggregate_order_by" into main
Michael Bayer [Fri, 19 Sep 2025 16:37:55 +0000 (16:37 +0000)] 
Merge "Add FunctionElement.aggregate_order_by" into main

7 weeks agoclarify clauses argument for order_by, group_by
Mike Bayer [Fri, 19 Sep 2025 14:32:43 +0000 (10:32 -0400)] 
clarify clauses argument for order_by, group_by

Change-Id: Idabfde4a6850a2649a2f32dc42d0320f1ec7692d

7 weeks agoAdd FunctionElement.aggregate_order_by
Reuven Starodubski [Thu, 11 Sep 2025 17:33:59 +0000 (13:33 -0400)] 
Add FunctionElement.aggregate_order_by

Added new generalized aggregate function ordering to functions via the
:func:`_functions.FunctionElement.aggregate_order_by` method, which
receives an expression and generates the appropriate embedded "ORDER BY" or
"WITHIN GROUP (ORDER BY)" phrase depending on backend database.  This new
function supersedes the use of the PostgreSQL
:func:`_postgresql.aggregate_order_by` function, which remains present for
backward compatibility.   To complement the new parameter, the
:paramref:`_functions.aggregate_strings.order_by` which adds ORDER BY
capability to the :class:`_functions.aggregate_strings` dialect-agnostic
function which works for all included backends. Thanks much to Reuven
Starodubski with help on this patch.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #12853
Closes: #12856
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12856
Pull-request-sha: d93fb591751227eb1f96052ea3ad449f511f70b3

Change-Id: I8eb41ff2d57695963a358b5f0017ca9372f15f70

7 weeks agounmapped_dataclass
Mike Bayer [Mon, 14 Jul 2025 17:50:09 +0000 (13:50 -0400)] 
unmapped_dataclass

Reworked the handling of classes which extend from MappedAsDataclass but
are not themselves mapped, i.e. the declarative base as well as any
mixins or abstract classes.  These classes as before are turned into
real dataclasses, however a scan now takes place across the mapped
elements such as mapped_column(), relationship(), etc. so that we may
also take into account dataclasses.field-specific parameters like
init=False, repr, etc.  The main use case for this is so that mixin
dataclasses may make use of "default" in fields while not being rejected
by the dataclasses constructor.  The generated classes are more
functional as dataclasses in a standalone fashion as well, even though
this is not their intended use.  As a standalone dataclass, the one
feature that does not work is a field that has
a default with init=False, because we still need to have a
mapped_column() or similar present at the class level for the class
to work as a superclass.

The change also addes the :func:`_orm.unmapped_dataclass` decorator
function, which may be used
to create unmapped superclasses in a mapped hierarchy that is using the
:func:`_orm.mapped_dataclass` decorator to create mapped dataclasses.
Previously there was no way to use unmapped dataclass mixins with
the decorator approach.

Finally, the warning added in 2.0 for :ticket:`9350` is turned into
an error as mentioned for 2.1, since we're deep into dataclass hierarchy
changes here.

Fixes: #12854
Change-Id: I11cd8c628d49e9ff1bdbda8a09f4112b40d84be7

7 weeks agoMerge "Fix get_columns sqlite reflection rejecting tables with WITHOUT_ROWID and...
Michael Bayer [Mon, 15 Sep 2025 21:55:45 +0000 (21:55 +0000)] 
Merge "Fix get_columns sqlite reflection rejecting tables with WITHOUT_ROWID and/or STRICT for generated column case" into main

7 weeks agoRevert "add RegistryEvents"
Mike Bayer [Mon, 15 Sep 2025 21:26:29 +0000 (17:26 -0400)] 
Revert "add RegistryEvents"

This reverts commit 7111dc0cbaae2070173e9f4a054745ee7d036dfa.

Review had 18 comments still open

7 weeks agoFix get_columns sqlite reflection rejecting tables with WITHOUT_ROWID and/or STRICT...
Tip ten Brink [Mon, 15 Sep 2025 12:58:40 +0000 (08:58 -0400)] 
Fix get_columns sqlite reflection rejecting tables with WITHOUT_ROWID and/or STRICT for generated column case

Fixed issue where SQLite table reflection would fail for tables using
``WITHOUT ROWID`` and/or ``STRICT`` table options when the table contained
generated columns. The regular expression used to parse ``CREATE TABLE``
statements for generated column detection has been updated to properly
handle these SQLite table options that appear after the column definitions.
Pull request courtesy Tip ten Brink.

Fixes: #12864
Closes: #12865
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12865
Pull-request-sha: 833420afc72f1918a9ca315209ce6664a18ba07f

Change-Id: Ia25c05746055a66234531b4f1275bd3a2f3b44ad

7 weeks agoMerge "add RegistryEvents" into main
Michael Bayer [Mon, 15 Sep 2025 13:42:17 +0000 (13:42 +0000)] 
Merge "add RegistryEvents" into main

7 weeks agoremove confusing "with_parent()" from query-enabled properties example
Mike Bayer [Sat, 13 Sep 2025 13:54:38 +0000 (09:54 -0400)] 
remove confusing "with_parent()" from query-enabled properties example

references: #12862
Change-Id: I22ee9fa0c566458a465867e307a77c2eb0ddcdd0