]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 years agocherry-pick changelog from 2.0.25
Mike Bayer [Wed, 3 Jan 2024 02:22:17 +0000 (21:22 -0500)] 
cherry-pick changelog from 2.0.25

2 years agochangelog fixes
Mike Bayer [Wed, 3 Jan 2024 01:40:16 +0000 (20:40 -0500)] 
changelog fixes

Change-Id: Ie0e1d5d2df93e26f31004aff11196043fc665679

2 years agocherry-pick changelog update for 1.4.52
Mike Bayer [Wed, 3 Jan 2024 01:32:39 +0000 (20:32 -0500)] 
cherry-pick changelog update for 1.4.52

2 years agocherry-pick changelog from 1.4.51
Mike Bayer [Wed, 3 Jan 2024 01:32:38 +0000 (20:32 -0500)] 
cherry-pick changelog from 1.4.51

2 years agohappy new year, continued
Mike Bayer [Wed, 3 Jan 2024 01:06:43 +0000 (20:06 -0500)] 
happy new year, continued

Change-Id: Ibf9a9b7ac7dab19aa82d6e0c446d4d555c18dcf6

2 years agoMerge "allow literals for function arguments" into main
Michael Bayer [Wed, 3 Jan 2024 00:52:37 +0000 (00:52 +0000)] 
Merge "allow literals for function arguments" into main

2 years agoallow literals for function arguments
Mike Bayer [Tue, 2 Jan 2024 18:03:40 +0000 (13:03 -0500)] 
allow literals for function arguments

* Fixed the argument types passed to functions so that literal expressions
like strings and ints are again interpreted correctly (:ticket:`10818`)

this includes a reformatting of the changelog message from #10801
to read as a general "fixed regressions" list.

Fixes: #10818
Change-Id: I65ad86e096241863e833608d45f0bdb6069f5896

2 years agoMerge "refactor any_ / all_" into main
Michael Bayer [Tue, 2 Jan 2024 23:48:29 +0000 (23:48 +0000)] 
Merge "refactor any_ / all_" into main

2 years agoMerge "Add oracledb_async driver support" into main
Michael Bayer [Tue, 2 Jan 2024 20:55:54 +0000 (20:55 +0000)] 
Merge "Add oracledb_async driver support" into main

2 years agorefactor any_ / all_
Mike Bayer [Tue, 2 Jan 2024 16:16:13 +0000 (11:16 -0500)] 
refactor any_ / all_

Improved compilation of :func:`_sql.any_` / :func:`_sql.all_` in the
context of a negation of boolean comparison, will now render ``NOT (expr)``
rather than reversing the equality operator to not equals, allowing
finer-grained control of negations for these non-typical operators.

Fixes: #10817
Change-Id: If0b324b1220ad3c7f053af91e8a61c81015f312a

2 years agoFix typo in dataclasses docs (#10809)
Paul McMillan [Tue, 2 Jan 2024 19:51:48 +0000 (11:51 -0800)] 
Fix typo in dataclasses docs (#10809)

2 years agoAdd oracledb_async driver support
Federico Caselli [Thu, 21 Dec 2023 22:41:56 +0000 (23:41 +0100)] 
Add oracledb_async driver support

Added support for :ref:`oracledb` in async mode.
The current implementation has some limitation, preventing
the support for :meth:`_asyncio.AsyncConnection.stream`.
Improved support if planned for the 2.1 release of SQLAlchemy.

Fixes: #10679
Change-Id: Iff123cf6241bcfa0fbac57529b80f933951be0a7

2 years agoforce uselist=False for all collection class not present
Mike Bayer [Tue, 2 Jan 2024 16:36:20 +0000 (11:36 -0500)] 
force uselist=False for all collection class not present

Fixed issue where ORM Annotated Declarative would mis-interpret the left
hand side of a relationship without any collection specified as
uselist=True if the left type were given as a class and not a string,
without using future-style annotations.

Fixes: #10815
Change-Id: I85daccec03f7e6ea3b49eb07c06e0f85e361a1c0

2 years agoMerge "ensure correct lock type propagated in pool recreate" into main
Michael Bayer [Tue, 2 Jan 2024 14:57:17 +0000 (14:57 +0000)] 
Merge "ensure correct lock type propagated in pool recreate" into main

2 years agoadd new notes on viewonly section
jonathan vanasco [Fri, 24 Sep 2021 21:48:09 +0000 (17:48 -0400)] 
add new notes on viewonly section

Updated join_conditions documentation to explain the limits of mutation
tracking on advanced relationships and illustrate potential ways to
remedy the situation.

Instead of simply writing a note, the (functional) code from the original
issue was turned into a tutorial that explains the various approaches.

Fixes: #4201
Change-Id: Id8bd163777688efd799d9b41f1c9edfce2f4dfad

2 years agoMerge "2024 setup" into main
Michael Bayer [Tue, 2 Jan 2024 14:01:06 +0000 (14:01 +0000)] 
Merge "2024 setup" into main

2 years agoMerge "support pep695 when resolving type map types" into main
Michael Bayer [Tue, 2 Jan 2024 01:11:45 +0000 (01:11 +0000)] 
Merge "support pep695 when resolving type map types" into main

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

2 years ago2024 setup
Mike Bayer [Mon, 1 Jan 2024 22:03:08 +0000 (17:03 -0500)] 
2024 setup

Change-Id: I2853d99bbc19c94227e2b88d450873197013bdfb

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

2 years agoMerge "pop prefetch values from committed_state when they are available" into main
Michael Bayer [Sat, 30 Dec 2023 17:07:55 +0000 (17:07 +0000)] 
Merge "pop prefetch values from committed_state when they are available" into main

2 years agosupport pep695 when resolving type map types
Mike Bayer [Sat, 30 Dec 2023 15:36:40 +0000 (10:36 -0500)] 
support pep695 when resolving type map types

Added preliminary support for Python 3.12 pep-695 type alias structures,
when resolving custom type maps for ORM Annotated Declarative mappings.

Fixes: #10807
Change-Id: Ia28123ce1d6d1fd6bae5e8a037be4754c890f281

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

2 years agoadd test illustrating workaround for #4376
Mike Bayer [Fri, 29 Dec 2023 17:07:19 +0000 (12:07 -0500)] 
add test illustrating workaround for #4376

Fixes: #4376
Change-Id: I5131b55a9859bb9d93949a5a90b65f519cd82122

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

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

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

2 years agocherry-pick changelog update for 2.0.25
Mike Bayer [Thu, 28 Dec 2023 16:23:13 +0000 (11:23 -0500)] 
cherry-pick changelog update for 2.0.25

2 years agocherry-pick changelog from 2.0.24
Mike Bayer [Thu, 28 Dec 2023 16:23:13 +0000 (11:23 -0500)] 
cherry-pick changelog from 2.0.24

2 years agobackport async_fallback deprecation changelog
Mike Bayer [Thu, 28 Dec 2023 16:18:52 +0000 (11:18 -0500)] 
backport async_fallback deprecation changelog

patched from 56f7b5391a34eb013fee7150a7206

Change-Id: Ida36037c629a8deed2a13e593132fcae9ceb8da0

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

Change-Id: I115807ccca74e55e96389d7bb723da3893bcc965

2 years agocorrect for asyncio.Runner not in py311 stubs
Mike Bayer [Thu, 28 Dec 2023 15:01:02 +0000 (10:01 -0500)] 
correct for asyncio.Runner not in py311 stubs

Second attempt.  TYPE_CHECKING has to be unconditional because
mypy doesnt know anything about py311 / py312 booleans

Change-Id: I28c6dff98f9d2021ad827ba2190fbcfd31ffa9d0

2 years agoRevert "correct for asyncio.Runner not in py311 stubs"
Mike Bayer [Thu, 28 Dec 2023 14:57:37 +0000 (09:57 -0500)] 
Revert "correct for asyncio.Runner not in py311 stubs"

I didn't really do this correctly, there's no "py311" boolean
in type checking so this has to be unconditional.

This reverts commit 6e3625a6334c4da982d4c81637a05fa88bc540b1.

2 years agocorrect for asyncio.Runner not in py311 stubs
Mike Bayer [Wed, 27 Dec 2023 22:35:07 +0000 (17:35 -0500)] 
correct for asyncio.Runner not in py311 stubs

Change-Id: Idc44c99474c6f41940ba7e55cf2a0ae2b7344d3f

2 years agoMerge "Remove async_fallback mode" into main
Michael Bayer [Wed, 27 Dec 2023 21:34:57 +0000 (21:34 +0000)] 
Merge "Remove async_fallback mode" into main

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

2 years agoRemove async_fallback mode
Federico Caselli [Tue, 5 Dec 2023 21:29:19 +0000 (22:29 +0100)] 
Remove async_fallback mode

Removed the async_fallback mode and await_fallback function.
Replace get_event_loop with Runner.
Removed the internal function ``await_fallback()``.
Renamed the internal function ``await_only()`` to ``await_()``.

Change-Id: Ib43829be6ebdb59b6c4447f5a15b5d2b81403fa9

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

2 years agoMerge "Use typing module instead of typing_extension for 3.8 objects" into main
Michael Bayer [Tue, 19 Dec 2023 23:49:54 +0000 (23:49 +0000)] 
Merge "Use typing module instead of typing_extension for 3.8 objects" into main

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

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

2 years agoMerge "Replace custom URL-encoding method with quote" into main
Michael Bayer [Wed, 13 Dec 2023 16:01:03 +0000 (16:01 +0000)] 
Merge "Replace custom URL-encoding method with quote" into main

2 years agoMerge "copy stack related elements to str compiler" into main
Michael Bayer [Wed, 13 Dec 2023 16:00:13 +0000 (16:00 +0000)] 
Merge "copy stack related elements to str compiler" into main

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

2 years agoraise ImportError when greenlet not installed
Mike Bayer [Mon, 11 Dec 2023 15:55:25 +0000 (10:55 -0500)] 
raise ImportError when greenlet not installed

This is the runtime raise when an async concurrency function
is called.  in 2.0 this raises ValueError, however here we've
standardized on raising ``ImportError`.

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

Fixes: #10747
Change-Id: I54dffe8577025e2ef3a59f5ca9ab7f4362d4d91f

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

2 years 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>
2 years 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>
2 years agoUse typing module instead of typing_extension for 3.8 objects
Federico Caselli [Tue, 5 Dec 2023 21:50:21 +0000 (22:50 +0100)] 
Use typing module instead of typing_extension for 3.8 objects

Change-Id: Ia3117b24d677f5e36134df20eb151edef0f6ac36

2 years agoMerge "Forward `**kw` in `__init_subclass__()` to super" into main
Michael Bayer [Thu, 7 Dec 2023 14:37:18 +0000 (14:37 +0000)] 
Merge "Forward `**kw` in `__init_subclass__()` to super" into main

2 years agocorrect version added in 312d92a3415ac252bbc98d1c180177ea113d18c2
Federico Caselli [Wed, 6 Dec 2023 21:59:33 +0000 (22:59 +0100)] 
correct version added in 312d92a3415ac252bbc98d1c180177ea113d18c2

Change-Id: Ibfa367d14ba257a2f9b60694bb34a072548432d8

2 years agoMerge "Update `TZDateTime` type decorator example to align with python docs" into...
Michael Bayer [Wed, 6 Dec 2023 21:44:21 +0000 (21:44 +0000)] 
Merge "Update `TZDateTime` type decorator example to align with python docs" into main

2 years agoMerge "Change Sequence and Identity oracle only kwargs." into main
Michael Bayer [Wed, 6 Dec 2023 21:43:12 +0000 (21:43 +0000)] 
Merge "Change Sequence and Identity oracle only kwargs." into main

2 years agoMerge "Remove legacy signatures from session events" into main
Michael Bayer [Wed, 6 Dec 2023 21:41:48 +0000 (21:41 +0000)] 
Merge "Remove legacy signatures from session events" into main

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

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

2 years agoRevert "Replace custom URL-encoding method with quote_plus"
Mike Bayer [Wed, 6 Dec 2023 18:57:23 +0000 (13:57 -0500)] 
Revert "Replace custom URL-encoding method with quote_plus"

This reverts commit b80e17c3f3e21059ba1a425d75bf3e0f9384d4d2.

our URL parsing does not interpret plus signs as spaces in the password.
so we cannot use this function as is

2 years agoRevert "will backport #10662 to 2.0"
Mike Bayer [Wed, 6 Dec 2023 18:57:10 +0000 (13:57 -0500)] 
Revert "will backport #10662 to 2.0"

This reverts commit 334aeab9ace836f70312394b67e02d619c9baf52.

2 years agowill backport #10662 to 2.0
Mike Bayer [Wed, 6 Dec 2023 18:52:08 +0000 (13:52 -0500)] 
will backport #10662 to 2.0

Change-Id: I04e7ac2bdb99bd1550ea98df0dd608c8c47a5f52

2 years agoMerge "Replace custom URL-encoding method with quote_plus" into main
Michael Bayer [Wed, 6 Dec 2023 18:46:19 +0000 (18:46 +0000)] 
Merge "Replace custom URL-encoding method with quote_plus" into main

2 years agoReplace custom URL-encoding method with quote_plus
eXenon [Mon, 4 Dec 2023 17:39:25 +0000 (12:39 -0500)] 
Replace custom URL-encoding method with quote_plus

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_plus``, 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: I90b7a9f4dfdb719082b4b178ad4e009a8531a18e

2 years agoMerge "try to gracefully close even in terminate" into main
Michael Bayer [Wed, 6 Dec 2023 15:54:30 +0000 (15:54 +0000)] 
Merge "try to gracefully close even in terminate" into main

2 years agoMerge "Improve session after_begin even documentation" into main
Michael Bayer [Wed, 6 Dec 2023 15:45:35 +0000 (15:45 +0000)] 
Merge "Improve session after_begin even documentation" into main

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

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

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

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

2 years agoRemove legacy signatures from session events
Federico Caselli [Thu, 30 Nov 2023 21:45:36 +0000 (22:45 +0100)] 
Remove legacy signatures from session events

Removed legacy signatures dating back to 0.9 release from the
:meth:`_orm.SessionEvents.after_bulk_update` and
:meth:`_orm.SessionEvents.after_bulk_delete`.

Fixes: #10721
Change-Id: I09a01b6bae5e2d8fba1ee723afce2ddb3596f4ec

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

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

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

2 years agoChange Sequence and Identity oracle only kwargs.
Federico Caselli [Wed, 16 Aug 2023 20:18:10 +0000 (22:18 +0200)] 
Change Sequence and Identity oracle only kwargs.

Deprecate Oracle only parameters :paramref:`_schema.Sequence.order`,
paramref:`_schema.Identity.order` and :paramref:`_schema.Identity.on_null`.
They should be configured using the dialect kwargs ``oracle_order`` and
oracle_on_null``.

Fixes: #10247
Change-Id: I124a16c9a482745e6f15669008968284fc435998

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

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

Change-Id: I9cb1571995f078c359a9c2793670a017effe4be2

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

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

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

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

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

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

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

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

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

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

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

2 years agoadapt all asyncio dialects to asyncio connector
Mike Bayer [Mon, 13 Nov 2023 20:52:43 +0000 (15:52 -0500)] 
adapt all asyncio dialects to asyncio connector

Adapted all asyncio dialects, including aiosqlite, aiomysql, asyncmy,
psycopg, asyncpg to use the generic asyncio connection adapter first added
in :ticket:`6521` for the aioodbc DBAPI, allowing these dialects to take
advantage of a common framework.

Fixes: #10415
Change-Id: I24123175aa787f3a2c550d9e02d3827173794e3b

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

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

2 years agoMerge "Enforce positional only attribute using /" into main
mike bayer [Tue, 14 Nov 2023 23:40:50 +0000 (23:40 +0000)] 
Merge "Enforce positional only attribute using /" into main

2 years agoEnforce positional only attribute using /
Federico Caselli [Mon, 6 Nov 2023 21:59:45 +0000 (22:59 +0100)] 
Enforce positional only attribute using /

Change-Id: Ia73c5b0a2d2a23ed2cf80154fbfb476f4dc84b5f

2 years agoDon't import greenlet at all until it's needed
Federico Caselli [Sun, 3 Sep 2023 19:24:45 +0000 (21:24 +0200)] 
Don't import greenlet at all until it's needed

Added an initialize step to the import of
``sqlalchemy.ext.asyncio`` so that ``greenlet`` will
be imported only when the asyncio extension is first imported.
Alternatively, the ``greenlet`` library is still imported lazily on
first use to support use case that don't make direct use of the
SQLAlchemy asyncio extension.

Fixes: #10296
Change-Id: I97162a01aa29adb3e3fee97b718ab9567b2f6124

2 years agoMerge "always derive type from element in annotated case" into main
mike bayer [Mon, 13 Nov 2023 13:27:21 +0000 (13:27 +0000)] 
Merge "always derive type from element in annotated case" into main

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

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

2 years agoMerge "Various minor fixes" into main
mike bayer [Fri, 10 Nov 2023 14:41:46 +0000 (14:41 +0000)] 
Merge "Various minor fixes" into main

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

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

Change-Id: Ifb53e125fc9fd759938908710b2474656dbf1ef9

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

2 years agoMore python 3.7 removal cleanups
Federico Caselli [Tue, 7 Nov 2023 18:21:06 +0000 (19:21 +0100)] 
More python 3.7 removal cleanups

Change-Id: I6de7754361c649af323fa1a90fe29371c98b1541

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