]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
11 hours agoupdate install faq to align with code main
Federico Caselli [Wed, 30 Jul 2025 20:36:35 +0000 (22:36 +0200)] 
update install faq to align with code

Closes #12757

Change-Id: I13b98a185fb4347cd172c6a6f95214672ae05fec

36 hours agoremove obsolete file
Federico Caselli [Tue, 29 Jul 2025 20:17:27 +0000 (22:17 +0200)] 
remove obsolete file

Remove mypy_plugin.ini file that's no loger useful, since the mypy
plugin was removed in d69765829c9fbc98f21a22dbc496f2b7b22dc52c

Change-Id: I3f49a367b36b07e8cc1b10b415d6209de2eef3fb

36 hours agoRemove unnecessary r-prefix from docstring in 'columns' method (#12768)
Sviatoslav Bobryshev [Tue, 29 Jul 2025 20:08:15 +0000 (23:08 +0300)] 
Remove unnecessary r-prefix from docstring in 'columns' method (#12768)

43 hours agocherry-pick changelog update for 2.0.43
Mike Bayer [Tue, 29 Jul 2025 12:48:27 +0000 (08:48 -0400)] 
cherry-pick changelog update for 2.0.43

43 hours agocherry-pick changelog from 2.0.42
Mike Bayer [Tue, 29 Jul 2025 12:48:27 +0000 (08:48 -0400)] 
cherry-pick changelog from 2.0.42

44 hours agorepair changelog file
Mike Bayer [Tue, 29 Jul 2025 11:34:56 +0000 (07:34 -0400)] 
repair changelog file

Change-Id: I40994de5197271060e97a0bd7bccafc7c08918d8

44 hours agoMerge "Add ``dataclass_metadata`` parameter to orm cols" into main
Michael Bayer [Tue, 29 Jul 2025 11:25:12 +0000 (11:25 +0000)] 
Merge "Add ``dataclass_metadata`` parameter to orm cols" into main

44 hours agoMerge "Fix reflection of enum named intervalsomething" into main
Michael Bayer [Tue, 29 Jul 2025 11:21:12 +0000 (11:21 +0000)] 
Merge "Fix reflection of enum named intervalsomething" into main

2 days agoFix reflection of enum named intervalsomething
Federico Caselli [Mon, 21 Jul 2025 21:36:43 +0000 (23:36 +0200)] 
Fix reflection of enum named intervalsomething

Fixes bug that would mistakenly interpret a domain or enum type
with name starting in ``interval`` as an ``INTERVAL`` type while
reflecting a table.

Fixes: #12744
Change-Id: I89ab287c3847ca545691afe73f26d86bf2337ae0

2 days agoMerge "Add orderinglist type annotations" into main
Federico Caselli [Mon, 28 Jul 2025 12:29:24 +0000 (12:29 +0000)] 
Merge "Add orderinglist type annotations" into main

2 days agoMerge "type aiosqlite" into main
Federico Caselli [Mon, 28 Jul 2025 12:05:01 +0000 (12:05 +0000)] 
Merge "type aiosqlite" into main

4 days agoAdd orderinglist type annotations
Martijn Pieters [Mon, 25 Nov 2024 19:38:48 +0000 (14:38 -0500)] 
Add orderinglist type annotations

Closes: #10889
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10889
Pull-request-sha: 2ddeeb190630a8965a4fae567e2649ed16722c99

Change-Id: I9a0d6e2776d8b6756af4a3c54668bdcd1a1f40f8

4 days agoFix rendering of a SQL example in indexable examples (#12751)
Denis Laxalde [Sat, 26 Jul 2025 16:02:46 +0000 (18:02 +0200)] 
Fix rendering of a SQL example in indexable examples (#12751)

10 days 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

10 days agoavid importing from primate module
Federico Caselli [Sun, 20 Jul 2025 08:54:32 +0000 (10:54 +0200)] 
avid importing from primate module

Change-Id: Ia1581cf6db0ed2d2f995ef5f40d4cff944252e80

11 days agoMerge "typing: improve type coverage in sql.base" into main
Michael Bayer [Sat, 19 Jul 2025 11:12:41 +0000 (11:12 +0000)] 
Merge "typing: improve type coverage in sql.base" into main

11 days agoMerge "Improve handling of sentinel columns" into main
Michael Bayer [Sat, 19 Jul 2025 11:09:50 +0000 (11:09 +0000)] 
Merge "Improve handling of sentinel columns" into main

12 days 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

13 days 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>
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

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

Was 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

2 weeks agotyping: improve type coverage in sql.base
KapilDagur [Mon, 14 Jul 2025 19:36:30 +0000 (15:36 -0400)] 
typing: improve type coverage in sql.base

improve type coverage in `sqlalchemy.sql.base`

References: #6810
Closes: #12707
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12707
Pull-request-sha: 7374212dfc88a43f381f8380d9b4ac193f5ed10b

Change-Id: Ied0676f420bc27ae033f0a5e6e22d806d20f4404

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

Change-Id: I25708115b44bf46d22a2a81fe010db875a8bcb22

2 weeks agoImprove handling of sentinel columns
Federico Caselli [Fri, 29 Dec 2023 21:30:24 +0000 (22:30 +0100)] 
Improve handling of sentinel columns

Fixed issue in "insertmanyvalues" feature where an INSERT..RETURNING
that also made use of a sentinel column to track results would fail to
filter out the additional column when :meth:`.Result.unique` were used
to uniquify the result set.

Fixes: #10802
Change-Id: Ie4f9dab96193099002088c5219cc41a543a00f62

2 weeks agoUnconditionally flush session on all statement executions
Mike Bayer [Thu, 10 Jul 2025 19:29:29 +0000 (15:29 -0400)] 
Unconditionally flush session on all statement executions

This change simplifies session execution logic to always run autoflush
for all statement executions, regardless of whether they are ORM or Core
statements. Previously, autoflush was conditionally applied only when
ORM-related statements were detected, which had become difficult to define
clearly with the unified v2 syntax that blurs the lines between Core and
ORM execution patterns.

The implementation adds a call to self._autoflush() in the Core execution
path (when compile_state_cls is None) in Session._execute_internal(),
ensuring consistent autoflush behavior across all types of SQL execution.

This provides more predictable session behavior and eliminates the
confusion around which statements trigger autoflush.

Also included is some improvement to the migration_21 document

Fixes: #9809
Change-Id: I0b1974f1981c8a747a0feaaca74ed45106b2b160

2 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

2 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

2 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>
2 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

2 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

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`.

4 weeks agoMerge "support insert of table columns in specific positions" into main
Michael Bayer [Wed, 2 Jul 2025 21:47:59 +0000 (21:47 +0000)] 
Merge "support insert of table columns in specific positions" into main

4 weeks agosupport insert of table columns in specific positions
Mike Bayer [Thu, 19 Jun 2025 16:39:17 +0000 (12:39 -0400)] 
support insert of table columns in specific positions

Added method :meth:`.TableClause.insert_column` to complement
:meth:`.TableClause.append_column`, which inserts the given column at a
specific index.   This can be helpful for prepending primary key columns to
tables, etc.

Fixes: #7910
Change-Id: Ife1eb8ad90aa61d38c457a86312cfe5d0d471106

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)

4 weeks agoMerge "Add new str` subclass for postgresql bitstring" into main
Michael Bayer [Wed, 2 Jul 2025 17:01:47 +0000 (17:01 +0000)] 
Merge "Add new str` subclass for postgresql bitstring" into main

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

4 weeks agoAdd new str` subclass for postgresql bitstring
Federico Caselli [Fri, 20 Jun 2025 20:28:45 +0000 (22:28 +0200)] 
Add new str` subclass for postgresql bitstring

Adds a new ``str`` subclass :class:`dialects.postgresql.BitString`
representing PostgreSQL bitstrings in python, that includes
functionality for converting to and from ``int`` and ``bytes``, in
addition to implementing utility methods and operators for dealing
with bits.

This new class is returned automatically by the :class:`postgresql.BIT`
type.

Fixes: #10556
Closes: #12594
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12594
Pull-request-sha: da47f40739ff9fc6e75da44bd1663aadf80e93ca

Change-Id: I64685660527c23666f7351b2c393fa86dfb643ea

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

4 weeks agoMerge "remove support for list of tuples in the normal execute" into main
Michael Bayer [Fri, 27 Jun 2025 15:36:31 +0000 (15:36 +0000)] 
Merge "remove support for list of tuples in the normal execute" into main

4 weeks agofix typos in comment
Federico Caselli [Thu, 26 Jun 2025 20:05:10 +0000 (22:05 +0200)] 
fix typos in comment

Change-Id: I84edcb6100ee9c072c68970cd476f02d48f7f7ac

4 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

4 weeks agotype aiosqlite
Pablo Estevez [Thu, 26 Jun 2025 19:21:55 +0000 (15:21 -0400)] 
type aiosqlite

Closes: #12656
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12656
Pull-request-sha: 396e9cfaaccbc56537b967e62decbbb3eb0e036a

Change-Id: I598ee6022616f265824291544750e571eaba413c

4 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

4 weeks agoMerge "Simplify postgresql index reflection query" into main
Federico Caselli [Thu, 26 Jun 2025 15:48:23 +0000 (15:48 +0000)] 
Merge "Simplify postgresql index reflection query" into main

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

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

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

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

5 weeks agoMerge "hardening against inappropriate multi-table updates" into main
Michael Bayer [Tue, 24 Jun 2025 18:41:17 +0000 (18:41 +0000)] 
Merge "hardening against inappropriate multi-table updates" into main

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

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

5 weeks agoMerge "Extend #12168 to relationship collections" into main
Michael Bayer [Mon, 23 Jun 2025 19:19:06 +0000 (19:19 +0000)] 
Merge "Extend #12168 to relationship collections" into main

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

5 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

5 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

5 weeks agoExtend #12168 to relationship collections
Mike Bayer [Fri, 20 Jun 2025 13:20:27 +0000 (09:20 -0400)] 
Extend #12168 to relationship collections

As seen in [1] we need to extend the "no default set" case a bit
more to help get dataclasses to act more like traditional mapped
classes.

[1] https://github.com/sqlalchemy/sqlalchemy/issues/9410#issuecomment-2989758246

Fixes: #12168
Change-Id: Icb11faf2203460ab5bca4f2eb5b08b7563cff758

5 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

5 weeks agoMerge "remove util.portable_instancemethod" into main
Michael Bayer [Thu, 19 Jun 2025 14:39:23 +0000 (14:39 +0000)] 
Merge "remove util.portable_instancemethod" into main

5 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

6 weeks agoMerge remote-tracking branch 'origin/pr/12657'
Federico Caselli [Tue, 17 Jun 2025 19:45:05 +0000 (21:45 +0200)] 
Merge remote-tracking branch 'origin/pr/12657'

Change-Id: I601716ff468c801d4c49526440f746e20d2719f4

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

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

7 weeks agoremove util.portable_instancemethod
Mike Bayer [Tue, 10 Jun 2025 18:51:57 +0000 (14:51 -0400)] 
remove util.portable_instancemethod

python seems to be able to pickle instance methods since
version 3.4.    Doing a bisect shows it's
https://github.com/python/cpython/commit/c9dc4a2a8a6dcfe1674685bea4a4af935c0e37ca
where pickle protocol 4 was added, however we can see that protocols 0
through 4 also support pickling of methods.   None of this documented.

Change-Id: I9e73a35e9ab2ffd2050daf819265fc6b4ddb9019

7 weeks agoMerge "use integer division on maxlen" into main
Michael Bayer [Tue, 10 Jun 2025 22:26:43 +0000 (22:26 +0000)] 
Merge "use integer division on maxlen" into main

7 weeks agofix wrong reference link in changelog
Federico Caselli [Tue, 10 Jun 2025 22:11:10 +0000 (00:11 +0200)] 
fix wrong reference link in changelog

Change-Id: I55cf7c6f128cd618cb261b38929bf962586b59e8

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

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

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

7 weeks agoMerge "update tox mypy" into main
Michael Bayer [Tue, 10 Jun 2025 14:37:09 +0000 (14:37 +0000)] 
Merge "update tox mypy" into main

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

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.

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

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

-->

This pull request is:

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

**Have a nice day!**

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

Change-Id: I7eb29a939a701ffd3a89a03d9705ab4954e66ffb

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

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

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

7 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)

7 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

7 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

8 weeks agoMerge "Remove type key in mysql index reflection dicts" into main
Michael Bayer [Wed, 4 Jun 2025 00:06:08 +0000 (00:06 +0000)] 
Merge "Remove type key in mysql index reflection dicts" into main

8 weeks agogive up on running py 3.14 in github actions
Mike Bayer [Tue, 3 Jun 2025 21:55:40 +0000 (17:55 -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

8 weeks agouse exact py3.14 version
Mike Bayer [Tue, 3 Jun 2025 21:15:54 +0000 (17:15 -0400)] 
use exact py3.14 version

gh actions is not complaining that the exact string "3.13", "3.12"
etc are not in versions-manifest.json, but for 3.14 it's complaining.
not happy to hardcode this but just to get it running

Change-Id: Icf12e64b5a76a7068e196454f1fadfecb60bc4d4

8 weeks agoupdates for sphinx build to run correctly
Mike Bayer [Tue, 3 Jun 2025 20:49:45 +0000 (16:49 -0400)] 
updates for sphinx build to run correctly

Change-Id: Ibd3227c57d334200e40f6184a577cf34d1d03cbb

8 weeks agoSimplify postgresql index reflection query
Federico Caselli [Wed, 28 May 2025 20:03:51 +0000 (22:03 +0200)] 
Simplify postgresql index reflection query

Match on python side the values of `pg_am` and `pg_opclass`
to avoid joining them in the main query.
Since both queries have a limited size and are generally
stable their value can be cached using the inspector
cache.

Change-Id: I7074e88dc9ffb8f9c53c3cc12f1a7b72eec7fe8c

8 weeks 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

8 weeks agoMerge "Reflect index's column operator class on PostgreSQL" into main
Michael Bayer [Tue, 3 Jun 2025 18:23:57 +0000 (18:23 +0000)] 
Merge "Reflect index's column operator class on PostgreSQL" into main

8 weeks 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

8 weeks agoMerge "Fix type errors surfaced by mypy 1.16" into main
Michael Bayer [Tue, 3 Jun 2025 14:14:20 +0000 (14:14 +0000)] 
Merge "Fix type errors surfaced by mypy 1.16" into main

8 weeks 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

8 weeks agoMerge "The ``Enum.inherit_schema`` now defaults to true" into main
Michael Bayer [Mon, 2 Jun 2025 17:33:32 +0000 (17:33 +0000)] 
Merge "The ``Enum.inherit_schema`` now defaults to true" into main

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

2 months agoThe ``Enum.inherit_schema`` now defaults to true
Federico Caselli [Sun, 23 Jun 2024 13:01:40 +0000 (15:01 +0200)] 
The ``Enum.inherit_schema`` now defaults to true

Changed the default value of :paramref:`_types.Enum.inherit_schema` to
``True`` when :paramref:`_types.Enum.schema` and
:paramref:`_types.Enum.metadata` parameters are not provided.
The same behavior has been applied also to PostgreSQL
:class:`_postgresql.DOMAIN` type.

Fixes: #10594
Change-Id: Id3d819e3608974353e365cd063d9c5e40a071e73

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

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

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

2 months agoRemove type key in mysql index reflection dicts
Federico Caselli [Fri, 10 Jan 2025 22:26:50 +0000 (23:26 +0100)] 
Remove type key in mysql index reflection dicts

Updated the reflection logic for indexes in the MariaDB and MySQL
dialect to avoid setting the undocumented ``type`` key in the
:class:`_engine.ReflectedIndex` dicts returned by
:class:`_engine.Inspector.get_indexes` method.

Fixes: #12240
Change-Id: Id188d8add441fe2070f36950569401c63ee35ffa

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

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)

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)

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

2 months agoMerge "Use pg_index's indnatts when indnkeyatts is not available" into main
Michael Bayer [Tue, 20 May 2025 21:32:04 +0000 (21:32 +0000)] 
Merge "Use pg_index's indnatts when indnkeyatts is not available" into main