]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 months agooptimize `@util.decorator`
Inada Naoki [Mon, 7 Apr 2025 23:55:48 +0000 (19:55 -0400)] 
optimize `@util.decorator`

### Description

util.decorator uses code generation + eval to create signature matching wrapper.
It consumes some CPU because we can not use pyc cache.

Additionally, each wrapped function has own globals for function annotations.

By stripping function annotations from eval-ed code, compile time and memory usage are saved.

```python
from sqlalchemy.util import decorator
from sqlalchemy import *
import timeit
import tracemalloc
import sqlalchemy.orm._orm_constructors

@decorator
def with_print(fn, *args, **kwargs):
    res = fn(*args, **kwargs)
    print(f"{fn.__name__}(*{args}, **{kwargs}) => {res}")
    return res

# test
PI = 3.14

def f():
    @with_print
    def add(x: int|float, *, y: int|float=PI) -> int|float:
        return x + y
    return add

add = f()
add(1)
print(add.__annotations__)

# benchmark
print(timeit.timeit(f, number=1000)*1000, "us")

# memory
tracemalloc.start(1)
[f() for _ in range(1000)]
mem, peak = tracemalloc.get_traced_memory()
tracemalloc.stop()
print(f"{mem=}, {peak=}")
```

Result:
```
$ .venv/bin/python -VV
Python 3.14.0a6 (main, Mar 17 2025, 21:27:10) [Clang 20.1.0 ]

$ .venv/bin/python sample.py
add(*(1,), **{'y': 3.14}) => 4.140000000000001
{'x': int | float, 'y': int | float, 'return': int | float}
35.93937499681488 us
mem=9252896, peak=9300808

$ git switch -
Switched to branch 'opt-decorator'

$ .venv/bin/python sample.py
add(*(1,), **{'y': 3.14}) => 4.140000000000001
{'x': int | float, 'y': int | float, 'return': int | float}
23.32574996398762 us
mem=1439032, peak=1476423
```

### 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
- [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.

Closes: #12502
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12502
Pull-request-sha: 34409cbbfd2dee65bf86a85a87e415c9af47dc62

Change-Id: I88b88eb6eb018608bc2881459f58564881d06641
(cherry picked from commit 370f13fe88ec5e4ee2400e23717db1e13df102bf)

6 months agoMerge "Support postgresql_include in UniqueConstraint and PrimaryKeyConstraint" into...
Federico Caselli [Fri, 4 Apr 2025 19:04:13 +0000 (19:04 +0000)] 
Merge "Support postgresql_include in UniqueConstraint and PrimaryKeyConstraint" into rel_2_0

6 months agoMerge "improve overloads applied to generic functions" into rel_2_0
Federico Caselli [Thu, 3 Apr 2025 19:22:52 +0000 (19:22 +0000)] 
Merge "improve overloads applied to generic functions" into rel_2_0

6 months agodocs: Fix substr function starting index in hybrid_property example (#12482)
krave1986 [Thu, 3 Apr 2025 18:55:36 +0000 (02:55 +0800)] 
docs: Fix substr function starting index in hybrid_property example (#12482)

(cherry picked from commit 0c1824c666c55ae19051feb4970060385c674bb3)

6 months agoimprove overloads applied to generic functions
Federico Caselli [Mon, 24 Mar 2025 20:50:45 +0000 (21:50 +0100)] 
improve overloads applied to generic functions

try again to remove the overloads to the generic functionn
generator (like coalesce, array_agg, etc).
As of mypy 1.15 it still does now work, but a simpler version
is added in this change

Change-Id: I8b97ae00298ec6f6bf8580090e5defff71e1ceb0
(cherry picked from commit 5cc6a65c61798078959455f5d74f535681c119b7)

6 months agoFix typo (#12495)
Adriaan Joubert [Thu, 3 Apr 2025 17:56:29 +0000 (20:56 +0300)] 
Fix typo (#12495)

(cherry picked from commit 51007fe428d87e5d5bfc2c04cd4224fda2e00879)

6 months agoensure ON UPDATE test is case insensitive
Alexander Ruehe [Tue, 1 Apr 2025 21:52:12 +0000 (17:52 -0400)] 
ensure ON UPDATE test is case insensitive

Fixed regression caused by the DEFAULT rendering changes in 2.0.40
:ticket:`12425` where using lowercase `on update` in a MySQL server default
would incorrectly apply parenthesis, leading to errors when MySQL
interpreted the rendered DDL.  Pull request courtesy Alexander Ruehe.

Fixes: #12488
Closes: #12489
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12489
Pull-request-sha: b9008f747d21bc06a4006c99a47fc6aa99407636

Change-Id: If5281c52415e4ddb6c2f8aee191d2335f6673b35
(cherry picked from commit 6f8f4a7d620f19afce8b8d43c25ff5ca5a466038)

6 months agoSupport postgresql_include in UniqueConstraint and PrimaryKeyConstraint
Denis Laxalde [Tue, 1 Apr 2025 17:30:48 +0000 (13:30 -0400)] 
Support postgresql_include in UniqueConstraint and PrimaryKeyConstraint

This is supported both for schema definition and reflection.

Fixes #10665.

Closes: #12485
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12485
Pull-request-sha: 1aabea7b55ece9fc0c6e069b777d4404ac01f964

Change-Id: I81d23966f84390dd1b03f0d13284ce6d883ee24e
(cherry picked from commit 3b7725dd1243134341cf1bfb331ed4501fc882e8)

6 months agominor cleanup of postgresql index reflection query
Federico Caselli [Tue, 1 Apr 2025 21:49:36 +0000 (23:49 +0200)] 
minor cleanup of postgresql index reflection query

Change-Id: I669ea8e99c6b69cb70263b0cacd80d3ed0fab39c
(cherry picked from commit 08619693794ebcd6671448658ce4c8bce7763ff0)

6 months agoAdd type annotations to postgresql.pg_catalog
Denis Laxalde [Tue, 25 Mar 2025 08:51:30 +0000 (04:51 -0400)] 
Add type annotations to postgresql.pg_catalog

Related to #6810.

Closes: #12462
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12462
Pull-request-sha: 5a131cc9a94a2c9efa0e888fe504ebc03d84c7f0

Change-Id: Ie4494d61f815edefef6a896499db4292fd94a22a
(cherry picked from commit 864f79d7c421cfa01b6e01eb95b76ffe77ff44d1)

6 months agoVersion 2.0.41 placeholder
Mike Bayer [Thu, 27 Mar 2025 17:52:56 +0000 (13:52 -0400)] 
Version 2.0.41 placeholder

6 months ago- 2.0.40 rel_2_0_40
Mike Bayer [Thu, 27 Mar 2025 16:48:32 +0000 (12:48 -0400)] 
- 2.0.40

6 months agochangelog update
Mike Bayer [Thu, 27 Mar 2025 16:47:43 +0000 (12:47 -0400)] 
changelog update

Change-Id: I03202183f4045030bc2940c43d637edc3524b5d4
(cherry picked from commit dd0b44b123738ba9289e120d3e3d8238d7741ea7)

6 months agoMerge "Type array_agg()" into rel_2_0
Michael Bayer [Thu, 27 Mar 2025 16:34:41 +0000 (16:34 +0000)] 
Merge "Type array_agg()" into rel_2_0

6 months agoMerge "implement AsyncSessionTransaction._regenerate_proxy_for_target" into rel_2_0
Michael Bayer [Thu, 27 Mar 2025 16:30:10 +0000 (16:30 +0000)] 
Merge "implement AsyncSessionTransaction._regenerate_proxy_for_target" into rel_2_0

6 months agoimplement AsyncSessionTransaction._regenerate_proxy_for_target
Mike Bayer [Wed, 26 Mar 2025 17:55:46 +0000 (13:55 -0400)] 
implement AsyncSessionTransaction._regenerate_proxy_for_target

Fixed issue where :meth:`.AsyncSession.get_transaction` and
:meth:`.AsyncSession.get_nested_transaction` would fail with
``NotImplementedError`` if the "proxy transaction" used by
:class:`.AsyncSession` were garbage collected and needed regeneration.

Fixes: #12471
Change-Id: Ia8055524618df706d7958786a500cdd25d9d8eaf
(cherry picked from commit 0202673a34b1b0cbbda6e2cb06012f77df642085)

6 months agoImplement GROUPS frame spec for window functions
Kaan [Wed, 19 Mar 2025 15:58:30 +0000 (11:58 -0400)] 
Implement GROUPS frame spec for window functions

Implemented support for the GROUPS frame specification in window functions
by adding :paramref:`_sql.over.groups` option to :func:`_sql.over`
and :meth:`.FunctionElement.over`. Pull request courtesy Kaan Dikmen.

Fixes: #12450
Closes: #12445
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12445
Pull-request-sha: c0808e135f15c7fef3a3abcf28465673f38eb428

Change-Id: I9ff504a9c9650485830c4a0eaf44162898a3a2ad
(cherry picked from commit 0bbc515f904446d3f0beede54321b628f32fbdad)

6 months agocompatibility with typing_extensions 4.13 and type statement
Daraan [Wed, 26 Mar 2025 18:27:46 +0000 (14:27 -0400)] 
compatibility with typing_extensions 4.13 and type statement

Fixed regression caused by ``typing_extension==4.13.0`` that introduced
a different implementation for ``TypeAliasType`` while SQLAlchemy assumed
that it would be equivalent to the ``typing`` version.

Added test regarding generic TypeAliasType

Fixes: #12473
Closes: #12472
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12472
Pull-request-sha: 8861a5acfb8e81663413ff144b41abf64779b6fd

Change-Id: I053019a222546a625ed6d588314ae9f5b34c2f8a
(cherry picked from commit 61970f9d2b7809116b5a9d339b45d910e276b428)

6 months agodocument sqlite truncate_microseconds in DATETIME and TIME
Federico Caselli [Wed, 26 Mar 2025 20:43:10 +0000 (21:43 +0100)] 
document sqlite truncate_microseconds in DATETIME and TIME

Change-Id: I93412d951b466343f2cf9b6d513ad46d17f5d8ee
(cherry picked from commit a9b37199133eea81ebdf062439352ef2745d3c00)

6 months agoType array_agg()
Denis Laxalde [Mon, 24 Mar 2025 20:35:07 +0000 (16:35 -0400)] 
Type array_agg()

The return type of `array_agg()` is declared as a `Sequence[T]` where `T` is bound to the type of input argument.

This is implemented by making `array_agg()` inheriting from `ReturnTypeFromArgs` which provides appropriate overloads of `__init__()` to support this.

This usage of ReturnTypeFromArgs is a bit different from previous ones as the return type of the function is not exactly the same as that of its arguments, but a "collection" (a generic, namely a Sequence here) of the argument types.  Accordingly, we adjust the code of `tools/generate_sql_functions.py` to retrieve the "collection" type from 'fn_class' annotation and generate expected return type.

Also add a couple of hand-written typing tests for PostgreSQL.

Related to #6810

Closes: #12461
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12461
Pull-request-sha: ba27cbb8639dcd35127ab6a2928b7b5b3667e287

Change-Id: I3fd538cc7092a0492c26970f0b825bf70ddb66cd
(cherry picked from commit 543acbd8d1c7e3037877ca74a6b05f62592ef153)

6 months agoIncrease minimum required greenlet version
Chris Withers [Tue, 25 Mar 2025 19:05:23 +0000 (15:05 -0400)] 
Increase minimum required greenlet version

Add a lower bound constraint on the greenlet version to 1.

Closes: #12459
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12459
Pull-request-sha: 4bd856b9c164df984f05c094c977686470ed4244

Change-Id: I200861f1706bf261c2e586b96e8cc35dceb7670b
(cherry picked from commit 938e0fee9b834aca8b22034c75ffadefdfbaaf5f)

6 months agoAdd missing imports to example (#12453)
Stefanie Molin [Tue, 25 Mar 2025 19:05:44 +0000 (15:05 -0400)] 
Add missing imports to example (#12453)

(cherry picked from commit aae34df0b5aa7dfe02bdc19744b1b6bc8533ee91)

6 months agoMerge "Cast empty PostgreSQL ARRAY from the type specified to array()" into rel_2_0
Michael Bayer [Thu, 20 Mar 2025 01:41:57 +0000 (01:41 +0000)] 
Merge "Cast empty PostgreSQL ARRAY from the type specified to array()" into rel_2_0

6 months agoCast empty PostgreSQL ARRAY from the type specified to array()
Denis Laxalde [Wed, 19 Mar 2025 08:17:27 +0000 (04:17 -0400)] 
Cast empty PostgreSQL ARRAY from the type specified to array()

When building a PostgreSQL ``ARRAY`` literal using
:class:`_postgresql.array` with an empty ``clauses`` argument, the
:paramref:`_postgresql.array.type_` parameter is now significant in that it
will be used to render the resulting ``ARRAY[]`` SQL expression with a
cast, such as ``ARRAY[]::INTEGER``. Pull request courtesy Denis Laxalde.

Fixes: #12432
Closes: #12435
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12435
Pull-request-sha: 9633d3c15d42026f8f45f5a4d201a5d72e57b8d4

Change-Id: I29ed7bd0562b82351d22de0658fb46c31cfe44f6
(cherry picked from commit 588cc6ed8e95f3fdd0920fd49a0992e7739662fc)

6 months agoMerge "skip FROM disambiguation for immediate alias of table" into rel_2_0
Michael Bayer [Wed, 19 Mar 2025 23:58:31 +0000 (23:58 +0000)] 
Merge "skip FROM disambiguation for immediate alias of table" into rel_2_0

6 months agoMerge "Make ARRAY generic on the item_type" into rel_2_0
Michael Bayer [Wed, 19 Mar 2025 22:43:22 +0000 (22:43 +0000)] 
Merge "Make ARRAY generic on the item_type" into rel_2_0

6 months agoskip FROM disambiguation for immediate alias of table
Mike Bayer [Wed, 19 Mar 2025 22:30:21 +0000 (18:30 -0400)] 
skip FROM disambiguation for immediate alias of table

Fixed regression caused by :ticket:`7471` leading to a SQL compilation
issue where name disambiguation for two same-named FROM clauses with table
aliasing in use at the same time would produce invalid SQL in the FROM
clause with two "AS" clauses for the aliased table, due to double aliasing.

Fixes: #12451
Change-Id: I981823f8f2cdf3992d65ace93a21fc20d1d74cda
(cherry picked from commit 9ea3be0681dc09338e53b63cea4803de80ebcdc7)

6 months agoremove attrs w/ orm annotated declarative example
Mike Bayer [Wed, 19 Mar 2025 12:59:54 +0000 (08:59 -0400)] 
remove attrs w/ orm annotated declarative example

as pointed out at
https://github.com/sqlalchemy/sqlalchemy/discussions/12449, ORM
annotated declarative is not compatible with attrs, declarative
cannot be used with attrs.

Change-Id: Ief6d1dca65b96164f48264a999c85bcae8dc3bb1
(cherry picked from commit 780d37777ea26bf88fa36388b516664fa0c11955)

6 months agoMake ARRAY generic on the item_type
Denis Laxalde [Tue, 18 Mar 2025 16:23:01 +0000 (12:23 -0400)] 
Make ARRAY generic on the item_type

Now `Column(type_=ARRAY(Integer)` is inferred as `Column[Sequence[int]]` instead as `Column[Sequence[Any]]` previously. This only works with the `type_` argument to Column, but that's not new.

This follows from a suggestion at
https://github.com/sqlalchemy/sqlalchemy/pull/12386#issuecomment-2694056069.

Related to #6810.

Closes: #12443
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12443
Pull-request-sha: 2fff4e89cd0b72d9444ce3f3d845b152770fc55d

Change-Id: I87b828fd82d10fbf157141db3c31f0ec8149caad
(cherry picked from commit 500adfafcb782c5b22ff49e00192a2ed42ed09b6)

6 months agoMerge "expand paren rules for default rendering, sqlite/mysql" into rel_2_0
Michael Bayer [Tue, 18 Mar 2025 12:17:33 +0000 (12:17 +0000)] 
Merge "expand paren rules for default rendering, sqlite/mysql" into rel_2_0

6 months agoensure SQL expressions w/o bool pass through to correct typing error
Mike Bayer [Mon, 17 Mar 2025 20:46:12 +0000 (16:46 -0400)] 
ensure SQL expressions w/o bool pass through to correct typing error

Fixed regression which occurred as of 2.0.37 where the checked
:class:`.ArgumentError` that's raised when an inappropriate type or object
is used inside of a :class:`.Mapped` annotation would raise ``TypeError``
with "boolean value of this clause is not defined" if the object resolved
into a SQL expression in a boolean context, for programs where future
annotations mode was not enabled.  This case is now handled explicitly and
a new error message has also been tailored for this case.  In addition, as
there are at least half a dozen distinct error scenarios for intepretation
of the :class:`.Mapped` construct, these scenarios have all been unified
under a new subclass of :class:`.ArgumentError` called
:class:`.MappedAnnotationError`, to provide some continuity between these
different scenarios, even though specific messaging remains distinct.

Fixes: #12329
Change-Id: I0193e3479c84a48b364df8655f050e2e84151122
(cherry picked from commit b19a09812c2b0806cc063e42993216fc1ead6ed2)

6 months agoMerge "Support column list for foreign key ON DELETE SET actions on PostgreSQL" into...
Michael Bayer [Mon, 17 Mar 2025 21:30:49 +0000 (21:30 +0000)] 
Merge "Support column list for foreign key ON DELETE SET actions on PostgreSQL" into rel_2_0

6 months agofix rst target for Insert
Federico Caselli [Mon, 17 Mar 2025 20:33:31 +0000 (21:33 +0100)] 
fix rst target for Insert

Change-Id: Iee0b8e90223722c40b25c309c47fd6175680ca0e
(cherry picked from commit 6047ccd72b7ec6e3730845985ec46fa3a7dce07d)

6 months agoexpand paren rules for default rendering, sqlite/mysql
Mike Bayer [Wed, 12 Mar 2025 20:25:48 +0000 (16:25 -0400)] 
expand paren rules for default rendering, sqlite/mysql

Expanded the rules for when to apply parenthesis to a server default in DDL
to suit the general case of a default string that contains non-word
characters such as spaces or operators and is not a string literal.

Fixed issue in MySQL server default reflection where a default that has
spaces would not be correctly reflected.  Additionally, expanded the rules
for when to apply parenthesis to a server default in DDL to suit the
general case of a default string that contains non-word characters such as
spaces or operators and is not a string literal.

Fixes: #12425
Change-Id: Ie40703dcd5fdc135025d676c01baba57ff3b71ad
(cherry picked from commit 1afb820427545e259397b98851a910d7379b2eb8)

6 months agoSupport column list for foreign key ON DELETE SET actions on PostgreSQL
Denis Laxalde [Thu, 13 Mar 2025 12:43:53 +0000 (08:43 -0400)] 
Support column list for foreign key ON DELETE SET actions on PostgreSQL

Added support for specifying a list of columns for ``SET NULL`` and ``SET
DEFAULT`` actions of ``ON DELETE`` clause of foreign key definition on
PostgreSQL.  Pull request courtesy Denis Laxalde.

Fixes: #11595
Closes: #12421
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12421
Pull-request-sha: d0394db7066ba8a8eaf3d3972d779f3e170e9406

Change-Id: I036a559ae4a8efafe9ba64d776a840bd785a7397
(cherry picked from commit 39bb17442ce6ac9a3dde5e2b72376b77ffce5e28)

6 months agoMerge "miscellaneous to type dialects" into rel_2_0
Michael Bayer [Mon, 17 Mar 2025 17:35:30 +0000 (17:35 +0000)] 
Merge "miscellaneous to type dialects" into rel_2_0

6 months agoMerge "Add type annotations to `postgresql.array`" into rel_2_0
Michael Bayer [Mon, 17 Mar 2025 17:29:39 +0000 (17:29 +0000)] 
Merge "Add type annotations to `postgresql.array`" into rel_2_0

6 months agoAdd type annotations to `postgresql.array`
Denis Laxalde [Fri, 14 Mar 2025 21:01:50 +0000 (17:01 -0400)] 
Add type annotations to `postgresql.array`

Improved static typing for `postgresql.array()` by making the type parameter (the type of array's elements) inferred from the `clauses` and `type_` arguments while also ensuring they are consistent.

Also completed type annotations of `postgresql.ARRAY` following commit 0bf7e02afbec557eb3a5607db407f27deb7aac77 and added type annotations for functions `postgresql.Any()` and `postgresql.All()`.

Finally, fixed shadowing `typing.Any` by the `Any()` function through aliasing as `typing_Any`.

Related to #6810

Closes: #12384
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12384
Pull-request-sha: 78eea29f1de850afda036502974521969629de7e

Change-Id: I5d35d15ec8ba4d58eeb9bf00abb710e2e585731f
(cherry picked from commit 75c8e112c9362f89787d8fc25a6a200700052450)

6 months agomiscellaneous to type dialects
Pablo Estevez [Sat, 8 Feb 2025 15:46:24 +0000 (10:46 -0500)] 
miscellaneous to type dialects

Type of certain methods that are called by dialect, so typing dialects is easier.

Related to https://github.com/sqlalchemy/sqlalchemy/pull/12164

breaking changes:

- Change modifiers from TextClause to InmutableDict, from Mapping, as is in the other classes

Closes: #12231
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12231
Pull-request-sha: 514fe4751c7b1ceefffed2a4ef9c8df339bd9c25

Change-Id: I29314045b2c7eb5428f8d6fec8911c4b6d5ae73e
(cherry picked from commit 4418ef79104a0e4591ff8268d75f1deb59bfcec3)

6 months agoanonymize CRUD params if visiting_cte is present
Mike Bayer [Fri, 14 Mar 2025 14:33:22 +0000 (10:33 -0400)] 
anonymize CRUD params if visiting_cte is present

Fixed issue in :class:`.CTE` constructs involving multiple DDL
:class:`.Insert` statements with multiple VALUES parameter sets where the
bound parameter names generated for these parameter sets would conflict,
generating a compile time error.

Fixes: #12363
Change-Id: If8344ff725d4e0ec58d3ff61f38a0edcfc5bdebd
(cherry picked from commit ec20f346a6ed6e5c6de3ee6b6972cf13dba4752d)

6 months agoMerge "re-support mysql-connector python" into rel_2_0
Michael Bayer [Fri, 14 Mar 2025 12:58:32 +0000 (12:58 +0000)] 
Merge "re-support mysql-connector python" into rel_2_0

6 months agoComplement type annotations for ARRAY
Denis Laxalde [Wed, 5 Mar 2025 20:59:39 +0000 (15:59 -0500)] 
Complement type annotations for ARRAY

This complements the type annotations of the `ARRAY` class, in preparation of #12384.

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.
- [x] 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.

Related to https://github.com/sqlalchemy/sqlalchemy/issues/6810

Closes: #12386
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12386
Pull-request-sha: c9513ce729fa1116b46b02336d4e2cda3d096fee

Change-Id: If9df4708c8e597eedc79ee3990792fa6c72f1afe
(cherry picked from commit 0bf7e02afbec557eb3a5607db407f27deb7aac77)

6 months agore-support mysql-connector python
Mike Bayer [Sun, 23 Feb 2025 16:20:18 +0000 (11:20 -0500)] 
re-support mysql-connector python

Support has been re-added for the MySQL-Connector/Python DBAPI using the
``mysql+mysqlconnector://`` URL scheme.   The DBAPI now works against
modern MySQL versions as well as MariaDB versions (in the latter case it's
required to pass charset/collation explicitly).   Note however that
server side cursor support is disabled due to unresolved issues with this
driver.

note the 2.0 backport here necessarily needs to also backport some
of 49ce245998 to handle the mariadb database working under mysql
connector.

References: #12332
Change-Id: I81279478196e830d3c0d5f24ecb3fe2dc18d4ca6
(cherry picked from commit b056dd2c5ab71ce4143a95cd0fdd4a4190de19e6)

6 months agoVersion 2.0.40 placeholder
Mike Bayer [Tue, 11 Mar 2025 18:27:27 +0000 (14:27 -0400)] 
Version 2.0.40 placeholder

6 months ago- 2.0.39 rel_2_0_39
Mike Bayer [Tue, 11 Mar 2025 18:18:59 +0000 (14:18 -0400)] 
- 2.0.39

6 months agoMerge "Ensure PostgreSQL network address types are not cast as VARCHAR" into rel_2_0
Michael Bayer [Tue, 11 Mar 2025 18:07:14 +0000 (18:07 +0000)] 
Merge "Ensure PostgreSQL network address types are not cast as VARCHAR" into rel_2_0

6 months agoEnsure PostgreSQL network address types are not cast as VARCHAR
Denis Laxalde [Tue, 11 Mar 2025 13:27:13 +0000 (09:27 -0400)] 
Ensure PostgreSQL network address types are not cast as VARCHAR

Fixed issue in PostgreSQL network types :class:`_postgresql.INET`,
:class:`_postgresql.CIDR`, :class:`_postgresql.MACADDR`,
:class:`_postgresql.MACADDR8` where sending string values to compare to
these types would render an explicit CAST to VARCHAR, causing some SQL /
driver combinations to fail.  Pull request courtesy Denis Laxalde.

Fixes: #12060
Closes: #12412
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12412
Pull-request-sha: 029fda7f2d182af71ebc48aef191aa9114927f28

Change-Id: Id4a502ebc119775567cacddbabef2ce9715c1a9f
(cherry picked from commit f91e61e5c80004db6db47f4e13f37553ff22675a)

6 months agoconsolidate kwargs for "FOR UPDATE OF"
Mike Bayer [Tue, 11 Mar 2025 12:33:30 +0000 (08:33 -0400)] 
consolidate kwargs for "FOR UPDATE OF"

Fixed compiler issue in the PostgreSQL dialect where incorrect keywords
would be passed when using "FOR UPDATE OF" inside of a subquery.

Fixes: #12417
Change-Id: I6255d165e8e719e1786e78aa60ee8e6a95af1dcb
(cherry picked from commit 21630d2574328a0f01a1e994e264f56f1adf99db)

7 months agoImprove identity column reflection
Federico Caselli [Mon, 3 Mar 2025 22:35:48 +0000 (23:35 +0100)] 
Improve identity column reflection

Add SQL typing to reflection query used to retrieve a the structure
of IDENTITY columns, adding explicit JSON typing to the query to suit
unusual PostgreSQL driver configurations that don't support JSON natively.

Fixed issue affecting PostgreSQL 17.3 and greater where reflection of
domains with "NOT NULL" as part of their definition would include an
invalid constraint entry in the data returned by
:meth:`_postgresql.PGInspector.get_domains` corresponding to an additional
"NOT NULL" constraint that isn't a CHECK constraint; the existing
``"nullable"`` entry in the dictionary already indicates if the domain
includes a "not null" constraint.   Note that such domains also cannot be
reflected on PostgreSQL 17.0 through 17.2 due to a bug on the PostgreSQL
side; if encountering errors in reflection of domains which include NOT
NULL, upgrade to PostgreSQL server 17.3 or greater.

Fixes: #11751
Change-Id: I8e69de51601dca3257186e38c6f699fbfd9014c6
(cherry picked from commit b23b6db14ac33a792520a5036af1ab02157b7df6)

7 months agoAdd type annotations to `postgresql.json`
Denis Laxalde [Tue, 4 Mar 2025 20:28:47 +0000 (15:28 -0500)] 
Add type annotations to `postgresql.json`

(Same as https://github.com/sqlalchemy/sqlalchemy/pull/12384, but for `json`.)

### 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.
- [x] 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.

Related to #6810

**Have a nice day!**

Closes: #12391
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12391
Pull-request-sha: 0a43724f1737a4519629a13e2d6bf33f7aecb9ac

Change-Id: I2a0e88effccf351de7fa72389ee646532ce9cf69
(cherry picked from commit c7f4e8b9370487135777677eaf4d8992825c24aa)

7 months agotest related fixes
Federico Caselli [Wed, 5 Mar 2025 18:28:30 +0000 (19:28 +0100)] 
test related fixes

improve test error logging
remove obsolete emulated pipeline
fix test in python 3.8
add order to test

Change-Id: I2003f256a2690ee5673c72e2f1cb1340af750f83

7 months agoensure compiler is not optional in create_for_statement()
Mike Bayer [Mon, 3 Mar 2025 22:01:15 +0000 (17:01 -0500)] 
ensure compiler is not optional in create_for_statement()

this involved moving some methods around and changing the
target of legacy orm/query.py calling upon this method to
use an ORM-specific method instead

(cherry picked from commit d9b4d8ff3aae504402d324f3ebf0b8faff78f5dc)
Change-Id: I6f83a5b0e8f43a3eb633216c2f2fe2d28345e9bd

7 months agoRevert "ensure compiler is not optional in create_for_statement()"
Federico Caselli [Tue, 4 Mar 2025 20:42:08 +0000 (20:42 +0000)] 
Revert "ensure compiler is not optional in create_for_statement()"

This reverts commit b7e0ebe1ebbe6c0f97247a0854fc9ccfd9f763b1.

Reason for revert: this change included a bunch of generated c files

Change-Id: Ief8191394a91ebcf9315b24ef71659ccd8088bc8

7 months agoensure compiler is not optional in create_for_statement()
Mike Bayer [Mon, 3 Mar 2025 22:01:15 +0000 (17:01 -0500)] 
ensure compiler is not optional in create_for_statement()

this involved moving some methods around and changing the
target of legacy orm/query.py calling upon this method to
use an ORM-specific method instead

Change-Id: Ib977f08e52398d0e082acf7d88abecb9908ca8b6
(cherry picked from commit d9b4d8ff3aae504402d324f3ebf0b8faff78f5dc)

7 months agoallow control of constraint isolation w/ add/drop constraint
Mike Bayer [Thu, 27 Feb 2025 17:04:12 +0000 (12:04 -0500)] 
allow control of constraint isolation w/ add/drop constraint

Added new parameters :paramref:`.AddConstraint.isolate_from_table` and
:paramref:`.DropConstraint.isolate_from_table`, defaulting to True, which
both document and allow to be controllable the long-standing behavior of
these two constructs blocking the given constraint from being included
inline within the "CREATE TABLE" sequence, under the assumption that
separate add/drop directives were to be used.

Fixes: #12382
Change-Id: I53c4170ccb5803f69945ba7aa3d3a143131508eb
(cherry picked from commit d6f11d9030b325d5afabf87869a6e3542edda54b)

7 months agoMerge "improve rowmapping key type" into rel_2_0
Michael Bayer [Thu, 27 Feb 2025 16:01:11 +0000 (16:01 +0000)] 
Merge "improve rowmapping key type" into rel_2_0

7 months agoAdd more `requires` to tests for easier dialect tests management
Karol Gongola [Wed, 26 Feb 2025 10:06:16 +0000 (05:06 -0500)] 
Add more `requires` to tests for easier dialect tests management

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->
I am just going through starrocks dialect tests. I have figured out that adding some requires for tests may be useful also for other dialects. So this is a proposal of adding them to sqlalchemy. Please let me know if it is aligned with your approach.

### 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
- [ ] 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: #12362
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12362
Pull-request-sha: 932d341f5f16f0c5cadc39d3a67b0f10297177ce

Change-Id: If9fa9f7477040620d131dcbe087fb4b50fd08a08
(cherry picked from commit 24b86ad6e50d4a6723a45b2580f416ca981bab55)

7 months agoimprove rowmapping key type
Federico Caselli [Tue, 25 Feb 2025 22:06:55 +0000 (23:06 +0100)] 
improve rowmapping key type

the accepted keys are also orm attributes, column elements, functions
etc, not only columns

Change-Id: I354de9b9668bc02b8b305a3c1f065744b28f8030
(cherry picked from commit b2ee1df06b138fc9588ea312d4a477699ec9b5d0)

7 months agoMerge "various improvements to the docs" into rel_2_0
Michael Bayer [Tue, 25 Feb 2025 20:43:46 +0000 (20:43 +0000)] 
Merge "various improvements to the docs" into rel_2_0

7 months agofix docs typo
Federico Caselli [Mon, 24 Feb 2025 11:27:50 +0000 (12:27 +0100)] 
fix docs typo

Fixes: #12371
Change-Id: I86e6e34d407223d66b2cbcb21ec10dc292676449
(cherry picked from commit 15b1e14db21d2fa0bbc7b68e80883efb6334ad30)

7 months agoFix SQLite error for table with "WITHOUT ROWID" & "STRICT"
KingOfKaste [Thu, 20 Feb 2025 19:31:42 +0000 (14:31 -0500)] 
Fix SQLite error for table with "WITHOUT ROWID" & "STRICT"

Fixed issue that omitted the comma between multiple SQLite table extension
clauses, currently ``WITHOUT ROWID`` and ``STRICT``, when both options
:paramref:`.Table.sqlite_with_rowid` and  :paramref:`.Table.sqlite_strict`
were configured at their non-default settings at the same time.  Pull
request courtesy david-fed.

Fixes: #12368
Closes: #12369
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12369
Pull-request-sha: 3c9ceffe8279f5d961a44e6d468f21881bcbc75c

Change-Id: I1a44fd2d655d0e6eaad8213a360879daca9e4f11
(cherry picked from commit 48ad8c81115bd01d733fe1a4f78c8c30d7c2abbb)

7 months agocheck that two CTEs aren't just annotated forms of the same thing
Mike Bayer [Thu, 20 Feb 2025 17:50:25 +0000 (12:50 -0500)] 
check that two CTEs aren't just annotated forms of the same thing

Fixed issue where using :func:`_orm.aliased` around a :class:`.CTE`
construct could cause inappropriate "duplicate CTE" errors in cases where
that aliased construct appeared multiple times in a single statement.

Fixes: #12364
Change-Id: I9625cd83e9baf5312cdc644b38951353708d3b86
(cherry picked from commit 42ddb1fd5f1e29682bcd6ccc7b835999aafec12e)

7 months agoMerge "apply _propagate_attrs in _construct_for_list" into rel_2_0
Michael Bayer [Tue, 18 Feb 2025 17:57:19 +0000 (17:57 +0000)] 
Merge "apply _propagate_attrs in _construct_for_list" into rel_2_0

7 months agoMerge "Support generic types for union and union_all" into rel_2_0
Michael Bayer [Tue, 18 Feb 2025 17:18:25 +0000 (17:18 +0000)] 
Merge "Support generic types for union and union_all" into rel_2_0

7 months agoapply _propagate_attrs in _construct_for_list
Mike Bayer [Tue, 18 Feb 2025 15:20:32 +0000 (10:20 -0500)] 
apply _propagate_attrs in _construct_for_list

Fixed issue where the "is ORM" flag of a :func:`.select` or other ORM
statement would not be propagated to the ORM :class:`.Session` based on a
multi-part operator expression alone, e.g. such as ``Cls.attr + Cls.attr +
Cls.attr`` or similar, leading to ORM behaviors not taking place for such
statements.

Fixes: #12357
Change-Id: I61130eeb3c7a32c1830731fd9ad4eb99a64abf7d
(cherry picked from commit d0873ec7735f8238d74b860d6a8a85d55b2dbd1d)

7 months agoInclude status in the Pool docs
Federico Caselli [Mon, 17 Feb 2025 20:11:50 +0000 (21:11 +0100)] 
Include status in the Pool docs

Change-Id: I0a4bfc10f4cd0b7dbd3bf49e0575048b622fa4e8
(cherry picked from commit 890d5873397577865f5012319cdb4db9f793f98c)

7 months agominor docs fixes
Federico Caselli [Thu, 13 Feb 2025 22:17:12 +0000 (23:17 +0100)] 
minor docs fixes

Change-Id: I7379bc6904daac711063734d2f43aa5f6e734a0f
(cherry picked from commit 13677447a3185f68f613173a23110eade050d6e8)

7 months agovarious improvements to the docs
Federico Caselli [Thu, 13 Feb 2025 18:54:11 +0000 (19:54 +0100)] 
various improvements to the docs

- add create table with partition examples in mysql

Change-Id: Idc5c35519a0812f1d63be95c14afb9ce2b00ea93
(cherry picked from commit 9f11b63109cc4d1c5c0f268424fa83bb61460710)

7 months agoSupport generic types for union and union_all
Mingyu Park [Fri, 7 Feb 2025 19:45:26 +0000 (14:45 -0500)] 
Support generic types for union and union_all

Support generic types for compound selects (:func:`_sql.union`,
:func:`_sql.union_all`, :meth:`_sql.Select.union`,
:meth:`_sql.Select.union_all`, etc) returning the type of the first select.

Fixes: #11922
Closes: #12320
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12320
Pull-request-sha: f914a19f7201cec292056e900436d8c8431b9f87

Change-Id: I4fffa5d3fe93dd3a293b078360e326fea4207c5d
(cherry picked from commit fc44b5078b74081b0df94cca9d21b89ed578caf3)

7 months agofix(AsyncResult): Fix scalar method error due to missing attribute
allenyuchen [Wed, 12 Feb 2025 17:35:58 +0000 (12:35 -0500)] 
fix(AsyncResult): Fix scalar method error due to missing attribute

Fixed bug where :meth:`_asyncio.AsyncResult.scalar`,
:meth:`_asyncio.AsyncResult.scalar_one_or_none`, and
:meth:`_asyncio.AsyncResult.scalar_one` would raise an ``AttributeError``
due to a missing internal attribute.  Pull request courtesy Allen Ho.

Fixes: #12338
Closes: #12339
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12339
Pull-request-sha: 63ba43365e9624a75e3f206e6b0f4569e3940da6

Change-Id: I44a949e4a942a080338037cd570d4b1dc0d7550d
(cherry picked from commit ca092e73a254a3914fd93ca98340ba7762d4cee9)

7 months agoMerge "try pytest 8.3" into rel_2_0
Michael Bayer [Tue, 11 Feb 2025 02:20:27 +0000 (02:20 +0000)] 
Merge "try pytest 8.3" into rel_2_0

7 months agoMerge "reconcile #12326 and #12328" into rel_2_0
Michael Bayer [Tue, 11 Feb 2025 00:35:03 +0000 (00:35 +0000)] 
Merge "reconcile #12326 and #12328" into rel_2_0

7 months agotry pytest 8.3
Mike Bayer [Sun, 9 Feb 2025 23:30:11 +0000 (18:30 -0500)] 
try pytest 8.3

we've been pinned under 8.2 for unclear reasons (but likely
reasons).   see what 8.3 does.  current pypi release is 8.3.4

Change-Id: I601335f5604a37e07fd3bb0abb99160e055dd95c
(cherry picked from commit 6d78ad98d97dfd3a0917b3bccc29a655405e10a2)

7 months agoskip 3.7 on linux arm machines
Federico Caselli [Mon, 10 Feb 2025 20:44:00 +0000 (21:44 +0100)] 
skip 3.7 on linux arm machines

Change-Id: I6c1b4750b6df662d698a51f18bdfe08a305edc93

7 months agoreconcile #12326 and #12328
Mike Bayer [Mon, 10 Feb 2025 20:26:24 +0000 (15:26 -0500)] 
reconcile #12326 and #12328

These two issues both involve ORM DML RETURNING.   The looser
column inclusion rules given in #12328 then included a correlated
subquery column_property given in #12326, which does not work
in RETURNING.  so re-tighten UPDATE/DELETE with a more specific
rule to cut out local mapped props that are not persisted columns,
but still allow other mapped props through without blocking them.

Fixes: #12326
Change-Id: I8fe7b8ab9b85907e562648433fdb3c7ba160c0d0
(cherry picked from commit e88788bb0c1fa596ab63cb787b0438213040b10a)

7 months agoMerge "implement is_derived_from() for DML" into rel_2_0
Michael Bayer [Mon, 10 Feb 2025 13:20:20 +0000 (13:20 +0000)] 
Merge "implement is_derived_from() for DML" into rel_2_0

7 months agoonly use _DMLReturningColFilter for "bulk insert", not other DML
Mike Bayer [Sun, 9 Feb 2025 23:09:21 +0000 (18:09 -0500)] 
only use _DMLReturningColFilter for "bulk insert", not other DML

Fixed bug in ORM enabled UPDATE (and theoretically DELETE) where using a
multi-table DML statement would not allow ORM mapped columns from mappers
other than the primary UPDATE mapper to be named in the RETURNING clause;
they would be omitted instead and cause a column not found exception.

Fixes: #12328
Change-Id: I2223ee506eec447823a3a545eecad1a7a03364a9
(cherry picked from commit 1c7e3f9c94b2e6c441ba635a88573bc4cd88ad7d)

7 months agoimplement is_derived_from() for DML
Mike Bayer [Sat, 8 Feb 2025 16:38:53 +0000 (11:38 -0500)] 
implement is_derived_from() for DML

Fixed bug where using DML returning such as :meth:`.Insert.returning` with
an ORM model that has :func:`_orm.column_property` constructs that contain
subqueries would fail with an internal error.

Fixes: #12326
Change-Id: I419f645769a346c229944b30ac8fd4a0efe1646d
(cherry picked from commit b281402140683279c2aca2363f2acdb94929507f)

7 months agodoc(reconecting_engine): fix re-raise after attempts (#12306)
Augustin Prolongeau [Thu, 6 Feb 2025 23:18:57 +0000 (00:18 +0100)] 
doc(reconecting_engine): fix re-raise after attempts (#12306)

* doc(reconecting_engine): fix re-raise after attempts

* move re-raise after connection invalidation/rollback, reword log message

(cherry picked from commit 47dab9181c86e6a944411470885f6fe18a1fc15f)

7 months agoVersion 2.0.39 placeholder
Mike Bayer [Thu, 6 Feb 2025 20:10:27 +0000 (15:10 -0500)] 
Version 2.0.39 placeholder

7 months ago- 2.0.38 rel_2_0_38
Mike Bayer [Thu, 6 Feb 2025 20:06:47 +0000 (15:06 -0500)] 
- 2.0.38

7 months agothis is version 2.0.38
Mike Bayer [Thu, 6 Feb 2025 20:04:30 +0000 (15:04 -0500)] 
this is version 2.0.38

Change-Id: I784d0ba9e4afd9a7be6dac71cd04376dedbec211
(cherry picked from commit 960aade5b6ef14966f1bcf10c9a4c95f5f5a11d3)

7 months agochangelog edits
Mike Bayer [Thu, 6 Feb 2025 18:59:22 +0000 (13:59 -0500)] 
changelog edits

Change-Id: I61164f4af388d8f4f157ad6afe96ccbb668587a7
(cherry picked from commit f976e7b775eda7013338800889e125937910ad35)

7 months agoMerge "remove None exception in IN" into rel_2_0
Michael Bayer [Thu, 6 Feb 2025 15:14:40 +0000 (15:14 +0000)] 
Merge "remove None exception in IN" into rel_2_0

7 months agoMerge "reorganize column collection init to be local" into rel_2_0
Michael Bayer [Wed, 5 Feb 2025 20:56:29 +0000 (20:56 +0000)] 
Merge "reorganize column collection init to be local" into rel_2_0

7 months agoMerge "Use AsyncAdaptedQueuePool in aiosqlite" into rel_2_0
Michael Bayer [Wed, 5 Feb 2025 19:17:36 +0000 (19:17 +0000)] 
Merge "Use AsyncAdaptedQueuePool in aiosqlite" into rel_2_0

7 months agoremove None exception in IN
Mike Bayer [Wed, 5 Feb 2025 13:37:04 +0000 (08:37 -0500)] 
remove None exception in IN

Fixed SQL composition bug which impacted caching where using a ``None``
value inside of an ``in_()`` expression would bypass the usual "expanded
bind parameter" logic used by the IN construct, which allows proper caching
to take place.

Fixes: #12314
References: #12312
Change-Id: I0d2fc4e15c73407379ba368dd4ee32660fc66259
(cherry picked from commit 79505b03b61f622615be2d2bc1434671c29b0cc5)

7 months agoreorganize column collection init to be local
Mike Bayer [Sat, 1 Feb 2025 19:39:57 +0000 (14:39 -0500)] 
reorganize column collection init to be local

Reorganized the internals by which the `.c` collection on a
:class:`.FromClause` gets generated so that it is resilient against the
collection being accessed in concurrent fashion.   An example is creating a
:class:`.Alias` or :class:`.Subquery` and accessing it as a module level
variable.  This impacts the Oracle dialect which uses such module-level
global alias objects but is of general use as well.

Fixes: #12302
Change-Id: I30cb07c286affce24e2d85e49f9df5b787438d86
(cherry picked from commit 3cd9a5b42f850618141ec459cffe30d0ade0f191)

8 months agoFix 'polymorphic' typo in a few places (#12307)
Martin Burchell [Mon, 3 Feb 2025 18:56:55 +0000 (18:56 +0000)] 
Fix 'polymorphic' typo in a few places (#12307)

(cherry picked from commit 87c8d04d379a70aafb189f18801f0f375d99262b)

8 months agoUse AsyncAdaptedQueuePool in aiosqlite
Christophe Bornet [Fri, 31 Jan 2025 12:42:59 +0000 (07:42 -0500)] 
Use AsyncAdaptedQueuePool in aiosqlite

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
Change default pool in `aiosqlite` from `NullPool` to `AsyncAdaptedQueuePool`.
This ensures consistency with pysqlite and least surprise when migrating from sync to async.
See discussion in https://github.com/sqlalchemy/sqlalchemy/discussions/12285
Non regression tested by existing tests.

### 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
- [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: #12291
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12291
Pull-request-sha: 5a0872b8d431a6937eaf05fb132578aed5723b6a

Change-Id: I96b4d0b5154b34cd26d3ad89774229b0f5d8686f
(cherry picked from commit 11bac714a2e83f6f903b1faf36d744854635da66)

8 months agoMerge "Unable to use InstrumentedAttribute to value mappings in mysql/mariadb on_dupl...
Federico Caselli [Sat, 1 Feb 2025 20:50:15 +0000 (20:50 +0000)] 
Merge "Unable to use InstrumentedAttribute to value mappings in mysql/mariadb on_duplicate_key_update" into rel_2_0

8 months agomypy plugin is removed on 2.1, remove the possibly
Federico Caselli [Sat, 1 Feb 2025 18:44:14 +0000 (19:44 +0100)] 
mypy plugin is removed on 2.1, remove the possibly

Change-Id: I93a918dcafd8471d6514b297d973bbbe8100ec48

8 months agoUnable to use InstrumentedAttribute to value mappings in mysql/mariadb on_duplicate_k...
Mingyu Park [Sat, 1 Feb 2025 07:43:35 +0000 (02:43 -0500)] 
Unable to use InstrumentedAttribute to value mappings in mysql/mariadb on_duplicate_key_update

Fixes: #12117
Closes: #12296
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12296
Pull-request-sha: 32a09ebd18a6f97fdb23cc8a8e212342e6c26291

Change-Id: I72701f63b13105e5dc36e63ba2651da2673f1735
(cherry picked from commit 87bf36be84fc876be3e0c436a557733c63e2ac8d)

8 months agoMerge "Skip mypy plugin tests if incompatible or missing" into main
Federico Caselli [Thu, 30 Jan 2025 20:39:34 +0000 (20:39 +0000)] 
Merge "Skip mypy plugin tests if incompatible or missing" into main

(cherry picked from commit 5822319e779afd26c8edff276c837491c2c10584)

8 months agoremove comma in docstring
Federico Caselli [Thu, 30 Jan 2025 20:34:00 +0000 (21:34 +0100)] 
remove comma in docstring

Change-Id: I135c06ddc16f905835b50cb8ea41f13a1ae2e0be
(cherry picked from commit 425f45fb285e5994e96a33b458f1a6aa98a8907f)

8 months agoFix typo python2 -> python in 2.0 major migration guide (#12250)
Martin Burchell [Thu, 30 Jan 2025 20:31:15 +0000 (20:31 +0000)] 
Fix typo python2 -> python in 2.0 major migration guide (#12250)

(cherry picked from commit bc5213d8d03193aae3486dc42c258e00fd0b0769)

8 months agosupport accept for chains of joineddispatchers
Mike Bayer [Wed, 29 Jan 2025 15:10:09 +0000 (10:10 -0500)] 
support accept for chains of joineddispatchers

Fixed issue where creating an :class:`.Engine` using multiple calls to
:meth:`.Engine.execution_options` where a subsequent call involved certain
options such as ``isolation_level`` would lead to an internal error
involving event registration.

Fixes: #12289
Change-Id: Iec5fbc0eb0c5a92dda1ea762872ae992ca816685
(cherry picked from commit fc3623990eeeb415fb076ddc96a0c7974beb2050)

8 months agouse arm runnes on linux instead of emulation
Federico Caselli [Wed, 22 Jan 2025 20:00:41 +0000 (21:00 +0100)] 
use arm runnes on linux instead of emulation

Fixes: #12249
Change-Id: I4c56a10d09716aa5e1fc4a1688dbfdf7cfcfd2fb
(cherry picked from commit 1f704fb682a0759454a474901b33e0b311044253)

# Conflicts:
# .github/workflows/run-test.yaml

8 months agodocument name normalize
Mike Bayer [Wed, 4 Dec 2024 14:22:14 +0000 (09:22 -0500)] 
document name normalize

Fixes: #10789
Change-Id: I795d92c900502e4b2fde7ab11e8adb9b03d5b782
(cherry picked from commit f933b668944e6de0dbaba4d9bf4b16e2591cbb2b)

8 months agoMerge "asyncpg: shield connection close in terminate to avoid connection leak" into...
Michael Bayer [Tue, 21 Jan 2025 00:35:08 +0000 (00:35 +0000)] 
Merge "asyncpg: shield connection close in terminate to avoid connection leak" into rel_2_0