]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
19 months agoensure correct lock type propagated in pool recreate
Mike Bayer [Mon, 1 Jan 2024 21:54:58 +0000 (16:54 -0500)] 
ensure correct lock type propagated in pool recreate

Fixed critical issue in asyncio version of the connection pool where
calling :meth:`_asyncio.AsyncEngine.dispose` would produce a new connection
pool that did not fully re-establish the use of asyncio-compatible mutexes,
leading to the use of a plain ``threading.Lock()`` which would then cause
deadlocks in an asyncio context when using concurrency features like
``asyncio.gather()``.

Fixes: #10813
Change-Id: I95ec698b6a1ba79555aa0b28e6bce65fedf3b1fe
(cherry picked from commit 2ed32bbf891b8f7e6c151071b4711319d9aa84f0)

19 months agoadd a generic argument to _HasClauseElement
Mike Bayer [Mon, 1 Jan 2024 17:49:10 +0000 (12:49 -0500)] 
add a generic argument to _HasClauseElement

Further enhancements to pep-484 typing to allow SQL functions from
:attr:`_sql.func` derived elements to work more effectively with ORM-mapped
attributes.

Fixes: #10801
Change-Id: Ib8222d888a2d8c3fbeab0d1bf5edb535916d4721
(cherry picked from commit 74a31c56ed931921f89026faf50768c86801376f)

19 months agoMerge "pop prefetch values from committed_state when they are available" into rel_2_0
Michael Bayer [Sat, 30 Dec 2023 17:08:03 +0000 (17:08 +0000)] 
Merge "pop prefetch values from committed_state when they are available" into rel_2_0

19 months agofix typo in session.reset docs
Federico Caselli [Fri, 29 Dec 2023 23:14:39 +0000 (00:14 +0100)] 
fix typo in session.reset docs

Change-Id: I6073cc623f216ffad8c18396001191b38eccc129
(cherry picked from commit 02472e8b65ac4062f2c3e7cee19608c801fba14c)

19 months agodocument alternative relationship to AC patterns
Mike Bayer [Fri, 29 Dec 2023 16:45:55 +0000 (11:45 -0500)] 
document alternative relationship to AC patterns

using event hook to defer construction

this is for 2.0 and above only as it includes a typed mapping
recipe as well.

Fixes: #4660
Change-Id: I9478c7f451c0e58096cca60c0725396fed339abf
(cherry picked from commit b44018d46b0b306bae04e0b0ea2e11ca78ef64e9)

19 months agoRemove unused method in SimpleResultMetaData
Federico Caselli [Thu, 28 Dec 2023 22:50:20 +0000 (23:50 +0100)] 
Remove unused method in SimpleResultMetaData

Change-Id: I859c52613da84519bacbf55a105e3a16bb8e9728
(cherry picked from commit 0da6e5dd22c33d57fc206825f58dccc3d7c3b61c)

19 months agopop prefetch values from committed_state when they are available
Mike Bayer [Thu, 28 Dec 2023 21:02:48 +0000 (16:02 -0500)] 
pop prefetch values from committed_state when they are available

Fixed issue where when making use of the
:paramref:`_orm.relationship.post_update` feature at the same time as using
a mapper version_id_col could lead to a situation where the second UPDATE
statement emitted by the post-update feature would fail to make use of the
correct version identifier, assuming an UPDATE was already emitted in that
flush which had already bumped the version counter.

Fixes: #10800
Change-Id: I3fccdb26ebbd2d987bb4f0e894449b7413556054
(cherry picked from commit 46ec57e5cc5c66616087453a090754f4d0853c0c)

19 months agoVersion 2.0.25 placeholder
Mike Bayer [Thu, 28 Dec 2023 16:23:13 +0000 (11:23 -0500)] 
Version 2.0.25 placeholder

19 months ago- 2.0.24 rel_2_0_24
Mike Bayer [Thu, 28 Dec 2023 16:19:39 +0000 (11:19 -0500)] 
- 2.0.24

19 months agochangelog formatting fixes
Mike Bayer [Thu, 28 Dec 2023 16:17:52 +0000 (11:17 -0500)] 
changelog formatting fixes

Change-Id: Ie6a975b9750fbf99c553f9b4f48a0305cf912443

19 months agochangelog edits
Mike Bayer [Thu, 28 Dec 2023 16:10:26 +0000 (11:10 -0500)] 
changelog edits

Change-Id: I115807ccca74e55e96389d7bb723da3893bcc965
(cherry picked from commit 1a2748152b0f2feb527c6a04054f88d4a659a818)

19 months agoMerge "Deprecate async_fallback mode" into rel_2_0
Michael Bayer [Wed, 27 Dec 2023 21:35:08 +0000 (21:35 +0000)] 
Merge "Deprecate async_fallback mode" into rel_2_0

19 months agoDeprecate async_fallback mode
Federico Caselli [Tue, 5 Dec 2023 22:18:57 +0000 (23:18 +0100)] 
Deprecate async_fallback mode

Deprecate the async_fallback mode and await_fallback function.

Additionally, this commit modifies the use of athrow
to no longer use the "util" compat function which is removed;
this has since been determined that it's not needed.

Change-Id: I37e37400b6954f5ac7c957790932838862930453

19 months agoUse a copy of `self.contents` in this list comprehension.
Yilei Yang [Thu, 21 Dec 2023 07:47:03 +0000 (02:47 -0500)] 
Use a copy of `self.contents` in this list comprehension.

Improved a fix first implemented for :ticket:`3208` released in version
0.9.8, where the registry of classes used internally by declarative could
be subject to a race condition in the case where individual mapped classes
are being garbage collected at the same time while new mapped classes are
being constructed, as can happen in some test suite configurations or
dynamic class creation environments.   In addition to the weakref check
already added, the list of items being iterated is also copied first to
avoid "list changed while iterating" errors.  Pull request courtesy Yilei
Yang.

Fixes: #10782
Closes: #10783
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10783
Pull-request-sha: 354e97b640430120d0c193a4efe487f293d4768b

Change-Id: I04ccc92472bf1004dad0fb785e16b180f58f101d
(cherry picked from commit 0fe5d3ca51884b85b4059ed05b53f02172325e70)

19 months agouse a standard function to check for iterable collections
Mike Bayer [Wed, 20 Dec 2023 15:56:18 +0000 (10:56 -0500)] 
use a standard function to check for iterable collections

Fixed 2.0 regression in :class:`.MutableList` where a routine that detects
sequences would not correctly filter out string or bytes instances, making
it impossible to assign a string value to a specific index (while
non-sequence values would work fine).

Fixes: #10784
Change-Id: I829cd2a1ef555184de8e6a752f39df65f69f6943
(cherry picked from commit 99da5ebab36da61b7bfa0b868f50974d6a4c4655)

19 months agoensure Bundle / DML RETURNING has test support, full impl
Mike Bayer [Tue, 19 Dec 2023 14:00:03 +0000 (09:00 -0500)] 
ensure Bundle / DML RETURNING has test support, full impl

Ensured the use case of :class:`.Bundle` objects used in the
``returning()`` portion of ORM-enabled INSERT, UPDATE and DELETE statements
is tested and works fully.   This was never explicitly implemented or
tested previously and did not work correctly in the 1.4 series; in the 2.0
series, ORM UPDATE/DELETE with WHERE criteria was missing an implementation
method preventing :class:`.Bundle` objects from working.

Fixes: #10776
Change-Id: I32298e65ac590a12b47dd6ba00b7d56038b8a450
(cherry picked from commit 6e089c3dbf7e7348da84dfc62cc1c6100a257fd4)

19 months agoFix engine connect example in migration guide (#10757)
Iuri de Silvio [Sun, 17 Dec 2023 17:39:28 +0000 (18:39 +0100)] 
Fix engine connect example in migration guide (#10757)

You can't fetchall after connection was closed.

(cherry picked from commit ca9adf3028095ff28bdef823d6f6cefc12815b3c)

19 months agoMerge "Replace custom URL-encoding method with quote" into rel_2_0
Michael Bayer [Wed, 13 Dec 2023 16:01:27 +0000 (16:01 +0000)] 
Merge "Replace custom URL-encoding method with quote" into rel_2_0

19 months agocopy stack related elements to str compiler
Mike Bayer [Tue, 12 Dec 2023 19:57:38 +0000 (14:57 -0500)] 
copy stack related elements to str compiler

Fixed issue in stringify for SQL elements, where a specific dialect is not
passed,  where a dialect-specific element such as the PostgreSQL "on
conflict do update" construct is encountered and then fails to provide for
a stringify dialect with the appropriate state to render the construct,
leading to internal errors.

Fixed issue where stringifying or compiling a :class:`.CTE` that was
against a DML construct such as an :func:`_sql.insert` construct would fail
to stringify, due to a mis-detection that the statement overall is an
INSERT, leading to internal errors.

Fixes: #10753
Change-Id: I783eca3fc7bbc1794fedd325d58181dbcc7e0b75
(cherry picked from commit 0248efb761bec4bdcea76bc6bbe3c09934f6b527)

19 months agorestore ValueError when greenlet not installed
Mike Bayer [Mon, 11 Dec 2023 15:55:25 +0000 (10:55 -0500)] 
restore ValueError when greenlet not installed

continuing for #10747, add a test asserting we dont get an
endless loop and get a clean ValueError instead when greenlet not
installed and async functions are used.

Fixes: #10747
Change-Id: I54dffe8577025e2ef3a59f5ca9ab7f4362d4d91f
(cherry picked from commit 35a0854cae1e23271963e7781c65495e9c84f872)

19 months agoensure test suite runs w/o greenlet
Mike Bayer [Sat, 9 Dec 2023 15:43:37 +0000 (10:43 -0500)] 
ensure test suite runs w/o greenlet

This is a reopen of #6136 essentially that repaired the
test suite to run without greenlet but now this has regressed.
add a tox target that explicitly uninstalls greenlet, will
add to CI.

This also changes 2.0 in that the full tox target will
omit dbdrivers that require greenlet.

Fixes: #10747
Change-Id: Ia7d786d781e591539a388bfbe17b00a59f0e86d9
(cherry picked from commit 0bd686df43f572cec658c586082f299ab2cd756f)

19 months agofix(attribute_keyed_dict): using Any instead of TypeVar (#10746)
Mehdi GMIRA [Fri, 8 Dec 2023 10:54:11 +0000 (11:54 +0100)] 
fix(attribute_keyed_dict): using Any instead of TypeVar (#10746)

Co-authored-by: Mehdi Gmira <mgmira@wiremind.io>
(cherry picked from commit 86f335c29e9f4d9a8e2b28dd75301f28f5f9f4f1)

19 months agoBump actions/setup-python from 4 to 5 (#10737)
dependabot[bot] [Fri, 8 Dec 2023 09:52:38 +0000 (10:52 +0100)] 
Bump actions/setup-python from 4 to 5 (#10737)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

19 months agoMerge "Forward `**kw` in `__init_subclass__()` to super" into rel_2_0
Michael Bayer [Thu, 7 Dec 2023 14:37:34 +0000 (14:37 +0000)] 
Merge "Forward `**kw` in `__init_subclass__()` to super" into rel_2_0

19 months agoUpdate `TZDateTime` type decorator example to align with python docs
Kevin Kirsche [Mon, 4 Dec 2023 18:25:24 +0000 (13:25 -0500)] 
Update `TZDateTime` type decorator example to align with python docs

This change updates the `TZDateTime` type decorator to use the timezone awareness checks described in the Python documentation located here:

https://docs.python.org/3/library/datetime.html#determining-if-an-object-is-aware-or-naive

The specific lines state:

> A [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime) object `d` is aware if both of the following hold:
>
> `d.tzinfo is not None`
>
> `d.tzinfo.utcoffset(d)` does not return `None`
>
> Otherwise, `d` is naive.

Closes: #10719
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10719
Pull-request-sha: bb30cb3cfe57f326addec21a6cae5f81184c2e74

Change-Id: I1ac51c1ec2820c3f224a79b7af5057fe2b3a55e2
(cherry picked from commit e1477c152c5a1e097399300883fcd6b23a6dfabf)

19 months agoReplace custom URL-encoding method with quote
Mike Bayer [Wed, 6 Dec 2023 19:10:28 +0000 (14:10 -0500)] 
Replace custom URL-encoding method with quote

Fixed URL-encoding of the username and password components of
:class:`.engine.URL` objects when converting them to string using the
:meth:`_engine.URL.render_as_string` method, by using Python standard
library ``urllib.parse.quote`` while allowing for plus signs and spaces to
remain unchanged as supported by SQLAlchemy's non-standard URL parsing,
rather than the legacy home-grown routine from many years ago. Pull request
courtesy of Xavier NUNN.

Fixes: #10662
Closes: #10726
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10726
Pull-request-sha: 82219041b8f73d8c932cc40e87c002b3b853e02e
Change-Id: Iedca4929579d4d26ef8cce083252dcd1e476286b
(cherry picked from commit 4438883c9703affa3f441be9a230a5f751905a05)

19 months agoForward `**kw` in `__init_subclass__()` to super
Michael Oliver [Tue, 5 Dec 2023 22:24:17 +0000 (17:24 -0500)] 
Forward `**kw` in `__init_subclass__()` to super

Modified the ``__init_subclass__()`` method used by
:class:`_orm.MappedAsDataclass`, :class:`_orm.DeclarativeBase`` and
:class:`_orm.DeclarativeBaseNoMeta` to accept arbitrary ``**kw`` and to
propagate them to the ``super()`` call, allowing greater flexibility in
arranging custom superclasses and mixins which make use of
``__init_subclass__()`` keyword arguments.  Pull request courtesy Michael
Oliver.

Fixes: #10732
Closes: #10733
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10733
Pull-request-sha: 7fdeec1f3224f48213c9c9af5f3e7e5d0904dafa

Change-Id: I955a735d4e23502b5a6b22ac093e391b378edc87
(cherry picked from commit ceeaaecd2401d2407b60c22708f58a8ae0898d85)

19 months agoMerge "try to gracefully close even in terminate" into rel_2_0
Michael Bayer [Wed, 6 Dec 2023 15:55:07 +0000 (15:55 +0000)] 
Merge "try to gracefully close even in terminate" into rel_2_0

19 months agoImprove session after_begin even documentation
Federico Caselli [Thu, 30 Nov 2023 21:40:43 +0000 (22:40 +0100)] 
Improve session after_begin even documentation

Change-Id: Ie2a1e6bdf5960208921dc76e372fe51d3b280f1a
References: #10687
(cherry picked from commit 842b3ebb4b9e40ce3f6aa4257bd5e585c42e51d2)

20 months agoDocument limitation in dataclass mapping styles
Federico Caselli [Mon, 4 Dec 2023 20:14:45 +0000 (21:14 +0100)] 
Document limitation in dataclass mapping styles

Document that using default and init=False on a dataclass field mapped
imperatively or using imperative table will not work.

Change-Id: Id2e27e4f7f0cafc60be3f97b7945983360c0a7d2
References: #9879
(cherry picked from commit 06c5c8e955402af6c09b8a3c55cbdee3cd0e0393)

20 months agoSpelling dml.rst (#10730)
Kai [Mon, 4 Dec 2023 18:23:43 +0000 (19:23 +0100)] 
Spelling dml.rst (#10730)

Really a very minor spelling correction.

(cherry picked from commit f43b428d2baf6f6fc01c8e3028743cd96c05986e)

20 months agoNeed to escape # in tox v4
Federico Caselli [Mon, 27 Nov 2023 20:39:31 +0000 (21:39 +0100)] 
Need to escape # in tox v4

See https://tox.wiki/en/latest/upgrading.html#changed-ini-rules

Change-Id: I3022538e3f919f5bc977411042d82c62260645a1
(cherry picked from commit aa7145caa1927d8c70f6c5029c3c04528b86c7b0)

20 months agoNormalize all file headers to have consistent format
Federico Caselli [Thu, 30 Nov 2023 21:16:11 +0000 (22:16 +0100)] 
Normalize all file headers to have consistent format

Change-Id: Idfa5f699280990aed3f6e46225d4202539d9e900

20 months agotry to gracefully close even in terminate
Mike Bayer [Thu, 30 Nov 2023 14:11:25 +0000 (09:11 -0500)] 
try to gracefully close even in terminate

Adjusted the asyncpg dialect such that when the ``terminate()`` method is
used to discard an invalidated connection, the dialect will first attempt
to gracefully close the conneciton using ``.close()`` with a timeout, if
the operation is proceeding within an async event loop context only. This
allows the asyncpg driver to attend to finalizing a ``TimeoutError``
including being able to close a long-running query server side, which
otherwise can keep running after the program has exited.

Fixes: #10717
Change-Id: Iaba0aeb67873a7a2b3981d43f4eb663005057309
(cherry picked from commit e70a0b0a0e52945e5b588b5cffec619a3f3e78a1)

20 months agofreshen up callcounts for py311
Mike Bayer [Tue, 28 Nov 2023 02:35:41 +0000 (21:35 -0500)] 
freshen up callcounts for py311

move the oracle tests to use oracledb (because i dont feel like
installing OCI on my laptops anymore)

Change-Id: I8ca7ceb5083dbf2510ec02dc40f202a8e0eaf3dc
(cherry picked from commit 82690b1cfc1e76e5deb622a9afefbcf3be299962)

20 months agoremove errant print statement
Mike Bayer [Sun, 26 Nov 2023 20:16:08 +0000 (15:16 -0500)] 
remove errant print statement

Change-Id: I9cb1571995f078c359a9c2793670a017effe4be2

20 months agoadd MARS connection for aioodbc
Mike Bayer [Sun, 26 Nov 2023 15:02:47 +0000 (10:02 -0500)] 
add MARS connection for aioodbc

on jenkins main we are getting a lot of connection busy with
other results, which we assume is due to the thread-pool based approach
of aioodbc not being very solid.

MARS is described at:

https://stackoverflow.com/questions/9017264/why-only-some-users-get-the-error-connection-is-busy-with-results-for-another
https://learn.microsoft.com/en-us/sql/relational-databases/native-client/features/using-multiple-active-result-sets-mars?view=sql-server-ver16

not clear why the name of the parameter is different in those two
articles. using a totally made up parameter doesn't raise any error,
so it's not clear if this works at all.

Change-Id: I8e437e9f46c1c070c5102a24d7d82a912e8b5145

20 months agoAdd type annotations for Function.filter
Martijn Pieters [Sat, 18 Nov 2023 21:36:08 +0000 (16:36 -0500)] 
Add type annotations for Function.filter

This includes all methods / properties on the returned FunctionFilter
object.

This contributes towards #6810

This pull request is:

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

Closes: #10643
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10643
Pull-request-sha: 6137b7b995b6ea0bd4e4195c5693d2312fa26639

Change-Id: I2af1af7617d0cd3fd30b262d36ff982464bac011
(cherry picked from commit 52452ec39d18567126673eeef4cf0dd12039043b)

20 months agofully type functions.py
Mike Bayer [Fri, 24 Nov 2023 20:20:31 +0000 (15:20 -0500)] 
fully type functions.py

Completed pep-484 typing for the ``sqlalchemy.sql.functions`` module.
:func:`_sql.select` constructs made against ``func`` elements should now
have filled-in return types.

References: #6810
Change-Id: I5121583c9c5b6f7151f811348c7a281c446cf0b8
(cherry picked from commit 045732a738a10891b85be8e286eab3e5b756a445)

20 months agofully update to flake8 6.1.0
Mike Bayer [Fri, 24 Nov 2023 21:27:03 +0000 (16:27 -0500)] 
fully update to flake8 6.1.0

I updated flake8 in pre-commit a few days ago but forgot to do it in
tox.

this flake seems to be picking inside of f-strings, which black does
not fix, so fix these manually.

Change-Id: I9a641a99e280fbba9d893a6f1f051b5039d5d4eb
(cherry picked from commit 7bc33ca55144d2716b175c733c0d6865572787aa)

20 months agoMerge "backport importlib mypy fix" into rel_2_0
mike bayer [Fri, 24 Nov 2023 20:24:52 +0000 (20:24 +0000)] 
Merge "backport importlib mypy fix" into rel_2_0

20 months agoMerge "Fix pre-ping regression in old PyMySQL versions." into rel_2_0
mike bayer [Fri, 24 Nov 2023 15:43:35 +0000 (15:43 +0000)] 
Merge "Fix pre-ping regression in old PyMySQL versions." into rel_2_0

20 months agobackport importlib mypy fix
Mike Bayer [Fri, 24 Nov 2023 13:55:44 +0000 (08:55 -0500)] 
backport importlib mypy fix

this is the fix that was part of f5f08c28fb, this is otherwise
failing for some environments with mypy 6

Change-Id: Ic8b410c4fa1858c98e9299e062f1ff040c2d3576

20 months agoUpgrade to Oracle Database 23c Free
Gerald Venzl [Thu, 23 Nov 2023 19:42:52 +0000 (14:42 -0500)] 
Upgrade to Oracle Database 23c Free

### Description
This PR updates the unittest ReadMe and `setup.cfg` to use Oracle Database Free, the successor to Oracle Database XE.

### Checklist

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

Change-Id: Id37f6607572c1fdb12d507cd9336800d4d8b0cf3
(cherry picked from commit 44771ab0c32730d1ecefac21af13f113b1b19726)

20 months agodocs: fix type annotation in Self-Referential Many-to-Many Relationsh…
François Voron [Thu, 23 Nov 2023 15:53:07 +0000 (10:53 -0500)] 
docs: fix type annotation in Self-Referential Many-to-Many Relationsh…

A type annotation was wrong in the [Self-Referential Many-to-Many Relationship](https://docs.sqlalchemy.org/en/20/orm/join_conditions.html#self-referential-many-to-many-relationship) code example.

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

### Description

The type annotation was `right_nodes: Mapped[List["None"]]`. I changed it to `Node` since we refer to the ORM class we're looking at.

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #10686
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10686
Pull-request-sha: 7671898116f1b8850e5d8f3ff0f940450a7c1bf4

Change-Id: Iab1535c3d00747eb8c9e9a17aea50606febedbf9
(cherry picked from commit 7157d16e3ba521c119958a727af51790ebdf3f34)

20 months agoFix pre-ping regression in old PyMySQL versions.
Federico Caselli [Wed, 22 Nov 2023 21:04:03 +0000 (22:04 +0100)] 
Fix pre-ping regression in old PyMySQL versions.

Fixed regression introduced by the fix in ticket :ticket:`10492` when using
pool pre-ping with PyMySQL version older than 1.0.

Fixes: #10650
Change-Id: Ic0744c8b6f91cc39868e31c3bfddb8df20c7dfbb

20 months agoadd local column to dependency rule error message
Jan Vollmer [Wed, 22 Nov 2023 18:16:27 +0000 (13:16 -0500)] 
add local column to dependency rule error message

Improved the error message produced when the unit of work process sets the
value of a primary key column to NULL due to a related object with a
dependency rule on that column being deleted, to include not just the
destination object and column name but also the source column from which
the NULL value is originating.  Pull request courtesy Jan Vollmer.

Fixes: #10668
Closes: #10669
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10669
Pull-request-sha: d7f9952b81394d585e55dad6d6f355aaa54f599e

Change-Id: I210317f8777ff07d9eec674b79f2140523af38d0
(cherry picked from commit 87929a9c55163ebcd7edd031d222c7f115922842)

20 months agore-add cascade caveats
Mike Bayer [Wed, 22 Nov 2023 15:58:00 +0000 (10:58 -0500)] 
re-add cascade caveats

these got removed and never restored in 2.0

References: https://github.com/sqlalchemy/sqlalchemy/discussions/10672
Change-Id: Ibbd9a8ab04556ebd581f9287b54fe1ffdaacee79
(cherry picked from commit 4279e715e0b4af819a0434daa5bf9e0c18789bec)

20 months agoupdate all errors / warnings in schema to use f strings
Mike Bayer [Sat, 18 Nov 2023 15:22:19 +0000 (10:22 -0500)] 
update all errors / warnings in schema to use f strings

Fixed issue where error reporting for unexpected schema item when creating
objects like :class:`_schema.Table` would incorrectly handle an argument
that was itself passed as a tuple, leading to a formatting error.  The
error message has been modernized to use f-strings.

this change necessitated an update to flake8 as version 5 was
mis-interpreting f-strings that had semicolons in them.
Black is also unable to format some of these f-strings which had
to be broken out, unclear if there is a newer Black available.

Fixes: #10654
Change-Id: I703e94282c27ccf06f4aa315e8a11bd97b719170
(cherry picked from commit 2458ceee94e7bd6e5bf8d9d7270be8819bbe772c)

20 months agoUpdate type annotation for DBAPI Cursor's executemany()
William Henry Hakim [Thu, 16 Nov 2023 14:11:26 +0000 (09:11 -0500)] 
Update type annotation for DBAPI Cursor's executemany()

### Description
As per https://groups.google.com/g/sqlalchemy/c/DkyffAgDmwM, fixes an issue with the DBAPI cursor's executemany() type signature.

### Checklist

This pull request is:

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

**Have a nice day!**

Closes: #10644
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10644
Pull-request-sha: 0a1fe849b54e35cd5e417da79556dc94be3a0abc

Change-Id: I3af344f052a2f306876a528c528b1bf9cc0bdaa6
(cherry picked from commit 55bf2bf971cda82c2e3f58e9c211c74c3a6394a8)

20 months agoclarify connection pool release for session.commit/ rollback
Mike Bayer [Wed, 15 Nov 2023 18:50:19 +0000 (13:50 -0500)] 
clarify connection pool release for session.commit/ rollback

Change-Id: I71adf3ed9eb9f7c0abb50ecc9efe7c2df3c98705
(cherry picked from commit 3b4a97972131bbcbe53120400270faa4fce87594)

20 months agoMerge "always derive type from element in annotated case" into rel_2_0
mike bayer [Mon, 13 Nov 2023 13:27:30 +0000 (13:27 +0000)] 
Merge "always derive type from element in annotated case" into rel_2_0

20 months agoFix a typo (#10620)
Aleksandr Kiliushin [Sun, 12 Nov 2023 09:32:05 +0000 (13:32 +0400)] 
Fix a typo (#10620)

(cherry picked from commit fc6c2b19fd7f5cb89e0c405f5aa3b3360e4c4a93)

20 months agoTyping updates to fix errors found by mypy 1.7
Federico Caselli [Sat, 11 Nov 2023 15:26:57 +0000 (16:26 +0100)] 
Typing updates to fix errors found by mypy 1.7

Change-Id: I02046a72df88a82c8bc6e40b41f9d5b0d01a163e
(cherry picked from commit e45b9ffd421cd2a36208a763e20ff6c4e86aad90)

20 months agoVarious minor fixes
Federico Caselli [Sat, 4 Nov 2023 20:32:16 +0000 (21:32 +0100)] 
Various minor fixes

Fix typo in exported class in init. #10578
Improve warning for loaderes. #10579
Properly document ARRAY.contains. #10587
Mention how to set a schema to the automatically generated enums. #10583
Improve type of cache key dispatcher

Change-Id: I86e4f01f5d897b257246fe5f970b78e3444aca3e
(cherry picked from commit 1bb9c4b94483a25057bad3d78cf9956e8f292330)

20 months agoFix lint error
Federico Caselli [Wed, 8 Nov 2023 20:49:06 +0000 (21:49 +0100)] 
Fix lint error

Change-Id: Ifb53e125fc9fd759938908710b2474656dbf1ef9

20 months agoAdd trove classifier for 3.12 (#10599)
Jack McIvor [Tue, 7 Nov 2023 17:55:18 +0000 (17:55 +0000)] 
Add trove classifier for 3.12 (#10599)

(cherry picked from commit 8a583ad7bf65d5d9bf05568279723bc516de3ae3)

20 months agoFix syntax typo in doc/build/tutorial/data_select.rst (#10590)
Sebastián Ramírez [Mon, 6 Nov 2023 20:01:51 +0000 (00:01 +0400)] 
Fix syntax typo in doc/build/tutorial/data_select.rst (#10590)

(cherry picked from commit e00215cfcdab5186ab07889dda4a2280b5ad5d44)

20 months agoremove . in sys.path
Mike Bayer [Wed, 8 Nov 2023 20:20:24 +0000 (15:20 -0500)] 
remove . in sys.path

this should not be needed and is causing problems in python
3.12 due to the presence of the "changelog" directory

(cherry picked from commit 8faa17d4316772340295a677c54eccf647a221c9)

20 months agoalways derive type from element in annotated case
Mike Bayer [Mon, 6 Nov 2023 22:46:14 +0000 (17:46 -0500)] 
always derive type from element in annotated case

Fixed issue where use of :func:`_orm.foreign` annotation on a
non-initialized :func:`_orm.mapped_column` construct would produce an
expression without a type, which was then not updated at initialization
time of the actual column, leading to issues such as relationships not
determining ``use_get`` appropriately.

Fixes: #10597
Change-Id: I8339ba715ec6bd1f50888f8a424c3ac156e2364f
(cherry picked from commit 432eb350a4b81ba557f14d49ebd37cf5899d5423)

20 months agomove to rel_2_0
Mike Bayer [Mon, 6 Nov 2023 15:12:42 +0000 (10:12 -0500)] 
move to rel_2_0

Change-Id: Ic52aea08e17e67ab19afce6ccb8fe74ca59ecd4c

21 months agoFix link to change_4639in `doc/build/changelog/migration_20.rst` (#10585)
Sebastián Ramírez [Sat, 4 Nov 2023 20:22:29 +0000 (00:22 +0400)] 
Fix link to change_4639in `doc/build/changelog/migration_20.rst` (#10585)

21 months agoFix link to `/orm/queryguide/index` in `doc/build/changelog/migration_20.rst` (#10584)
Sebastián Ramírez [Sat, 4 Nov 2023 20:21:39 +0000 (00:21 +0400)] 
Fix link to `/orm/queryguide/index` in `doc/build/changelog/migration_20.rst` (#10584)

21 months agorepair new ORM test for Oracle, SQL Server
Mike Bayer [Sat, 4 Nov 2023 08:04:54 +0000 (04:04 -0400)] 
repair new ORM test for Oracle, SQL Server

Change-Id: Icbe5cf0a9a6cfdae9f6d0863af5734d6f43c517a

21 months agoVersion 2.0.24 placeholder
Mike Bayer [Thu, 2 Nov 2023 14:52:23 +0000 (10:52 -0400)] 
Version 2.0.24 placeholder

21 months ago- 2.0.23 rel_2_0_23
Mike Bayer [Thu, 2 Nov 2023 14:31:56 +0000 (10:31 -0400)] 
- 2.0.23

21 months agoimplement render_nulls for new style bulk ORM INSERT
Mike Bayer [Wed, 1 Nov 2023 22:06:49 +0000 (18:06 -0400)] 
implement render_nulls for new style bulk ORM INSERT

Implemented the :paramref:`_orm.Session.bulk_insert_mappings.render_nulls`
parameter for new style bulk ORM inserts, allowing ``render_nulls=True`` as
an execution option.   This allows for bulk ORM inserts with a mixture of
``None`` values in the parameter dictionaries to use a single batch of rows
for a given set of dicationary keys, rather than breaking up into batches
that omit the NULL columns from each INSERT.

Fixes: #10575
Change-Id: I47382bb586626e98d3964dfa8f55acb2c9c6d8d4

21 months agouse _extra_criteria to store with_expression() expression
Mike Bayer [Tue, 31 Oct 2023 18:56:37 +0000 (14:56 -0400)] 
use _extra_criteria to store with_expression() expression

this is an alternate version of the first patch, which adds extra
handling for the "expression" in local_opts.  this patch has
with_expression() use _extra_criteria directly, as this attribute
is currently unpurposed for column-based attributes.

Fixed caching bug where using the :func:`_orm.with_expression` construct in
conjunction with loader options :func:`_orm.selectinload`,
:func:`_orm.lazyload` would fail to substitute bound parameter values
correctly on subsequent caching runs.

Fixes: #10570
Change-Id: If6c74755580fe5b108056eebcb461d984410ff46

21 months agoadd note that secondary string is Python eval re: identifier names
Mike Bayer [Tue, 31 Oct 2023 02:14:21 +0000 (22:14 -0400)] 
add note that secondary string is Python eval re: identifier names

im not exactly sure why "secondary" string is a Python eval
as I dont know what kind of Python eval someone might put there.
Add explicit note about this referring to table names that have
non-Python identifier characters.

Fixes: #10563
Change-Id: I06fc933541ca1751201ee8a29444f81868f0c1cb

21 months agocherry-pick changelog update for 1.4.51
Mike Bayer [Sun, 29 Oct 2023 20:32:31 +0000 (16:32 -0400)] 
cherry-pick changelog update for 1.4.51

21 months agocherry-pick changelog from 1.4.50
Mike Bayer [Sun, 29 Oct 2023 20:32:30 +0000 (16:32 -0400)] 
cherry-pick changelog from 1.4.50

21 months agochangelog updates
Mike Bayer [Sun, 29 Oct 2023 20:15:52 +0000 (16:15 -0400)] 
changelog updates

Change-Id: I6b362500f1fab118920d61f8b6247521756922ff

21 months agoAdd bind casts for BIT on asyncpg
Sören Oldag [Thu, 26 Oct 2023 13:17:41 +0000 (09:17 -0400)] 
Add bind casts for BIT on asyncpg

Fixed SQL handling for "insertmanyvalues" when using the
:class:`.postgresql.BIT` datatype with the asyncpg backend.  The
:class:`.postgresql.BIT` on asyncpg apparently requires the use of an
asyncpg-specific `BitString` type which is currently exposed when using
this DBAPI, making it incompatible with other PostgreSQL DBAPIs that all
work with plain bitstrings here.  A future fix in version 2.1 will
normalize this datatype across all PG backends.   Pull request courtesy
Sören Oldag.

Fixes: #10532
Closes: #10533
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10533
Pull-request-sha: 528607d5b5b67c1b9c2edb39176b7e005db371f6

Change-Id: I879f2fc24b5650467b85f170c0def15834f75456

21 months agoadd precision interval test
Mike Bayer [Wed, 25 Oct 2023 13:53:21 +0000 (09:53 -0400)] 
add precision interval test

Change-Id: I11a50f245a66fa9df62c736ce24dd57501d58dbe
References: https://github.com/sqlalchemy/sqlalchemy/pull/10383#discussion_r1371771358

21 months agoremove type check decorators
Mike Bayer [Tue, 24 Oct 2023 20:05:48 +0000 (16:05 -0400)] 
remove type check decorators

in 598ae1d120a35ee9e19cf7f953c7dd51047954d6, we erroneously
merged "no_type_check" decorators.  we only merge typing that works
or requires "type: ignore", so remove these

Fixes: #9737
Change-Id: I0fdd2022df9b7b59482581957b77057094475647

21 months agoMerge "use oracle.INTERVAL for generic interval" into main
mike bayer [Tue, 24 Oct 2023 18:38:56 +0000 (18:38 +0000)] 
Merge "use oracle.INTERVAL for generic interval" into main

21 months agoMerge "add literal_processors for interval, PG and Oracle" into main
mike bayer [Tue, 24 Oct 2023 18:38:34 +0000 (18:38 +0000)] 
Merge "add literal_processors for interval, PG and Oracle" into main

21 months agoMerge "accommodate NULL at the compiler level for literal_render" into main
mike bayer [Tue, 24 Oct 2023 18:37:39 +0000 (18:37 +0000)] 
Merge "accommodate NULL at the compiler level for literal_render" into main

21 months agoMerge "Document workaround for aiosqlite savepoints" into main
mike bayer [Tue, 24 Oct 2023 16:12:04 +0000 (16:12 +0000)] 
Merge "Document workaround for aiosqlite savepoints" into main

21 months agoadd literal_processors for interval, PG and Oracle
indivar [Thu, 28 Sep 2023 17:43:57 +0000 (13:43 -0400)] 
add literal_processors for interval, PG and Oracle

Implemented "literal value processing" for the :class:`.Interval` datatype
for both the PostgreSQL and Oracle dialects, allowing literal rendering of
interval values.  Pull request courtesy Indivar Mishra.

Fixes: #9737
Closes: #10383
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10383
Pull-request-sha: bf3a73dfd9d329779e12037ae62dc1032e76d0f6

Change-Id: Ic1a1c505f23eeb681059303799d5fc8821aadacf

21 months agoaccommodate NULL at the compiler level for literal_render
Mike Bayer [Tue, 24 Oct 2023 16:06:24 +0000 (12:06 -0400)] 
accommodate NULL at the compiler level for literal_render

Added compiler-level None/NULL handling for the "literal processors" of all
datatypes that include literal processing, that is, where a value is
rendered inline within a SQL statement rather than as a bound parameter,
for all those types that do not feature explicit "null value" handling.
Previously this behavior was undefined and inconsistent.

Fixes: #10535
Change-Id: I746d19d6cec2aefa3244f5e5a6970950a698d96c

21 months agoMerge "move BYTEA test to PG suite" into main
mike bayer [Tue, 24 Oct 2023 15:25:46 +0000 (15:25 +0000)] 
Merge "move BYTEA test to PG suite" into main

21 months agoDocument workaround for aiosqlite savepoints
Vlastimil Zíma [Fri, 20 Oct 2023 17:58:21 +0000 (13:58 -0400)] 
Document workaround for aiosqlite savepoints

### Description
Update docs with workaround for SAVEPOINT in aiosqlite, based on https://github.com/sqlalchemy/sqlalchemy/discussions/10463

### Checklist
This pull request is:

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

Closes: #10491
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10491
Pull-request-sha: 0516c205d2c4c046d449b5684c13a06f813dabe1

Change-Id: I6bb92f18c99f2a53f5488a2d5812781cb2a003b7

21 months agoMerge "Fix --dbs test option" into main
mike bayer [Tue, 24 Oct 2023 14:49:20 +0000 (14:49 +0000)] 
Merge "Fix --dbs test option" into main

21 months agouse oracle.INTERVAL for generic interval
indivar [Fri, 20 Oct 2023 15:25:38 +0000 (11:25 -0400)] 
use oracle.INTERVAL for generic interval

Fixed issue in :class:`.Interval` datatype where the Oracle implementation
was not being used for DDL generation, leading to the ``day_precision`` and
``second_precision`` parameters to be ignored, despite being supported by
this dialect.  Pull request courtesy Indivar.

Fixes: #10509
Closes: #10513
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10513
Pull-request-sha: a3b901978504b1bc726f722fc27ca4827de05274

Change-Id: I074afeeac182567f9104c5175b81c735d87e1352

21 months agomove BYTEA test to PG suite
Mike Bayer [Tue, 24 Oct 2023 14:15:51 +0000 (10:15 -0400)] 
move BYTEA test to PG suite

we can't have any postgresql imports in suite/test_insert.py

Change-Id: I81f364169c775bef71dc77db0a6e9d6bc530e79d

21 months agoMerge "Fix identity column reflection failure" into main
mike bayer [Mon, 23 Oct 2023 18:34:29 +0000 (18:34 +0000)] 
Merge "Fix identity column reflection failure" into main

21 months agoMerge "run declarative scan for non-mapped annotated if allow_unmapped" into main
mike bayer [Mon, 23 Oct 2023 18:31:20 +0000 (18:31 +0000)] 
Merge "run declarative scan for non-mapped annotated if allow_unmapped" into main

21 months agoFix --dbs test option
Federico Caselli [Sun, 22 Oct 2023 09:25:28 +0000 (11:25 +0200)] 
Fix --dbs test option

At some point a version of pytest seems to have broken the
previous implementation

Change-Id: I7dfd4c8743f5214a3110dd1b6da4fa8296895899

21 months agoFix identity column reflection failure
Gord Thompson [Fri, 20 Oct 2023 14:19:42 +0000 (08:19 -0600)] 
Fix identity column reflection failure

Fixes: #10504
Fix reflection failure for bigint identity column with
a large identity start value (more than 18 digits).

Change-Id: I8a7ec114e4596b1710d789a4a4fb08013edd80ce

21 months agoMerge "Remove compare_against_backend" into main
mike bayer [Fri, 20 Oct 2023 18:14:02 +0000 (18:14 +0000)] 
Merge "Remove compare_against_backend" into main

21 months agorun declarative scan for non-mapped annotated if allow_unmapped
Mike Bayer [Fri, 20 Oct 2023 14:19:35 +0000 (10:19 -0400)] 
run declarative scan for non-mapped annotated if allow_unmapped

Fixed issue where the ``__allow_unmapped__`` directive failed to allow for
legacy :class:`.Column` / :func:`.deferred` mappings that nonetheless had
annotations such as ``Any`` or a specific type without ``Mapped[]`` as
their type, without errors related to locating the attribute name.

issue is not ticketed yet but is coming

Fixes: #10516
Change-Id: I471d6838f4dcc113addd284a39a5bb0b885b64ea

21 months agoMerge "dont write dupe idents w different drivers in the idents file" into main
mike bayer [Fri, 20 Oct 2023 18:13:09 +0000 (18:13 +0000)] 
Merge "dont write dupe idents w different drivers in the idents file" into main

21 months agoMerge "manufacture empty result for DELETE..RETURNING w/ no description" into main
mike bayer [Fri, 20 Oct 2023 17:49:15 +0000 (17:49 +0000)] 
Merge "manufacture empty result for DELETE..RETURNING w/ no description" into main

21 months agodont write dupe idents w different drivers in the idents file
Mike Bayer [Fri, 20 Oct 2023 17:31:15 +0000 (13:31 -0400)] 
dont write dupe idents w different drivers in the idents file

Change-Id: I474b40327fcc40a8a6eb4c537a4b80f0eea37162

21 months agoMerge "dont mis-render value from previous loop iteration" into main
mike bayer [Fri, 20 Oct 2023 17:08:44 +0000 (17:08 +0000)] 
Merge "dont mis-render value from previous loop iteration" into main

21 months agoMerge "revise argument to mysqlclient/pymysql ping" into main
mike bayer [Fri, 20 Oct 2023 13:27:07 +0000 (13:27 +0000)] 
Merge "revise argument to mysqlclient/pymysql ping" into main

21 months agoMerge "add aioodbc support for SQL Server" into main
mike bayer [Thu, 19 Oct 2023 17:06:43 +0000 (17:06 +0000)] 
Merge "add aioodbc support for SQL Server" into main

21 months agoMerge "fix AsyncSession.close_all()" into main
Federico Caselli [Thu, 19 Oct 2023 17:05:58 +0000 (17:05 +0000)] 
Merge "fix AsyncSession.close_all()" into main

21 months agoDoc: Update doc/build/tutorial/data_select.rst (#10506)
AmirSoroush [Thu, 19 Oct 2023 16:44:26 +0000 (19:44 +0300)] 
Doc: Update doc/build/tutorial/data_select.rst (#10506)

Removed an extra "that" in a sentence.