]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
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 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 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

8 months agoset default iso to None for asyncpg pep-249 wrapper
Mike Bayer [Thu, 16 Jan 2025 17:14:02 +0000 (12:14 -0500)] 
set default iso to None for asyncpg pep-249 wrapper

Adjusted the asyncpg connection wrapper so that the asyncpg
``.transaction()`` call sends ``None`` for isolation_level if not otherwise
set in the SQLAlchemy dialect/wrapper, thereby allowing asyncpg to make use
of the server level setting for isolation_level in the absense of a
client-level setting. Previously, this behavior of asyncpg was blocked by a
hardcoded ``read_committed``.

Fixes: #12159
Change-Id: I2cd878a5059a8fefc9557a9b8e056fedaee2e9a4
(cherry picked from commit 299cdf667d5af96c5db75a923d2fd15eef2dfe26)

8 months agoasyncpg: shield connection close in terminate to avoid connection leak
Federico Caselli [Fri, 17 Jan 2025 20:16:51 +0000 (21:16 +0100)] 
asyncpg: shield connection close in terminate to avoid connection leak

Added an additional ``shield()`` call within the connection terminate
process of the asyncpg driver, to mitigate an issue where terminate would
be prevented from completing under the anyio concurrency library.

Fixes #12077
Closes: #12076
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12076
Pull-request-sha: 6ae261ea7668f4c850874666efec6fef658b08c0

Change-Id: Iaec63d02b620201dc60ffdad76ba9d61d427cac1
(cherry picked from commit 2f6ca6554ddd725849dd6b2d32bf495391087bec)

8 months agoupdate logging_name doc
Mike Bayer [Mon, 13 Jan 2025 13:14:14 +0000 (08:14 -0500)] 
update logging_name doc

engine logging has not used hex-strings in a very long time

Change-Id: I77131e3eb2f72129fde1d9ab6dd4b4e40bc313c6
(cherry picked from commit 214088c42ad61794e315174c41ee92a3c408ae6c)

8 months agoVersion 2.0.38 placeholder
Mike Bayer [Thu, 9 Jan 2025 22:44:09 +0000 (17:44 -0500)] 
Version 2.0.38 placeholder

8 months ago- 2.0.37 rel_2_0_37
Mike Bayer [Thu, 9 Jan 2025 22:37:34 +0000 (17:37 -0500)] 
- 2.0.37

8 months agofix changelog typos
Mike Bayer [Thu, 9 Jan 2025 22:36:03 +0000 (17:36 -0500)] 
fix changelog typos

Change-Id: Ib1631c23fe8ad2d4aa4a537526faf970229af56d
(cherry picked from commit 84bf309e0223ea06c873a2ddb6f52fa6f5e1169c)

8 months agoAsyncpg null query fix
CommanderKeynes [Tue, 7 Jan 2025 15:52:36 +0000 (10:52 -0500)] 
Asyncpg null query fix

Adjusted the asyncpg dialect so that an empty SQL string, which is valid
for PostgreSQL server, may be successfully processed at the dialect level,
such as when using :meth:`.Connection.exec_driver_sql`. Pull request
courtesy Andrew Jackson.

Closes: #12220
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12220
Pull-request-sha: 45c94febee66b567040b1fbfa3a93079a1314f09

Change-Id: I870df9e31f4a229939e76c702724c25073329282
(cherry picked from commit 7bfb829f25c1bfe2139afe7875882298aaf345ba)

9 months agoclose unclosed sqlite result
Mike Bayer [Fri, 3 Jan 2025 20:40:26 +0000 (15:40 -0500)] 
close unclosed sqlite result

this close is hoped to address failures that have been occurring
on github actions under python 3.13, although i am able to reproduce
the problem on other python versions as well when running
test/orm/test_events.py with the --random extension.

Change-Id: If0c4110815fd8625b39b2d74de26ac965401de14
(cherry picked from commit b0d9d5a44cdd5632d209149a6a6622073acee3da)

9 months agoguard against KeyError on subclass removal
Mike Bayer [Fri, 3 Jan 2025 17:19:27 +0000 (12:19 -0500)] 
guard against KeyError on subclass removal

Fixed issue in event system which prevented an event listener from being
attached and detached from multiple class-like objects, namely the
:class:`.sessionmaker` or :class:`.scoped_session` targets that assign to
:class:`.Session` subclasses.

Fixes: #12216
Change-Id: I3d8969fe604adbc23add07a13741938c7f4fc8ca
(cherry picked from commit e4f0afe06baa5d9b57d5b8cfe2647b943f2145e6)

9 months agoMerge "edits and reorganization for union/pep695 typing docs" into rel_2_0
Michael Bayer [Fri, 3 Jan 2025 16:14:12 +0000 (16:14 +0000)] 
Merge "edits and reorganization for union/pep695 typing docs" into rel_2_0

9 months ago2025
Mike Bayer [Thu, 2 Jan 2025 21:39:10 +0000 (16:39 -0500)] 
2025

Change-Id: Ifb33b8df2f838851f329415fa70f494acb4ccde5

9 months agoedits and reorganization for union/pep695 typing docs
Mike Bayer [Fri, 27 Dec 2024 21:59:28 +0000 (16:59 -0500)] 
edits and reorganization for union/pep695 typing docs

also some new tests

References: #11944
References: #11955
References: #11305
Change-Id: Ifaf8ede52a57336fa3875e8d86c6e22b2b8a0e14
(cherry picked from commit 0ac7cd16ea679a9c0ef2f407fa9e22dfc07c7acc)

9 months agofurther fixes for _cleanup_mapped_str_annotation
Mike Bayer [Mon, 30 Dec 2024 18:17:29 +0000 (13:17 -0500)] 
further fixes for _cleanup_mapped_str_annotation

Fixed issues in type handling within the ``type_annotation_map`` feature
which prevented the use of unions, using either pep-604 or ``Union``
syntaxes under future annotations mode, which contained multiple generic
types as elements from being correctly resolvable.

also adds some further tests to assert that None added into the type
map for pep695, typing.NewType etc. sets up nullability on the column

Fixes: #12207
Change-Id: I4057694cf35868972db2942721049d79301b19c4
(cherry picked from commit fd3d17a30b15cc45ba18efaeb24ecc29b0ea1087)

9 months agoMerge "General improvement on annotated declarative" into rel_2_0
Michael Bayer [Fri, 27 Dec 2024 20:44:37 +0000 (20:44 +0000)] 
Merge "General improvement on annotated declarative" into rel_2_0

9 months agobefore_mapper_configured event doc fixes (#12200)
Lele Gaifax [Thu, 26 Dec 2024 11:09:40 +0000 (12:09 +0100)] 
before_mapper_configured event doc fixes (#12200)

* Remove spurious word in before_mapper_configured event doc

* Fix reST markup in before_mapper_configured event doc

(cherry picked from commit c6be0c1f205cf83467d68eb40fb650b9274519f9)

9 months agopin ubuntu 22 since 24 seems broken. Runners have 4 cores now
Federico Caselli [Tue, 24 Dec 2024 21:39:58 +0000 (22:39 +0100)] 
pin ubuntu 22 since 24 seems broken. Runners have 4 cores now

Change-Id: Ie62b072446e8052d5465cfe2c01b2ccb05482aba
(cherry picked from commit 8d73205f352e68c6603e90494494ef21027ec68f)

9 months agofix lint job
Mike Bayer [Tue, 24 Dec 2024 20:15:36 +0000 (15:15 -0500)] 
fix lint job

Change-Id: Ib3d5230212eb56f8f0454bb51b23a64d93de1e43
(cherry picked from commit 7f138cc7fc4cb192627e5d0d34fd894f7101cc6d)

9 months agofix typo on double doc
Federico Caselli [Mon, 23 Dec 2024 21:47:47 +0000 (22:47 +0100)] 
fix typo on double doc

Change-Id: Ia8cffddae5c5c14954d7fa6b2e11c2b78c6e5f59
(cherry picked from commit 83492ae3b446dbc6ffc36da720417731d975d69c)

9 months agodocument Oracle FLOAT/DOUBLE and binary variants
Mike Bayer [Mon, 23 Dec 2024 16:46:57 +0000 (11:46 -0500)] 
document Oracle FLOAT/DOUBLE and binary variants

Fixes: #9704
Change-Id: Id11722d32eeb2a8582348aa5846eefb19d7c83c7
(cherry picked from commit e182255e24500f4c0a101af5fee6b73e98149104)

9 months agoupdate for mypy 1.14
Mike Bayer [Fri, 20 Dec 2024 23:02:37 +0000 (18:02 -0500)] 
update for mypy 1.14

Change-Id: I7315c06314ed25c2c00f56b2883f97f4489e433c
(cherry picked from commit b39afd5008bef95a8c2c30eada1e22ef6a286670)

9 months agofix SQLite on conflict tests
Mike Bayer [Thu, 19 Dec 2024 22:50:21 +0000 (17:50 -0500)] 
fix SQLite on conflict tests

in I4d66ec1473321616a1707da324a7dfe7a61ec94e we added new tests
in the sqlite suite but we forgot to extend from fixtures.TestBase,
so these tests did not get run at all.  repair tests

Change-Id: Iaec17a754e0ab1d4b43f063706b512ed335a7465
(cherry picked from commit 6a87d619d9dfe82a8135f0ab3268bf526ac42383)

9 months agotyping fix: allow stmt.excluded for set_
Mike Bayer [Wed, 18 Dec 2024 22:19:56 +0000 (17:19 -0500)] 
typing fix: allow stmt.excluded for set_

Change-Id: I6f0af23fba8f5868282505438e6ca0a5af7e1bbe
(cherry picked from commit 5c79e5ce2dd9db491e9177e7f5af0a83058ebe06)

9 months agoharden typing / coercion for on conflict/on duplicate key
Mike Bayer [Wed, 18 Dec 2024 16:24:58 +0000 (11:24 -0500)] 
harden typing / coercion for on conflict/on duplicate key

in 2.1 we want these structures to be cacheable, so start
by cleaning up types and adding coercions to enforce those types.
these will be more locked down in 2.1 as we will need to move
bound parameter coercion outside of compilation, but here
do some small starts and introduce in 2.0.

in one interest of cachability, a "literal_binds" that found
its way into SQLite's compiler is replaced with "literal_execute",
the difference being that the latter is cacheable.   This literal
is apparently necessary to suit SQLite's query planner for
the "index criteria" portion of the on conflict clause that otherwise
can't work with a real bound parameter.

Change-Id: I4d66ec1473321616a1707da324a7dfe7a61ec94e
(cherry picked from commit 219bcb3a77edd72ef8fc36c8ded921d6fb9a34a5)

9 months agoAdd missing `SmallInteger` column spec for `asyncpg`
FeeeeK [Sat, 14 Dec 2024 08:03:24 +0000 (03:03 -0500)] 
Add missing `SmallInteger` column spec for `asyncpg`

Adds missing column spec for `SmallInteger` in `asyncpg` driver

Fixes: #12170
Closes: #12171
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12171
Pull-request-sha: 82886d8521cb4e78822d685a864a9af438f6ea6b

Change-Id: I2cb15f066de756d4e3f21bcac6af2cf03bd25a1c
(cherry picked from commit c5abd84a2c3c7a1f4e733dbee387aae939464f3e)

9 months agoMerge "SQLite strict tables" into rel_2_0
Michael Bayer [Mon, 16 Dec 2024 18:25:21 +0000 (18:25 +0000)] 
Merge "SQLite strict tables" into rel_2_0

9 months agoharden HSTORE registration
Mike Bayer [Mon, 16 Dec 2024 15:58:01 +0000 (10:58 -0500)] 
harden HSTORE registration

* use the driver_connection when we register on the connection
* assert targets passed to register_hstore assert as boolean true;
  psycopg docs say "if None, register globally" but looking in the
  source it's actually registering globally if any false-evaluating
  object is passed.

Change-Id: Ie1fd7c96714b7fe76ef964501691fa48352be259
(cherry picked from commit 29569ccfde7247a7e0ed2afe43db53494da62fb2)

9 months agoadd delete limit to mysql; ensure int for update/delete limits
Pablo Nicolas Estevez [Mon, 9 Dec 2024 19:44:44 +0000 (14:44 -0500)] 
add delete limit to mysql; ensure int for update/delete limits

Added support for the ``LIMIT`` clause with ``DELETE`` for the MySQL and
MariaDB dialects, to complement the already present option for
``UPDATE``. The :meth:`.delete.with_dialect_options` method of the
`:func:`.delete` construct accepts parameters for ``mysql_limit`` and
``mariadb_limit``, allowing users to specify a limit on the number of rows
deleted. Pull request courtesy of Pablo Nicolás Estevez.

Added logic to ensure that the ``mysql_limit`` and ``mariadb_limit``
parameters of :meth:`.update.with_dialect_options` and
:meth:`.delete.with_dialect_options` when compiled to string will only
compile if the parameter is passed as an integer; a ``ValueError`` is
raised otherwise.

corrected mysql documentation for update/delete options which
must be specified using the ``with_dialect_options()`` method.

Fixes: #11764
Closes: #12146
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12146
Pull-request-sha: e34708374c67e016cda88919109fec5e6462eced

Change-Id: I8681ddabaa192b672c7a9b9981c4fe9e4bdc8d03
(cherry picked from commit 134ad3bbdc4bcbee13acc043be0a98cc314fcaec)

9 months agochore: update black
Federico Caselli [Thu, 12 Dec 2024 22:15:17 +0000 (23:15 +0100)] 
chore: update black

surprisingly no change was done to the code

Change-Id: I50af32fc2a172fa4aee52939fcec53d5b142ceed
(cherry picked from commit f1335227c0f5da63f9a4f9179bdb8ef6916bc758)

9 months agoAdded sqlalchemy-hsqldb to list of external dialects (#12175)
Jason Pebble [Thu, 12 Dec 2024 21:14:59 +0000 (21:14 +0000)] 
Added sqlalchemy-hsqldb to list of external dialects (#12175)

(cherry picked from commit 4ed7095154d3b457ef39208c716326dbc007906b)

9 months agoBump pypa/cibuildwheel from 2.21.3 to 2.22.0 (#12129)
dependabot[bot] [Thu, 12 Dec 2024 21:14:35 +0000 (22:14 +0100)] 
Bump pypa/cibuildwheel from 2.21.3 to 2.22.0 (#12129)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.21.3 to 2.22.0.
- [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/v2.21.3...v2.22.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit aaff39eede26fde1e297035021fb596cc6fa8df9)

9 months agoGeneral improvement on annotated declarative
Federico Caselli [Tue, 19 Nov 2024 22:12:51 +0000 (23:12 +0100)] 
General improvement on annotated declarative

Fix issue that resulted in inconsistent handing of unions
depending on how they were declared

Consistently support TypeAliasType. This has required a revision
of the implementation added in #11305 to have a consistent
behavior.

References: #11944
References: #11955
References: #11305
Change-Id: Iffc34fd42b9769f73ddb4331bd59b6b37391635d
(cherry picked from commit e6b0b421d60ecf660cf3872f3f32dd2b7a739b59)

9 months agoSQLite strict tables
Guilherme Martins Crocetti [Thu, 12 Dec 2024 20:11:27 +0000 (15:11 -0500)] 
SQLite strict tables

Added SQLite table option to enable ``STRICT`` tables.

Fixes #7398
Closes: #12124
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12124
Pull-request-sha: e77273d0ba5c09d120c2582e94b96b781ebecb90

Change-Id: I0ffe9f6fc2c27627f53a1bc1808077e74617658a
(cherry picked from commit 5b0eeaca61972cc75b7d50b11fbc582753518e61)

9 months agomodernize PG domain reflection test and skip for pg17.2
Mike Bayer [Thu, 12 Dec 2024 15:57:46 +0000 (10:57 -0500)] 
modernize PG domain reflection test and skip for pg17.2

Fixes: #12174
Change-Id: If4b1c29d7ee62b2858f1ef9d75fe1c4c41217706
(cherry picked from commit 42fe1109c62008f2cd509ef402152704efb9ddb1)

9 months agofix test due to merge of 11370 with 5252
Mike Bayer [Wed, 11 Dec 2024 20:54:23 +0000 (15:54 -0500)] 
fix test due to merge of 11370 with 5252

Numeric and Float are split out in main so a type cant be both
at the same time.   Also there's no reason to do isinstance(Float)
and isintance(Numeric) even if they are in the same hierarchy.

Change-Id: I2263aaac264673a830b63689d39b6433b32c1d23
(cherry picked from commit b49fcb67afb302d2309efea71cde2a6584c1373c)

9 months agodont match partial types in type_annotation_map
Frazer McLean [Thu, 3 Oct 2024 22:21:12 +0000 (18:21 -0400)] 
dont match partial types in type_annotation_map

Fixed issue regarding ``Union`` types that would be present in the
:paramref:`_orm.registry.type_annotation_map` of a :class:`_orm.registry`
or declarative base class, where a ``Mapped[]`` element that included one
of the subtypes present in that ``Union`` would be matched to that entry,
potentially ignoring other entries that matched exactly.   The correct
behavior now takes place such that an entry should only match in
``type_annotation_map`` exactly, as a ``Union`` type is a self-contained
type. For example, an attribute with ``Mapped[float]`` would previously
match to a ``type_annotation_map`` entry ``Union[float, Decimal]``; this
will no longer match and will now only match to an entry that states
``float``. Pull request courtesy Frazer McLean.

Fixes #11370
Closes: #11942
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11942
Pull-request-sha: 21a3d1971a04e117a557f6e6bac77bce9f6bb0a9

Change-Id: I3467be00f8fa8bd011dd4805a77a3b80ff74a215
(cherry picked from commit 40c30ec44616223216737327f97bac66a13eedee)

9 months agoMerge "Fixes: #11724 - PGDialect `get_multi_indexes` PGVecto.rs Bug" into rel_2_0
Federico Caselli [Mon, 9 Dec 2024 20:00:29 +0000 (20:00 +0000)] 
Merge "Fixes: #11724 - PGDialect `get_multi_indexes` PGVecto.rs Bug" into rel_2_0

9 months agoensure db_opts are honored
Mike Bayer [Mon, 9 Dec 2024 17:36:56 +0000 (12:36 -0500)] 
ensure db_opts are honored

for provision.py that adds db_opts these need to be used in all cases
for testing_engine() that is using that same database driver

References: #12159
Change-Id: I15c46a375ab05ef94c9a7d19000a3d8641de43bf
(cherry picked from commit 3226f99dce77bb75698a7c9366f6fd07ab4d29ee)

9 months agoFixes: #11724 - PGDialect `get_multi_indexes` PGVecto.rs Bug
Nick Wilkinson [Fri, 6 Dec 2024 06:59:22 +0000 (01:59 -0500)] 
Fixes: #11724 - PGDialect `get_multi_indexes` PGVecto.rs Bug
When attempting to generate an auto-revision using Alembic, the `get_multi_indexes` method fails with the error:
```python
    dialect_options["postgresql_with"] = dict(
ValueError: dictionary update sequence element #0 has length 4; 2 is required
```

### Description

The cause of this error is that when creating a vector index in PGVecto.rs, the index is:
```sql
CREATE INDEX vector_embedding_idx ON public.vector_embeddings USING vectors (embedding vector_cos_ops) WITH (options='
                    [indexing.hnsw]
                    m = 16
                    ef_construction = 64
                ')
```

However, in PostgreSQL the index seems to be generated as:
```sql
CREATE INDEX vector_embedding_idx ON public.vector_embeddings USING hnsw (embedding vector_cos_ops) WITH (m='16', ef_construction='64');
```

To fix this, we need to modify:
```diff
if row["reloptions"]:
-    dialect_options["postgresql_with"] = dict([option.split("=") for option in row["reloptions"]])
+    dialect_options["postgresql_with"] = dict([option.split("=", 1) for option in row["reloptions"]])
```

For more details on this error and a reproducible example, refer to #11724

### Testing

I couldn't really think of an easy way to add the potential test suggested in the issue thread [here](https://github.com/sqlalchemy/sqlalchemy/issues/11724#issuecomment-2518501318). However, this code is already tested in [`test_get_multi_view_indexes`](https://github.com/sqlalchemy/sqlalchemy/blob/5ded16fae8abfc31d43430cb25757fb434c37ba2/test/dialect/postgresql/test_reflection.py#L378), so assuming that test still passes and nothing breaks I believe we should be fine.

### 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: #12162
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12162
Pull-request-sha: 7d996fd92dd24a7d79bccab090d22bd76564dc76

Change-Id: Id6ad86133f3221eefcf0aa799c7f79a754e9c1bf
(cherry picked from commit 9eacf3408d1deeb42fc1ecc6002437b898ecc397)

10 months agouse VARCHAR for CLOB outputtypehandler
Mike Bayer [Mon, 2 Dec 2024 23:59:19 +0000 (18:59 -0500)] 
use VARCHAR for CLOB outputtypehandler

Fixed issue in oracledb / cx_oracle dialects where output type handlers for
``CLOB`` were being routed to ``NVARCHAR`` rather than ``VARCHAR``, causing
a double conversion to take place.

Fixes: #12150
Change-Id: I9f55e9bc595997b873c831b0422f5af10dcc15ef
(cherry picked from commit 5ded16fae8abfc31d43430cb25757fb434c37ba2)

10 months agoMerge "enable py3.13 for greenlet" into rel_2_0
Michael Bayer [Sun, 1 Dec 2024 19:30:10 +0000 (19:30 +0000)] 
Merge "enable py3.13 for greenlet" into rel_2_0

10 months agoenable py3.13 for greenlet
Mike Bayer [Sun, 1 Dec 2024 18:35:36 +0000 (13:35 -0500)] 
enable py3.13 for greenlet

keep py3.14 disabled

Fixes: #12145
Change-Id: I16c9bdda082fb2749085897faf3f8bc3140576c3

10 months agoupdate the format_docs_code to also work on python files
Federico Caselli [Sat, 30 Nov 2024 18:50:38 +0000 (19:50 +0100)] 
update the format_docs_code to also work on python files

Change-Id: I0a6c9610b3fd85365ed4c2c199e3cad87ee64022
(cherry picked from commit d539bc3a0fecdc2deb5b952e410fbd4f382a1ff4)

10 months agoAdded INET4 and INET6 types for MariaDB
Adam Žurek [Fri, 15 Nov 2024 18:12:54 +0000 (13:12 -0500)] 
Added INET4 and INET6 types for MariaDB

Added sql types ``INET4`` and ``INET6`` in the MariaDB dialect.

Fixes: #10720
Closes: #12028
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12028
Pull-request-sha: 25f939076eda0a763bc33fb0455d45ef00002110

Change-Id: I2efa53420aa5566f61a19f228cb421116b2e2720
(cherry picked from commit 0f81c14b7cd9ac821205d6c48cf2393447058394)

10 months agoMerge "Mention no_autoflush in warning" into rel_2_0
Michael Bayer [Tue, 19 Nov 2024 13:40:31 +0000 (13:40 +0000)] 
Merge "Mention no_autoflush in warning" into rel_2_0

10 months agoMerge "Update Oracle dialect doc, mostly to prefer python-oracledb" into rel_2_0
Federico Caselli [Mon, 18 Nov 2024 20:09:41 +0000 (20:09 +0000)] 
Merge "Update Oracle dialect doc, mostly to prefer python-oracledb" into rel_2_0

10 months agoMerge "Support table function in oracle" into rel_2_0
Michael Bayer [Mon, 18 Nov 2024 17:53:23 +0000 (17:53 +0000)] 
Merge "Support table function in oracle" into rel_2_0

10 months agoMerge "Add Range.__contains__" into rel_2_0
Michael Bayer [Mon, 18 Nov 2024 17:49:00 +0000 (17:49 +0000)] 
Merge "Add Range.__contains__" into rel_2_0

10 months agocorrect pep-593/pep-681 doc section
Mike Bayer [Sun, 17 Nov 2024 00:15:10 +0000 (19:15 -0500)] 
correct pep-593/pep-681 doc section

as of 73a273c90cda2369ec071435edd9c6dc5c1d31c4 and later
4c6429d068 we have decided that Annotated should not allow dataclass
arguments in mapped_column(), which emits a depreaction warning.

the docs in this section were never updated

Fixes: #12108
Change-Id: I6f301c4bac621d5ca1afb1b1dadf754ec929d179
(cherry picked from commit bc4174a15572f134bbdc5fc154078bd992573f10)

10 months agoAdd Range.__contains__
Frazer McLean [Fri, 15 Nov 2024 18:07:00 +0000 (13:07 -0500)] 
Add Range.__contains__

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

### Description
Fixes #12093

### 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: #12094
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12094
Pull-request-sha: 3f900e96b95c6dbd20ee6f5aa3f49dd6124ffba9

Change-Id: I4c3945eec6a931acd0a8c1682988c5f26e96a499
(cherry picked from commit 31975cfa38689dc0a45fe26d0563eb7b5b3bda6c)

10 months agoUpdate Oracle dialect doc, mostly to prefer python-oracledb
Christopher Jones [Tue, 12 Nov 2024 22:28:38 +0000 (17:28 -0500)] 
Update Oracle dialect doc, mostly to prefer python-oracledb

### Description

Small updates for Oracle Database dialect documentation.

- prefer python-oracledb over cx_Oracle
- Prefer the product name 'Oracle Database' over the company name 'Oracle'
- update links
- modernize

This is a refresh of existing content.

I decided the apparently now duplicated sections between cx_Oracle and python-oracledb were justified for clarity due to the inevitable differences.

This pull request is:

- [x] A documentation / typographical / small typing error fix
- Good to go, no issue or tests are needed

**Have a nice day!**

Closes: #12078
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12078
Pull-request-sha: 7c4dcf94032af295a6836e9412a4367b716f2de5

Change-Id: I3678976f5524ee164dc31b3122b224ae37060b71
(cherry picked from commit 855d03cc15ac30d458d8d2e501df5f324238f43e)

10 months agoSupport table function in oracle
Federico Caselli [Thu, 14 Nov 2024 19:27:35 +0000 (20:27 +0100)] 
Support table function in oracle

Fixed compilation of ``TABLE`` function when used in a from clause
in Oracle Database dialect.

Fixes: #12100
Change-Id: I862e5be9685611dc74338c37b7537505fc2194e5
(cherry picked from commit 564de4661fce3274d71c32676a735a250821fc0f)

10 months agoImprove oracle max id length again
Federico Caselli [Thu, 14 Nov 2024 18:55:32 +0000 (19:55 +0100)] 
Improve oracle max id length again

Adjust 90bf575b81c5396b364908547551b6592a333bf7 to handle the none case
Fix missing return

Fixes: #12032
Change-Id: I166efbde1a0cc88673ad3cdfbda70c737dcafcc8
(cherry picked from commit 1a7c5772623546f8ba182adef48a8bb20f9c50c6)

10 months agoAdd YDB to external dialect list (#12088)
Oleg Ovcharuk [Thu, 14 Nov 2024 18:49:34 +0000 (21:49 +0300)] 
Add YDB to external dialect list (#12088)

(cherry picked from commit 2f559b2d5290827a75c59dc59bc3cdafaaa5ea23)

10 months agodont leak mutating bindparams list into AnalyzedFunction
Mike Bayer [Tue, 12 Nov 2024 19:50:50 +0000 (14:50 -0500)] 
dont leak mutating bindparams list into AnalyzedFunction

Fixed issue in "lambda SQL" feature where the tracking of bound parameters
could be corrupted if the same lambda were evaluated across multiple
compile phases, including when using the same lambda across multiple engine
instances or with statement caching disabled.

Fixes: #12084
Change-Id: I327aa93ce7feb2326a22113164bd834b96b6b889
(cherry picked from commit 5bbefc41b7b2695c95c9c93bcaabd8c4731e348e)

10 months agoMerge "Improve Oracle identifier length detection" into rel_2_0
Michael Bayer [Mon, 11 Nov 2024 13:57:43 +0000 (13:57 +0000)] 
Merge "Improve Oracle identifier length detection" into rel_2_0

10 months agoFix source comment/doc typos (#12072)
Yeongbae Jeon [Sat, 9 Nov 2024 16:49:20 +0000 (01:49 +0900)] 
Fix source comment/doc typos (#12072)

minor spelling corrections in comments and doc

(cherry picked from commit ef23611a6bf8358dd05e0fc13384f1eb1925e1ff)

10 months agoImprove Oracle identifier length detection
Federico Caselli [Sat, 26 Oct 2024 19:50:36 +0000 (21:50 +0200)] 
Improve Oracle identifier length detection

Use the connection attribute ``max_identifier_length`` available
in oracledb since version 2.5 when determining the identifier length
in the Oracle dialect.

Fixes: #12032
Change-Id: If16db93e0df25776295bc521706dbad1cc541f4a
(cherry picked from commit 90bf575b81c5396b364908547551b6592a333bf7)

11 months agoFixed: 12012: Add Support for `TABLESPACE` Specification in Table Definitions for...
Miguel Grillo [Thu, 24 Oct 2024 18:32:33 +0000 (14:32 -0400)] 
Fixed: 12012: Add Support for `TABLESPACE` Specification in Table Definitions for Oracle

Fixes: #12016
**Description**

This PR adds support for specifying the `TABLESPACE` in table definitions in SQLAlchemy, specifically for Oracle. This feature is particularly useful for Oracle users who need to specify the tablespace where the table data will be stored.

**Changes Made**
1. Updated `construct_arguments` in `OracleDialect`:
    - The `construct_arguments` list in the `OracleDialect` class has been updated to include the `tablespace` argument for the `Table` class.

```Python
construct_arguments = [
    (
        sa_schema.Table,
        # old
        {"resolve_synonyms": False, "on_commit": None, "compress": False},
        # new
        {"resolve_synonyms": False, "on_commit": None, "compress": False, "tablespace": None},
    ),
    (sa_schema.Index, {"bitmap": False, "compress": False}),
]
```
**Path**: `lib/sqlalchemy/dialects/oracle/base.py`

2. Modified OracleDDLCompiler to Include TABLESPACE in post_create_table:
    - The OracleDDLCompiler class has been modified to include the TABLESPACE clause at the end of the CREATE TABLE statement if the tablespace option is provided.

```Python
if opts["tablespace"]:
    tablespace_name = opts["tablespace"]
    table_opts.append(
        "\n TABLESPACE %s" % self.preparer.quote(tablespace_name)
    )
```
**Path**: `lib/sqlalchemy/dialects/oracle/base.py`

3. Added tablespace Argument to the Table Class:
    - A new tablespace argument has been added to the Table class to allow specifying the tablespace in the table definition.

4. Documentation Update:
    - The documentation has been updated to reflect the new feature and provide usage examples.

**Usage Example**

```Python
from sqlalchemy import create_engine, Table, Column, Integer, String, MetaData

engine = create_engine('oracle+cx_oracle://user:password@dsn')

metadata = MetaData()

users = Table('users', metadata,
    Column('id', Integer, primary_key=True),
    Column('name', String),
    Column('email', String, unique=True),
    oracle_tablespace='my_tablespace'  # New tablespace argument optional
)

metadata.create_all(engine)
```

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

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

**Have a nice day!**

Closes: #12013
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12013
Pull-request-sha: e542dea6ced269cb188b06cbd04cecf1c400e29a

Change-Id: I4733b466f9486289e13dd7503d18b3b5c866e836
(cherry picked from commit 44fa4a55bad2bc1bd20047275c366385ba3d4b1f)

11 months agoMention no_autoflush in warning
Federico Caselli [Thu, 31 Oct 2024 21:14:57 +0000 (22:14 +0100)] 
Mention no_autoflush in warning

References: #12049
Change-Id: I057140b2fe2f5fc60d5d27a79ddf19a6196fff7b
(cherry picked from commit b4fdfd489755848f4945c31f0686ad9eaf128b08)

11 months agoImprove mutable typing.
Federico Caselli [Wed, 30 Oct 2024 20:17:45 +0000 (21:17 +0100)] 
Improve mutable typing.

References: #12046
Change-Id: If950f7e2090a0f637c2c28cf21a40dc345acc89a
(cherry picked from commit 732698427e822b6ba81f1214864685903cdc13a4)

11 months agoUpdate declarative_styles.rst: add missing import from typing in the example (#12034)
Dennis Magnusson [Wed, 30 Oct 2024 17:33:40 +0000 (19:33 +0200)] 
Update declarative_styles.rst: add missing import from typing in the example (#12034)

* Update declarative_styles.rst: add missing import

* Update declarative_styles.rst: make import statement style consistent

(cherry picked from commit f418ac8d38a26936aa9a8ed9befe210c88b97f33)

11 months agoUpdate bigquery dialect link (#12048)
Gord Thompson [Wed, 30 Oct 2024 17:30:40 +0000 (11:30 -0600)] 
Update bigquery dialect link (#12048)

(cherry picked from commit 58822b9e2412dfefdced95164943fdb515e2f52c)

11 months agoAdd TiDB dialect (#12025)
JaySon [Wed, 23 Oct 2024 16:48:59 +0000 (00:48 +0800)] 
Add TiDB dialect (#12025)

* Add sqlalchemy-tidb to index.rst

* Update index.rst

(cherry picked from commit a9a85f8b2167d7a4313ea49b76e1b2a01a346d7f)

11 months agorefine in_() check to use proper duck-typing for __clause_element__
Mike Bayer [Mon, 21 Oct 2024 14:03:01 +0000 (10:03 -0400)] 
refine in_() check to use proper duck-typing for __clause_element__

Fixed regression caused by an internal code change in response to recent
Mypy releases that caused the very unusual case of a list of ORM-mapped
attribute expressions passed to :meth:`.ColumnOperators.in_` to no longer
be accepted.

in this commit we had to revisit d8dd28c42e where mypy typing
didn't accept ColumnOperartors.   the type here is the _HasClauseElement[_T]
protocol which means we need to use a duck type for a runtime check.

Fixes: #12019
Change-Id: Ib378e9cb8defb49d5ac4d726ec93d6bdc581b6a9
(cherry picked from commit aaddd7c8403e9ca2f77113467b5e2ae279a542c4)

11 months agopin older pip for tox under py37
Mike Bayer [Mon, 21 Oct 2024 17:10:54 +0000 (13:10 -0400)] 
pin older pip for tox under py37

this is suddenly failing due to a non-py37 syntax in
pip/_vendor/typing_extensions.py.  Not clear why the failure has just
started however as there is no new version of pip recently.

Change-Id: I783e2341424a1dad206a7ab668900475fd8d30c5