]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 weeks agoAdd ``dataclass_metadata`` parameter to orm cols
Sigmund Lahn [Thu, 3 Jul 2025 16:14:13 +0000 (12:14 -0400)] 
Add ``dataclass_metadata`` parameter to orm cols

Added ``dataclass_metadata`` argument to a all column functions
used in the ORM that accept dataclasses parameters.
It's passed to the underlying dataclass ``metadata`` attribute
of the dataclass field.
Pull request courtesy Sigmund Lahn.

Fixes: #10674
Closes: #12619
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12619
Pull-request-sha: 9ea6a95b2bc6816e5b69d6d559783a6009877838

Change-Id: I4551c24b85cebee4064df6ab752d0700f0f191f1
(cherry picked from commit aeb7830d22cdb4ac387242d46833cb2f67e0a952)

2 weeks agoexpand out type map example to include the common MySQL case
Mike Bayer [Fri, 18 Jul 2025 16:35:27 +0000 (12:35 -0400)] 
expand out type map example to include the common MySQL case

References: #12742
Change-Id: I9d56597f12141bc8a63665b3cedb5c662a4f5c9d
(cherry picked from commit 632d8e47277015d3aee06b944aa183fbc23103af)

2 weeks agoUpdated index.rst in dialects docs to include Amazon Aurora DSQL (#12737)
Victor Tsang [Thu, 17 Jul 2025 19:02:44 +0000 (12:02 -0700)] 
Updated index.rst in dialects docs to include Amazon Aurora DSQL (#12737)

Co-authored-by: Victor Tsang <vitsangp@amazon.com>
(cherry picked from commit c145158821f05a0dac501f926aa596f0d247bb12)

2 weeks agoadd recursive test to values cte
Federico Caselli [Tue, 15 Jul 2025 20:50:32 +0000 (22:50 +0200)] 
add recursive test to values cte

Change-Id: I544aab7f9f5d2640fc6c3d970d835a6e3f80d746
(cherry picked from commit 320c3b5b043931187d266f5c92b3fe366f650e5a)

2 weeks agoremove py 3.9, 3.8 from mypy job
Mike Bayer [Tue, 15 Jul 2025 20:11:43 +0000 (16:11 -0400)] 
remove py 3.9, 3.8 from mypy job

both were already removed for pep484.  3.9 is EOL in two months
and latest mypy 1.17 changes are now failing, so just remove

Change-Id: I75d9bf06095da13621e2e3470486e44c9da50176

2 weeks agoextend Values from HasCTE
Mike Bayer [Mon, 14 Jul 2025 20:13:03 +0000 (16:13 -0400)] 
extend Values from HasCTE

The :func:`_sql.values` construct gains a new method :meth:`_sql.Values.cte`,
which allows creation of a named, explicit-columns :class:`.CTE` against an
unnamed ``VALUES`` expression, producing a syntax that allows column-oriented
selection from a ``VALUES`` construct on modern versions of PostgreSQL, SQLite,
and MariaDB.

Fixes: #12734
Change-Id: I4a0146418420cce3cbbda4e50f5eb32206dc696b
(cherry picked from commit 209d1913cc702665252f3d2bc1b38ce3a0b9e3eb)

2 weeks agoupdate for mypy 17
Mike Bayer [Mon, 14 Jul 2025 22:08:51 +0000 (18:08 -0400)] 
update for mypy 17

note for the 2.0 backport I also updated tox.ini to use mypy 1.17
for the "mypy" suite, 2.1 had this but 2.0 was pinned so some old
mypy version.

Change-Id: I25708115b44bf46d22a2a81fe010db875a8bcb22
(cherry picked from commit b319787b413794ad8c6d70135a286e664be292f8)

3 weeks agosupport JSONB subscripting syntax
Mike Bayer [Fri, 11 Jul 2025 16:51:44 +0000 (12:51 -0400)] 
support JSONB subscripting syntax

Added support for PostgreSQL 14+ JSONB subscripting syntax. When connected
to PostgreSQL 14 or later, JSONB columns now automatically use the native
subscript notation ``jsonb_col['key']`` instead of the arrow operator
``jsonb_col -> 'key'`` for both read and write operations. This provides
better compatibility with PostgreSQL's native JSONB subscripting feature
while maintaining backward compatibility with older PostgreSQL versions.
JSON columns continue to use the traditional arrow syntax regardless of
PostgreSQL version.

Fixes: #10927
Change-Id: I4b3a8a55a71f2ca3d95416a7b350b785574631eb
(cherry picked from commit 2ac0c459669d0200a4d15162ffc0a8765c60cb07)

3 weeks agoblock mariadb-connector 1.1.13 and above (tox only)
Mike Bayer [Sat, 12 Jul 2025 15:34:35 +0000 (11:34 -0400)] 
block mariadb-connector 1.1.13 and above (tox only)

New segfault occurs under failure modes [1]

[1] https://jira.mariadb.org/browse/CONPY-318

Change-Id: I85dee53be0cb4644c9e500fbb15f7cb35051ff4b
(cherry picked from commit 66d894f2651d781844c4c3cd92fbdcaf4c3aac15)

3 weeks agodocs: Clarify Mapped accepts equivalents to Optional (#12622)
Matthew Martin [Sat, 12 Jul 2025 10:34:22 +0000 (05:34 -0500)] 
docs: Clarify Mapped accepts equivalents to Optional (#12622)

Co-authored-by: Matthew Martin <mmartin@booliproject.com>
(cherry picked from commit 606a979719a6e180006d881a13e53e9e3abf2e69)

3 weeks agoRe-raise ``CancelledError`` in asyncpg
Federico Caselli [Thu, 10 Jul 2025 22:21:54 +0000 (00:21 +0200)] 
Re-raise ``CancelledError`` in asyncpg

Re-raise catched ``CancelledError`` in the terminate method of the
asyncpg dialect to avoid possible hangs of the code execution.

Fixes: #12728
Change-Id: Ia9a353ac7504592be00355001ef40b13ab51375c
(cherry picked from commit 36da2eaf3e23269f2cf28420ae73674beafd0661)

3 weeks agoMake __aiter__ in AsyncTupleReulst a sync function. (#12726)
Evgeny Petrov [Thu, 10 Jul 2025 20:10:08 +0000 (21:10 +0100)] 
Make __aiter__ in AsyncTupleReulst a sync function. (#12726)

As it should be accotring to PEP 525

(cherry picked from commit 46c507fb31e6d44c255083d05103235c1d70bd58)

3 weeks agoFix the code examples and the grammatic in `declarative_tables.rst` (#12721)
Roman Mashevskyi [Mon, 7 Jul 2025 20:23:43 +0000 (23:23 +0300)] 
Fix the code examples and the grammatic in `declarative_tables.rst` (#12721)

* Fix the code example in `declarative_tables.rst`

Add an import of a `Optional` class from the `typing` library in the
code example of the "Union types inside the Type Map" chapter.

* Fix the code example in `declarative_tables.rst`

Replace the import of the `deferred` function to `column_property` from
the `sqlalchemy.orm` package in first code example of the "Applying
Load, Persistence and Mapping Options for Imperative Table Columns"
chapter.

* Fix the grammatic in `declarative_tables.rst`

Remove the unnecessary article in the second paragraph of the
"Mapping to an Explicit Set of Primary Key Columns" chapter in
`declarative_tables.rst`.

(cherry picked from commit 75163df8ef4896589d00b682813f01e1a436afcb)

4 weeks agochore: Fix typo in autoflush warning (#12713)
Sillocan [Wed, 2 Jul 2025 21:20:47 +0000 (14:20 -0700)] 
chore: Fix typo in autoflush warning (#12713)

(cherry picked from commit 7376cdf43eef4b038891a5902a7e0692b4bd8185)

4 weeks agonote that SQL parenthesis are based on precedence
Mike Bayer [Wed, 2 Jul 2025 13:18:28 +0000 (09:18 -0400)] 
note that SQL parenthesis are based on precedence

References: #12708
Change-Id: I2401e92c936eb01a64ad6896a86faec1c205bc08
(cherry picked from commit 5b5db1f5f35d9eca6f66db73c05a8ce8302d3a4c)

5 weeks agoMerge "Update association examples to Declarative API" into rel_2_0
Michael Bayer [Mon, 30 Jun 2025 14:35:15 +0000 (14:35 +0000)] 
Merge "Update association examples to Declarative API" into rel_2_0

5 weeks agoremove support for list of tuples in the normal execute
Federico Caselli [Thu, 5 Jun 2025 18:09:32 +0000 (20:09 +0200)] 
remove support for list of tuples in the normal execute

The function that validates the arguments in the normal execute flow
allowed by mistake list of tuples, that are not supported by the
code since the 2.0 series.

Change-Id: Ia401b0e19e72ed33b7d3d5718578cbed0d214c2a
(cherry picked from commit 7a96d2792dd7a65b8cc3a8af72d423c2c382b11d)

5 weeks agoUpdate association examples to Declarative API
Mike Fiedler [Thu, 26 Jun 2025 19:04:03 +0000 (15:04 -0400)] 
Update association examples to Declarative API

### Description

Follows initial attempt in #10450 - but starts with simpler association examples.

### Checklist
This pull request is:

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

I was curious how to add these selectively to any of the type hint test suites, to prevent future drift, but didn't see anything too obvious.

Closes: #12031
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12031
Pull-request-sha: dad6239370f23d52b4c0a1b21eba5752e216207e

Change-Id: Id5c2d65137c5e9d7e87778acd51b965c2bcf315a
(cherry picked from commit 904541a55ca3193171b48e57dd6b1b4fa31b0669)

5 weeks agoMerge "Deprecate the declarative_mixin decorator" into rel_2_0
Michael Bayer [Thu, 26 Jun 2025 15:22:40 +0000 (15:22 +0000)] 
Merge "Deprecate the declarative_mixin decorator" into rel_2_0

5 weeks agoMerge "add example to update from that uses values" into rel_2_0
Michael Bayer [Tue, 24 Jun 2025 22:28:30 +0000 (22:28 +0000)] 
Merge "add example to update from that uses values" into rel_2_0

5 weeks agouse zzzeeksphinx 1.6.1 and we arent' really using this doc mod
Mike Bayer [Tue, 24 Jun 2025 22:26:44 +0000 (18:26 -0400)] 
use zzzeeksphinx 1.6.1 and we arent' really using this doc mod

Change-Id: Ib53111444598331290bde1788f5f2617562d250c
(cherry picked from commit 5394c75bcac270905a58a0fb7cd5f0d6643f78fd)

5 weeks agoadd example to update from that uses values
Federico Caselli [Tue, 10 Jun 2025 21:42:35 +0000 (23:42 +0200)] 
add example to update from that uses values

Change-Id: Ic02a722be9a30851a87e0da4759c728e86fb22c8
References: #11768
(cherry picked from commit fb5e64c51ab91edf9ab0936aa540195746f9155b)

5 weeks agoMerge "try flake8-import-order 0.19.2" into rel_2_0
Michael Bayer [Tue, 24 Jun 2025 20:52:18 +0000 (20:52 +0000)] 
Merge "try flake8-import-order 0.19.2" into rel_2_0

5 weeks agotry flake8-import-order 0.19.2
Mike Bayer [Tue, 24 Jun 2025 17:57:17 +0000 (13:57 -0400)] 
try flake8-import-order 0.19.2

the big new thang is that it is doing import order checks inside of
TYPE_CHECKING blocks.   Introduces some new codes that we
enthusiastically add to our ignore list.   update to the latest
and greatest zimports 0.6.2 as well

Change-Id: I4e844408a8b218f9b92c43ad5e2a5c16781100be
(cherry picked from commit 1c8343576188940268de467b2537e5f838464690)

5 weeks agohardening against inappropriate multi-table updates
Mike Bayer [Mon, 23 Jun 2025 13:21:59 +0000 (09:21 -0400)] 
hardening against inappropriate multi-table updates

Hardening of the compiler's actions for UPDATE statements that access
multiple tables to report more specifically when tables or aliases are
referenced in the SET clause; on cases where the backend does not support
secondary tables in the SET clause, an explicit error is raised, and on the
MySQL or similar backends that support such a SET clause, more specific
checking for not-properly-included tables is performed.  Overall the change
is preventing these erroneous forms of UPDATE statements from being
compiled, whereas previously it was relied on the database to raise an
error, which was not always guaranteed to happen, or to be non-ambiguous,
due to cases where the parent table included the same column name as the
secondary table column being updated.

Fixed bug where the ORM would pull in the wrong column into an UPDATE when
a key name inside of the :meth:`.ValuesBase.values` method could be located
from an ORM entity mentioned in the statement, but where that ORM entity
was not the actual table that the statement was inserting or updating.  An
extra check for this edge case is added to avoid this problem.

Fixes: #12692
Change-Id: I342832b09dda7ed494caaad0cbb81b93fc10fe18
(cherry picked from commit dc0d0817622435ea46b33575fd4f84d3959dc42d)

6 weeks agoMerge "rework wraps_column_expression logic to be purely compile time checking" into...
Michael Bayer [Sat, 21 Jun 2025 23:44:27 +0000 (23:44 +0000)] 
Merge "rework wraps_column_expression logic to be purely compile time checking" into rel_2_0

6 weeks agoUpdate `table_per_related` example for Declarative API
Mike Fiedler [Fri, 20 Jun 2025 21:49:26 +0000 (17:49 -0400)] 
Update `table_per_related` example for Declarative API

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

### Description
When reading more of the Generic Associations, I found that the examples state "Annotated example", and wondered what that meant, since in other parts of the docs that means they are using the new 2.0 style.

I tried to update this example to be more in line with the new style, including a little f-string update.

I completely understand this is unlikely to be merged as-is - but wanted to understand more about the right way to use modern styles to properly code well-hinted, more "exotic" implementations.

Outstanding questions:
- Should examples pass pass `mypy --strict` ? It doesn't right now.
- Are there better ways to apply `Mapped` within the `type(...)` definition, so we could skip importing `Integer`?

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

(Do non-running examples count as code fixes/features?)

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

**Have a nice day!**

Closes: #10450
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10450
Pull-request-sha: a6a54d69487429c8b3a7758cf22913e6a2156316

Change-Id: Ie7c7526daed5bf907d41f666459759b9a986b8c2
(cherry picked from commit 7b9ee3daea9e22f3ec1babe7130b3885802e25af)

6 weeks agotype `set_committed_value`.
Federico Caselli [Fri, 20 Jun 2025 21:16:22 +0000 (23:16 +0200)] 
type `set_committed_value`.

Fixes: #12669
Change-Id: I9c73184d4c4880d0cd72eaafe125b3cf48bedf02
(cherry picked from commit 33af5279bbcf77d85f3370ce36d9f81e92c63fd6)

6 weeks agoDeprecate the declarative_mixin decorator
Federico Caselli [Thu, 13 Feb 2025 19:10:10 +0000 (20:10 +0100)] 
Deprecate the declarative_mixin decorator

References: #12346
Change-Id: I6709c7b33bf99ef94c3dc074a25386e8c13c9131

6 weeks agoreally pin flake8-import-order to <0.19
Mike Bayer [Fri, 20 Jun 2025 17:04:54 +0000 (13:04 -0400)] 
really pin flake8-import-order to <0.19

In 8a287bf5c5635daf99217e I told @caselit to just omit 0.19.0,
as I wa sure 0.19.1 would fix the issue.  Unfortunately in [1]
we see that this release continues to have problems, which seems
to be related not to the importlib.metadata fix but to an unrelated
improvement for TYPE_CHECKING blocks.

So we really have to wait for them to get a working release before
we can update.

Change-Id: Ia82a98e836bed9e826906bd07827a9e00998bf7c

6 weeks agorework wraps_column_expression logic to be purely compile time checking
Mike Bayer [Mon, 16 Jun 2025 23:53:30 +0000 (19:53 -0400)] 
rework wraps_column_expression logic to be purely compile time checking

Fixed issue where :func:`.select` of a free-standing, unnamed scalar expression that
has a unary operator applied, such as negation, would not apply result
processors to the selected column even though the correct type remains in
place for the unary expression.

This change opened up a typing rabbithole where we were led to also
improve and harden the typing for the Exists element, in particular
in that the Exists now always refers to a ScalarSelect object, and
no longer a SelectStatementGrouping within the _regroup() cases; there
did not seem to be any reason for this inconsistency.

Fixes: #12681
Change-Id: If9131807941030c627ab31ede4ccbd86e44e707f
(cherry picked from commit c96805a43aa76bc3ec5134832a5050d527e432fe)

6 weeks agoUpdate dialect opengauss url
victor [Mon, 9 Jun 2025 12:15:12 +0000 (20:15 +0800)] 
Update dialect opengauss url

(cherry picked from commit 9dfc1f0459d8e906c6ccf1d95543fe83fc2c7981)

6 weeks agopin flake8-import-order!=0.19.0 and updates for mypy 1.16.1
Federico Caselli [Mon, 16 Jun 2025 19:20:58 +0000 (21:20 +0200)] 
pin flake8-import-order!=0.19.0 and updates for mypy 1.16.1

Change-Id: Ic5caffe7fb7082869753947c943c8c49f0ecfc56
(cherry picked from commit 8a287bf5c5635daf99217eb14d6957c22911d7bf)

7 weeks agoupdate pickle tests
Mike Bayer [Wed, 11 Jun 2025 18:55:14 +0000 (14:55 -0400)] 
update pickle tests

Since I want to get rid of util.portable_instancemethod, first
make sure we are testing pickle extensively including going through
all protocols for all metadata-oriented tests.

Change-Id: I0064bc16033939780e50c7a8a4ede60ef5835b38
(cherry picked from commit 239f629b9a94b315c289930cadca4a49f2f70565)

7 weeks agouse integer division on maxlen
Mike Bayer [Tue, 10 Jun 2025 21:33:14 +0000 (17:33 -0400)] 
use integer division on maxlen

this was coming out as a float and breaking alembic column
compare

Change-Id: I50160cfdb2f2933331d3c316c9985f24fb914242
(cherry picked from commit 61477cf8b8af2b5a7123764a564da056f1a5c999)

7 weeks agofix typo in docs
Federico Caselli [Tue, 10 Jun 2025 20:18:38 +0000 (22:18 +0200)] 
fix typo in docs

Change-Id: I675636e7322ba95bb8f5f8107d5a8f3dbbc689ca
(cherry picked from commit 4c5761a114ae45eaddccb45d50b6432c9c44e4ab)

7 weeks agoMerge "update tox mypy" into rel_2_0
Michael Bayer [Tue, 10 Jun 2025 17:27:29 +0000 (17:27 +0000)] 
Merge "update tox mypy" into rel_2_0

7 weeks agoMerge "use sys.columns to allow accurate joining to other SYS tables" into rel_2_0
Michael Bayer [Tue, 10 Jun 2025 14:55:56 +0000 (14:55 +0000)] 
Merge "use sys.columns to allow accurate joining to other SYS tables" into rel_2_0

7 weeks agoupdate tox mypy
Pablo Estevez [Mon, 9 Jun 2025 12:49:13 +0000 (08:49 -0400)] 
update tox mypy

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

After this commit https://github.com/sqlalchemy/sqlalchemy/commit/68cd3e8ec7098d4bb4b2102ad247f84cd89dfd8c
tox will fail with mypy below 1.16, at least locally.

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

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #12655
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12655
Pull-request-sha: 15acf6b06570048d81aae89ef1d9f9a8ff83d88c

Change-Id: I7eb29a939a701ffd3a89a03d9705ab4954e66ffb
(cherry picked from commit 2ab2a3ed2a0b2b596da31e61e84ca5ff42c1ddc7)

7 weeks agodocument column_expression applies only to outermost statement
Mike Bayer [Tue, 10 Jun 2025 14:07:53 +0000 (10:07 -0400)] 
document column_expression applies only to outermost statement

References: https://github.com/sqlalchemy/sqlalchemy/discussions/12660
Change-Id: Id7cf98bd4560804b2f778cde41642f02f7edaf95
(cherry picked from commit 0e33848fe5330a60037594370cd7868907348c18)

7 weeks agoguard against schema_translate_map adding/removing None vs. caching
Mike Bayer [Tue, 10 Jun 2025 13:21:01 +0000 (09:21 -0400)] 
guard against schema_translate_map adding/removing None vs. caching

Change-Id: Iad29848b5fe15e314ad791b7fc0aac58700b0c68
(cherry picked from commit 1eb28772f0e602855cea292610f08d2581905d00)

7 weeks agouse sys.columns to allow accurate joining to other SYS tables
Mike Bayer [Sun, 8 Jun 2025 17:01:45 +0000 (13:01 -0400)] 
use sys.columns to allow accurate joining to other SYS tables

Reworked SQL Server column reflection to be based on the ``sys.columns``
table rather than ``information_schema.columns`` view.  By correctly using
the SQL Server ``object_id()`` function as a lead and joining to related
tables on object_id rather than names, this repairs a variety of issues in
SQL Server reflection, including:

* Issue where reflected column comments would not correctly line up
with the columns themselves in the case that the table had been ALTERed
* Correctly targets tables with awkward names such as names with brackets,
when reflecting not just the basic table / columns but also extended
information including IDENTITY, computed columns, comments which
did not work previously
* Correctly targets IDENTITY, computed status from temporary tables
which did not work previously

Fixes: #12654
Change-Id: I3bf3088c3eec8d7d3d2abc9da35f9628ef78d537
(cherry picked from commit c868afc090dde3ce5beac5cd3d6776567e9cf845)

8 weeks agoFix missing data type in Article.writer_id mapping example (#12649)
krave1986 [Sat, 7 Jun 2025 20:03:10 +0000 (04:03 +0800)] 
Fix missing data type in Article.writer_id mapping example (#12649)

(cherry picked from commit f2eda87a6b7f1534851da2d0370bd034d1791bfc)

8 weeks agoupdate docs for "copy column" warning
Mike Bayer [Sat, 7 Jun 2025 13:01:14 +0000 (09:01 -0400)] 
update docs for "copy column" warning

these docs failed to mention we're talking about ORM flush

References: #12650
Change-Id: I3a1655ba99e98021327c90d5cd0c0f8258f4ddc6
(cherry picked from commit 39142af868c0bd98e6ce59c009e62a597a2452f2)

8 weeks agohardcode now(), current_timstamp() into the MySQL regex
Mike Bayer [Thu, 5 Jun 2025 12:58:49 +0000 (08:58 -0400)] 
hardcode now(), current_timstamp() into the MySQL regex

Fixed yet another regression caused by by the DEFAULT rendering changes in
2.0.40 :ticket:`12425`, similar to :ticket:`12488`, this time where using a
CURRENT_TIMESTAMP function with a fractional seconds portion inside a
textual default value would also fail to be recognized as a
non-parenthesized server default.

There's no way to do this other than start hardcoding a list
of MySQL functions that demand that parenthesis are not added around
them, I can think of no other heuristic that will work here.
Suggestions welcome

Fixes: #12648
Change-Id: I75d274b56306089929b369ecfb23604e9d6fa9dd
(cherry picked from commit 8e9f789f1aa0309005e8b7725643b32802e7d214)

2 months agogive up on running py 3.14 in github actions
Mike Bayer [Tue, 3 Jun 2025 21:15:54 +0000 (17:15 -0400)] 
give up on running py 3.14 in github actions

not worth it

this is a good learning case for why we use jenkins

Change-Id: If70b0029545c70c0b5a9e1c203c853164caef874
(cherry picked from commit af2895a1d767a5357ccfeec9b57568cd6a6e0846)

2 months agoadd python 3.14 to run-test
Mike Bayer [Tue, 3 Jun 2025 18:28:19 +0000 (14:28 -0400)] 
add python 3.14 to run-test

If I'm reading correctly at https://github.com/actions/python-versions ,
there are plenty of python 3.14 versions available, so this should
"work".

Still not sure about wheel building so leaving that separate

Change-Id: Idd1ce0db124b700091f5499d6a7d087f6e31777e
(cherry picked from commit 9128189eaacf05a8479b27ef5b2e77f27f2f5ec3)

2 months agoMerge "Reflect index's column operator class on PostgreSQL" into rel_2_0
Michael Bayer [Tue, 3 Jun 2025 18:24:04 +0000 (18:24 +0000)] 
Merge "Reflect index's column operator class on PostgreSQL" into rel_2_0

2 months agoadd future mode tests for MappedAsDataclass; more py314b1 regressions
Mike Bayer [Fri, 9 May 2025 15:50:26 +0000 (11:50 -0400)] 
add future mode tests for MappedAsDataclass; more py314b1 regressions

for py314b2 all issues should be resolved

py314: yes
Change-Id: I498a1f623aeb5eb664289236e01e35d8a3dec99f
(cherry picked from commit 68f33ac943f07aaa1ade85d86e5113d5bec4ce65)

2 months agoFix type errors surfaced by mypy 1.16
Federico Caselli [Fri, 30 May 2025 20:53:59 +0000 (22:53 +0200)] 
Fix type errors surfaced by mypy 1.16

Change-Id: I50bbd760577ff7c865c81153041e82bba068e5d8
(cherry picked from commit 7088f7962bcdf497892da85aff16022d27662eb4)

2 months agoReflect index's column operator class on PostgreSQL
Denis Laxalde [Wed, 28 May 2025 19:37:36 +0000 (15:37 -0400)] 
Reflect index's column operator class on PostgreSQL

Fill the `postgresql_ops` key of PostgreSQL's `dialect_options` returned by get_multi_indexes() with a mapping from column names to the operator class, if it's not the default for respective data type.

As we need to join on ``pg_catalog.pg_opclass``, the table definition is added to ``postgresql.pg_catalog``.

Fixes #8664.

Closes: #12504
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12504
Pull-request-sha: 8fdf93e1b27c371f52990d5fda8b2fdf79ec23eb

Change-Id: I8789c1e9d15f8cc9a7205f492ec730570f19bbcc
(cherry picked from commit 0642541c6371d19c8d28ff0bdaf6ab3822715a6d)

2 months agoMerge "update black to 25.1.0 to align it with alembic" into rel_2_0
Michael Bayer [Tue, 27 May 2025 19:48:40 +0000 (19:48 +0000)] 
Merge "update black to 25.1.0 to align it with alembic" into rel_2_0

2 months agoMerge "Add missing requires in the tests for older postgresql version" into rel_2_0
Michael Bayer [Sun, 25 May 2025 14:16:33 +0000 (14:16 +0000)] 
Merge "Add missing requires in the tests for older postgresql version" into rel_2_0

2 months agofix missing quotes from cast call in mysqlconnector module
Federico Caselli [Fri, 23 May 2025 21:10:43 +0000 (23:10 +0200)] 
fix missing quotes from cast call in mysqlconnector module

This fixes an issue introduced by 51a7678db2f0fcb1552afa40333640bc7fbb6dac
in I37bd98049ff1a64d58e9490b0e5e2ea764dd1f73

Change-Id: Id738c04ee4dc8c2b12d9ab0fc71a4e1a6c5bc209
(cherry picked from commit 1070889f263be89e0e47bdbb9f7113e98ead192b)

2 months agoupdate black to 25.1.0 to align it with alembic
Federico Caselli [Tue, 20 May 2025 20:15:06 +0000 (22:15 +0200)] 
update black to 25.1.0 to align it with alembic

Change-Id: I2ac332237f18bbc44155eadee35c64f62adc2867
(cherry picked from commit 76e49d06ceed2121023defe2ff727acea0f1a0e5)

2 months agoDoc: Update connection / reconnecting_engine (#12617)
François-Michel L'Heureux [Fri, 23 May 2025 20:23:53 +0000 (16:23 -0400)] 
Doc: Update connection / reconnecting_engine (#12617)

(cherry picked from commit 4cac1c6002f805879188c21fb4c75b7406d743f3)

2 months agodocs: Clarify that relationship() first parameter is positional (#12621)
krave1986 [Fri, 23 May 2025 20:23:00 +0000 (04:23 +0800)] 
docs: Clarify that relationship() first parameter is positional (#12621)

(cherry picked from commit 18ee6a762ce2ab00671bcce60d6baf1b31291e71)

2 months agoAdd missing requires in the tests for older postgresql version
Denis Laxalde [Wed, 21 May 2025 07:23:12 +0000 (03:23 -0400)] 
Add missing requires in the tests for older postgresql version

Follow up commit 39bb17442ce6ac9a3dde5e2b72376b77ffce5e28.

Closes: #12612
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12612
Pull-request-sha: 894276ff232ba328cc235ecf04e84067db204c3d

Change-Id: Ib8d47f11e34d6bb40d9a88d5f411c2d5fee70823
(cherry picked from commit 6154aa1b50391aa2a0e69303d8a3b5c2a17dc67a)

2 months agoUse pg_index's indnatts when indnkeyatts is not available
Denis Laxalde [Tue, 20 May 2025 14:26:14 +0000 (10:26 -0400)] 
Use pg_index's indnatts when indnkeyatts is not available

Using NULL when this column is not available does not work with old PostgreSQL (tested on version 9.6, as reported in #12600).

Instead, use `indnatts` which should be equal to what `indnkeyatts` would be as there is no "included attributes" in the index on these old versions (but only "key columns").

From https://www.postgresql.org/docs/17/catalog-pg-index.html:
* `indnatts`, "The total number of columns in the index [...]; this number includes both key and included attributes"
* `indnkeyatts`, "The number of key columns in the index, not counting any included columns [...]"

Fixes #12600.

Closes: #12611
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12611
Pull-request-sha: 8ff48a6225ec58fdfa84aec75d487238281b1ac1

Change-Id: Idcadcd7db545bc1f73d85b29347c8ba388b1b41d
(cherry picked from commit 9071811de76dea558f932215870e4a5513b30362)

2 months agoMerge "Type mysql dialect" into rel_2_0
Michael Bayer [Tue, 20 May 2025 14:51:24 +0000 (14:51 +0000)] 
Merge "Type mysql dialect" into rel_2_0

2 months agoType mysql dialect
Pablo Estevez [Tue, 13 May 2025 13:39:19 +0000 (09:39 -0400)] 
Type mysql dialect

Closes: #12164
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12164
Pull-request-sha: 545e2c39d5ee4f3938111b26e098fa2aa2b6e800
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I37bd98049ff1a64d58e9490b0e5e2ea764dd1f73
(cherry picked from commit d89db542e419ac83ce1a43a5c2bf3c8225d6d2e9)

2 months agoUpdate index.rst in dialects docs to include Denodo (#12604)
Denodo Research Labs [Mon, 19 May 2025 20:19:34 +0000 (22:19 +0200)] 
Update index.rst in dialects docs to include Denodo (#12604)

(cherry picked from commit 279cd787ca12792d401bf9b45f2895c7b5dc0c77)

2 months agobackport mysql / base portions of #10415 to 2.0
Mike Bayer [Sun, 18 May 2025 17:54:09 +0000 (13:54 -0400)] 
backport mysql / base portions of #10415 to 2.0

For a backport of the mysql typing change in [1] to be useful, we need
to have most of the asyncio typing installed as well.  To make this
easier include that we will backport aiomysql / asyncmy over to the
connectors/asyncio.py connector which is already in use.

[1] https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5829
Change-Id: I0414ed1f736a329ecdc9a662dbee71d621a463ae

2 months agoi think we dont need DOMAIN.adapt()
Mike Bayer [Fri, 16 May 2025 14:33:03 +0000 (10:33 -0400)] 
i think we dont need DOMAIN.adapt()

this seems to be redundant vs. what constructor copy does.

Issues are afoot w/ domain in any case see multiple issues
at [1]

[1] https://github.com/sqlalchemy/sqlalchemy/discussions/12592
Change-Id: I49879df6b78170435f021889f8f56ec43abc75c7

Change-Id: Id8fba884d47f3a494764262e23b3cc889f2cd033
(cherry picked from commit 37e1654bff3415856fc217f687bb0fbfac6666ba)

2 months agoexpand column options for composites up front at the attribute level
Mike Bayer [Thu, 15 May 2025 17:39:36 +0000 (13:39 -0400)] 
expand column options for composites up front at the attribute level

Implemented the :func:`_orm.defer`, :func:`_orm.undefer` and
:func:`_orm.load_only` loader options to work for composite attributes, a
use case that had never been supported previously.

Fixes: #12593
Change-Id: Ie7892a710f30b69c83f586f7492174a3b8198f80
(cherry picked from commit b25ce03c8d0d2a9d4f186b9b2b2c82b02b9645b7)

2 months agoVersion 2.0.42 placeholder
Mike Bayer [Wed, 14 May 2025 17:11:05 +0000 (13:11 -0400)] 
Version 2.0.42 placeholder

2 months ago- 2.0.41 rel_2_0_41
Mike Bayer [Wed, 14 May 2025 17:04:02 +0000 (13:04 -0400)] 
- 2.0.41

2 months agouse pep639 license
Mike Bayer [Wed, 14 May 2025 12:24:44 +0000 (08:24 -0400)] 
use pep639 license

Removed the "license classifier" from setup.cfg for SQLAlchemy 2.0, which
eliminates loud deprecation warnings when building the package.  SQLAlchemy
2.1 will use a full :pep:`639` configuration in pyproject.toml while
SQLAlchemy 2.0 remains using ``setup.cfg`` for setup.

Change-Id: If732dca7f9b57a4c6a789a68ecc77f0293be4786
(cherry picked from commit c93f50421ba5e96079cc89db80282aaaf6e09a6e)

2 months agochangelog edits
Mike Bayer [Wed, 14 May 2025 12:20:03 +0000 (08:20 -0400)] 
changelog edits

Change-Id: Ib2bb33698f58a62c945d147c39d3ac6af908b802
(cherry picked from commit c7d5c2ab5a7c5c97f80a904fcd3d5dcc9ebe954d)

2 months agoremove __getattr__ from root
Mike Bayer [Tue, 13 May 2025 15:28:25 +0000 (11:28 -0400)] 
remove __getattr__ from root

Removed ``__getattr__()`` rule from ``sqlalchemy/__init__.py`` that
appeared to be trying to correct for a previous typographical error in the
imports. This rule interferes with type checking and is removed.

Fixes: #12588
Change-Id: I682b1f3c13b842d6f43ed02d28d9774b55477516
(cherry picked from commit c3f1ea62286a0b038482437923c4d1c53d668dcb)

2 months agorewrite the docs on SQLite transaction handling
Mike Bayer [Mon, 12 May 2025 19:25:07 +0000 (15:25 -0400)] 
rewrite the docs on SQLite transaction handling

SQLite has added the new "connection.autocommit" mode and
associated fixes for pep-249 as of python 3.12.   they plan to
default to using this attribute as of python 3.16.   Get
on top of things by rewriting the whole doc section here, removing
old cruft about sqlalchemy isolation levels that was not correct
in any case, update recipes in a more succinct and unified way.

References: #12585
Change-Id: I9d1de8dcc27f1731ecd3c723718942148dcd0a1a
(cherry picked from commit 10ff201db40e069e8f90bb0883a916ba3d9cc96e)

2 months agoimplement pep-649 workarounds, test suite passing for python 3.14
Mike Bayer [Thu, 6 Mar 2025 14:12:43 +0000 (09:12 -0500)] 
implement pep-649 workarounds, test suite passing for python 3.14

Changes to the test suite to accommodate Python 3.14 as of version
3.14.0b1
Originally this included a major breaking change to how python 3.14
implemented :pep:`649`, however this was resolved by [1].
As of a7, greenlet is skipped due to issues in a7 and later b1
in [2].
1. the change to rewrite all conditionals in annotation related tests
   is reverted.
2. test_memusage needed an explicit set_start_method() call so that
   it can continue to use plain fork
3. unfortunately at the moment greenlet has to be re-disabled for 3.14.
4. Changes to tox overall, remove pysqlcipher which hasn't worked
   in years, etc.
5. we need to support upcoming typing-extensions also, install the beta
6. 3.14.0a7 introduces major regressions to our runtime typing
   utilities, unfortunately, it's not clear if these can be resolved
7. for 3.14.0b1, we have to vendor get_annotations to work around [3]

[1] https://github.com/python/cpython/issues/130881
[2] https://github.com/python-greenlet/greenlet/issues/440
[3] https://github.com/python/cpython/issues/133684

py314: yes
Fixes: #12405
References: #12399
Change-Id: I8715d02fae599472dd64a2a46ccf8986239ecd99

2 months agoMerge "dont render URL in unparseable URL error message" into rel_2_0
Michael Bayer [Thu, 8 May 2025 13:33:16 +0000 (13:33 +0000)] 
Merge "dont render URL in unparseable URL error message" into rel_2_0

2 months agodont render URL in unparseable URL error message
Mike Bayer [Thu, 8 May 2025 12:34:21 +0000 (08:34 -0400)] 
dont render URL in unparseable URL error message

The error message that is emitted when a URL cannot be parsed no longer
includes the URL itself within the error message.

Fixes: #12579
Change-Id: Icd17bd4fe0930036662b6a4fe0264cb13df04ba7
(cherry picked from commit aaa28f457eaa3f98c417666b4d0ad4d70ccb1ac0)

2 months agotyping: pg: type NamedType create/drops (fixes #12557)
Justine Krejcha [Tue, 6 May 2025 19:18:02 +0000 (15:18 -0400)] 
typing: pg: type NamedType create/drops (fixes #12557)

Type the `create` and `drop` functions for `NamedType`s

Also partially type the SchemaType create/drop functions more generally

One change to this is that the default parameter of `None` is removed. It doesn't work and will fail with a `AttributeError` at runtime since it immediately tries to access a property of `None` which doesn't exist.

Fixes #12557

This pull request is:

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

**Have a nice day!**

Closes: #12558
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12558
Pull-request-sha: 75c8d81bfb68f45299a9448d45dda446532205d3

Change-Id: I173771d365f34f54ab474b9661e1cdc70cc4de84
(cherry picked from commit b4d7bf7a2f74db73e12f47ca4cb45666bf08439e)

2 months agoreorganize ORM Annotated Declarative into its own section
Mike Bayer [Tue, 6 May 2025 22:06:15 +0000 (18:06 -0400)] 
reorganize ORM Annotated Declarative into its own section

The ORM Annotated Declarative section is now very large but has been
indented under the "Declarative Table with mapped_column()" section
where it does not show up well on top level TOCs and is too deeply
nested.   Break it out into its own section following the
entire "Declarative Table" section, but also maintain a short intro
section inside of "Declarative Table" to ensure this use is still
prominent.

Change-Id: I42f4aff6ed54da249c94ddf50727f9fe3c3bd625
(cherry picked from commit bcc4af9e061074bfdf795403027c851df8bec777)

2 months agoMerge "Added vector datatype support in Oracle dialect" into rel_2_0
Michael Bayer [Tue, 6 May 2025 13:25:36 +0000 (13:25 +0000)] 
Merge "Added vector datatype support in Oracle dialect" into rel_2_0

2 months agofix failing typing test
Federico Caselli [Mon, 5 May 2025 21:03:18 +0000 (23:03 +0200)] 
fix failing typing test

fix failing test added in 4ac02007e030232f57226aafbb9313c8ff186a62

Change-Id: If0c62fac8744caa98bd04f808ef381ffb04afd7f
(cherry picked from commit 46996843876a7635705686f67057fba9c795d787)

2 months agoFix issues in versioning.rst (#12567)
krave1986 [Mon, 5 May 2025 19:38:19 +0000 (03:38 +0800)] 
Fix issues in versioning.rst (#12567)

(cherry picked from commit e1f2f204c1b2967486d160b19a8ddf21c0b698bf)

2 months agoRemove unused typing imports (#12568)
Shamil [Mon, 5 May 2025 18:05:21 +0000 (21:05 +0300)] 
Remove unused typing imports (#12568)

* Remove unused typing imports

* remove unused per file ignores

* Revert "remove unused per file ignores"

---------

Co-authored-by: Pablo Estevez <pablo22estevez@gmail.com>
(cherry picked from commit 37c5b2e3e2cea552b5000df9281285b9f74c8166)

2 months agoAdded vector datatype support in Oracle dialect
suraj [Mon, 5 May 2025 15:14:35 +0000 (11:14 -0400)] 
Added vector datatype support in Oracle dialect

Added new datatype :class:`_oracle.VECTOR` and accompanying DDL and DQL
support to fully support this type for Oracle Database. This change
includes the base :class:`_oracle.VECTOR` type that adds new type-specific
methods ``l2_distance``, ``cosine_distance``, ``inner_product`` as well as
new parameters ``oracle_vector`` for the :class:`.Index` construct,
allowing vector indexes to be configured, and ``oracle_fetch_approximate``
for the :meth:`.Select.fetch` clause.  Pull request courtesy Suraj Shaw.

Fixes: #12317
Closes: #12321
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12321
Pull-request-sha: a72a18a45c85ae7fa50a34e97ac642e16b463b54

Change-Id: I6f3af4623ce439d0820c14582cd129df293f0ba8
(cherry picked from commit 1b780ce3d3f7e33e5cc9e49eafa316a514cdc324)

3 months agoMerge "fix sqlite localtimestamp function" into rel_2_0
Michael Bayer [Thu, 1 May 2025 15:42:50 +0000 (15:42 +0000)] 
Merge "fix sqlite localtimestamp function" into rel_2_0

3 months agoadd black dependency for format_docs_code
Mike Bayer [Thu, 1 May 2025 13:49:33 +0000 (09:49 -0400)] 
add black dependency for format_docs_code

this doesnt run if black is not installed, so use a python
env for it

Change-Id: I567d454917e7e8e4be2b7a21ffc511900f16457c
(cherry picked from commit 667a5d397ff50b24d4d4cf7e600d51fe84188949)

3 months agofix sqlite localtimestamp function
Mike Bayer [Thu, 1 May 2025 13:43:29 +0000 (09:43 -0400)] 
fix sqlite localtimestamp function

Fixed and added test support for a few SQLite SQL functions hardcoded into
the compiler most notably the "localtimestamp" function which rendered with
incorrect internal quoting.

Fixes: #12566
Change-Id: Id5bd8dc7841f0afab7df031ba5c0854dab845a1d
(cherry picked from commit d689e465edf11308b0efba018aa84c3d79ccbaab)

3 months agoadd correct typing for row getitem
Federico Caselli [Mon, 28 Apr 2025 21:44:50 +0000 (23:44 +0200)] 
add correct typing for row getitem

The overloads were broken in 8a4c27589500bc57605bb8f28c215f5f0ae5066d

Change-Id: I3736b15e95ead28537e25169a54521e991f763da
(cherry picked from commit 4ac02007e030232f57226aafbb9313c8ff186a62)

3 months agoFix simple typo (#12555)
Ross Patterson [Tue, 29 Apr 2025 20:14:09 +0000 (13:14 -0700)] 
Fix simple typo (#12555)

(cherry picked from commit 35c7fa9e9e591b120b5d20cf4125f46a3f23a251)

3 months agorefactor (orm): remove unused variables and simplify key lookups
Federico Caselli [Thu, 24 Apr 2025 22:02:32 +0000 (18:02 -0400)] 
refactor (orm): remove unused variables and simplify key lookups

Redundant variables and unnecessary conditions were removed across several modules. Improved readability and reduced code complexity without changing functionality.

Closes: #12537
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12537
Pull-request-sha: ab53f8c3487e8cfb4d4a0235c27d8a5b8557d193

Change-Id: I910d65729fdbc96933f9822c553924d37e89e201
(cherry picked from commit 29895487915b8858deb2f8ac4a88d92917641c55)

3 months agofix reference cycles/ perf in DialectKWArgs
Mike Bayer [Sat, 26 Apr 2025 15:32:30 +0000 (11:32 -0400)] 
fix reference cycles/ perf in DialectKWArgs

Identified some unnecessary cycles and overhead in how
this is implemented.  since we want to add this to Select,
needs these improvements.

Change-Id: I4324db14aaf52ab87a8b7fa49ebf1b6624bc2dcb
(cherry picked from commit ce3bbfcc4550e72a603640e533bc736715c5d76b)

3 months agoMerge "refactor(testing-and-utils): Remove unused code and fix style issues" into...
Federico Caselli [Thu, 24 Apr 2025 21:50:54 +0000 (21:50 +0000)] 
Merge "refactor(testing-and-utils): Remove unused code and fix style issues" into rel_2_0

3 months agoMerge "refactor: clean up unused variables in engine module" into rel_2_0
Federico Caselli [Thu, 24 Apr 2025 21:50:38 +0000 (21:50 +0000)] 
Merge "refactor: clean up unused variables in engine module" into rel_2_0

3 months agoMerge "refactor (sql): simplify and optimize internal SQL handling" into rel_2_0
Federico Caselli [Thu, 24 Apr 2025 21:50:07 +0000 (21:50 +0000)] 
Merge "refactor (sql): simplify and optimize internal SQL handling" into rel_2_0

3 months agoMerge "refactor: simplify and clean up dialect-specific code" into rel_2_0
Federico Caselli [Thu, 24 Apr 2025 20:32:12 +0000 (20:32 +0000)] 
Merge "refactor: simplify and clean up dialect-specific code" into rel_2_0

3 months agoUpdate entry for sqlalchemy-hana (#12553)
Christoph Heer [Thu, 24 Apr 2025 20:00:52 +0000 (22:00 +0200)] 
Update entry for sqlalchemy-hana (#12553)

(cherry picked from commit 686b3423d2a20325ccae4d5cf998774885f52c9f)

3 months agorefactor(testing-and-utils): Remove unused code and fix style issues
Shamil [Mon, 21 Apr 2025 16:35:43 +0000 (12:35 -0400)] 
refactor(testing-and-utils): Remove unused code and fix style issues

This PR includes several small refactorings and style fixes aimed at improving code cleanliness, primarily within the test suite and tooling.

Key changes:

*   Removed assignments to unused variables in various test files (`test_dialect.py`, `test_reflection.py`, `test_select.py`).
*   Removed an unused variable in the pytest plugin (`pytestplugin.py`).
*   Removed an unused variable in the topological sort utility (`topological.py`).
*   Fixed a minor style issue (removed an extra blank line) in the `cython_imports.py` script.

Closes: #12539
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12539
Pull-request-sha: 837c1e6cb17f0ff31444d5161329c318b52e48e7

Change-Id: Ifa37fb956bc3cacd31967f08bdaa4254e16911c2
(cherry picked from commit 64f45d0a6b4ad41cf570a8f0e09b86fba0ebb043)
(cherry picked from commit e15cb0779b42829027faea3496fa0d5163d9e2f5)

3 months agorefactor: clean up unused variables in engine module
Shamil [Thu, 17 Apr 2025 19:48:19 +0000 (15:48 -0400)] 
refactor: clean up unused variables in engine module

Removed unused variables to improve code clarity and maintainability. This change simplifies logic in `base.py`, `default.py`, and `result.py`. No functionality was altered.

Closes: #12535
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12535
Pull-request-sha: a9d849f3a4f3abe9aff49279c4cc81aa26aeaa9b

Change-Id: If78b18dbd33733c631f8b5aad7d55261fbc4817b
(cherry picked from commit d1d81f80a3764e3ebc38481fb6fd82cf6295dcf9)
(cherry picked from commit ba433ff9f567b0c58f5f78c2d5cf262f9e5e9c43)

3 months agorefactor (sql): simplify and optimize internal SQL handling
Shamil [Mon, 21 Apr 2025 16:36:21 +0000 (12:36 -0400)] 
refactor (sql): simplify and optimize internal SQL handling

Replaced redundant variable assignments with direct operations. Used `dict.get()` for safer dictionary lookups to streamline logic. Improves code readability and reduces unnecessary lines.

Closes: #12538
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12538
Pull-request-sha: d322d1508cfc37668099e6624816aba9c647ad51

Change-Id: Ib3dfc7086ec35117fdad65e136a17aa014b96ae5
(cherry picked from commit 93b0be7009b4f6efd091fda31229353f929f4cc9)

3 months agorefactor: simplify and clean up dialect-specific code
Shamil [Thu, 17 Apr 2025 15:23:21 +0000 (11:23 -0400)] 
refactor: simplify and clean up dialect-specific code

**Title:** Removed unused variables and redundant functions across multiple dialects. Improves code readability and reduces maintenance complexity without altering functionality.
### Description
This pull request introduces several minor refactorings across different dialect modules:
- **MSSQL:**
    - Simplified the initialization of the `fkeys` dictionary in `_get_foreign_keys` using `util.defaultdict` directly.

- **MySQL:** Removed the unused variable in `_get_table_comment`. `rp`
- **PostgreSQL (_psycopg_common):** Removed the unused variable `cursor` in `do_ping`.
- **PostgreSQL (base):** Removed the unused variable `args` in `_get_column_info`.
- **SQLite:** Removed the unused variable `new_filename` in `generate_driver_url`.

These changes focus purely on code cleanup and simplification, removing dead code and improving clarity. They do not alter the existing logic or functionality of the dialects.
### Checklist
This pull request is:
- [ ] A documentation / typographical / small typing error fix
- [x] A short code fix
    - _Note: This is a general cleanup refactor rather than a fix for a specific reported issue._

- [ ] A new feature implementation

**Have a nice day!**

Closes: #12534
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12534
Pull-request-sha: 2c7ae17b73192ba6bff6bec953b307a88ea31847

Change-Id: I1ec3b48f42aea7e45bc20f81add03051eb30bb98
(cherry picked from commit bb5bfb4beb35450ee8db7a173b9b438e065a90a9)

3 months agoMerge "optimize `@util.decorator`" into rel_2_0
Michael Bayer [Mon, 21 Apr 2025 23:08:52 +0000 (23:08 +0000)] 
Merge "optimize `@util.decorator`" into rel_2_0

3 months agodisable mysql/connector-python, again
Mike Bayer [Mon, 21 Apr 2025 13:44:40 +0000 (09:44 -0400)] 
disable mysql/connector-python, again

Just as we got this driver "working", a new regression is introduced
in version 9.3.0 which prevents basic binary string persistence [1].
I would say we need to leave this driver off for another few years
until something changes with its upstream maintenance.

[1] https://bugs.mysql.com/bug.php?id=118025

Change-Id: If876f63ebb9a6f7dfa0b316df044afa469a154f2
(cherry picked from commit 3217acc1131048aa67744e032fe8816407d8dfba)

3 months agochore: add type hint for reconstructor (#12527)
Ryu Juheon [Thu, 17 Apr 2025 19:48:54 +0000 (04:48 +0900)] 
chore: add type hint for reconstructor (#12527)

* chore: add type hint for reconstructor

* chore: fix attr-defined

* chore: use defined typevar

* chore: ignore type error

(cherry picked from commit 299284cec65076fd4c76bf1efaae60b60f4d4f7b)