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

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>
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>
19 months 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

19 months 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

19 months 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

19 months 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

19 months 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

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

19 months 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

19 months 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.

19 months 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

19 months 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

19 months 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

19 months 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

19 months 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

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

19 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

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

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

19 months 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

19 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

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

20 months 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

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

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

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

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

20 months 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

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

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

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

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

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

20 months 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

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

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

20 months 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

20 months 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

20 months 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

20 months 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

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

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

20 months 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

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

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

20 months 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

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)

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

20 months agoMerge "2.1 setup / initial dependency/min version change" into main
mike bayer [Mon, 6 Nov 2023 23:03:44 +0000 (23:03 +0000)] 
Merge "2.1 setup / initial dependency/min version change" into main

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)

20 months ago2.1 setup / initial dependency/min version change
Mike Bayer [Mon, 6 Nov 2023 15:55:19 +0000 (10:55 -0500)] 
2.1 setup / initial dependency/min version change

this includes setup.cfg changes for asyncio and
3.8 min support.  it doesnt have any code changes in support
of these adjusments.

Fixes: #10197
Fixes: #10357
Change-Id: Ic4569c770d1b893a067a9a5dfe13a6e28aaf47fa

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

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

20 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

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

20 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

20 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

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

21 months agomanufacture empty result for DELETE..RETURNING w/ no description
Mike Bayer [Thu, 19 Oct 2023 16:14:14 +0000 (12:14 -0400)] 
manufacture empty result for DELETE..RETURNING w/ no description

Established a workaround for what seems to be an intrinsic issue across
MySQL/MariaDB drivers where a RETURNING result for DELETE DML which returns
no rows using SQLAlchemy's "empty IN" criteria fails to provide a
cursor.description, which then yields result that returns no rows,
leading to regressions for the ORM that in the 2.0 series uses RETURNING
for bulk DELETE statements for the "synchronize session" feature. To
resolve, when the specific case of "no description when RETURNING was
given" is detected, an "empty result" with a correct cursor description is
generated and used in place of the non-working cursor.

Fixes: #10505
Change-Id: Ib56f1ec5746e2b3212e563169353bc023db84099

21 months agodont mis-render value from previous loop iteration
Mike Bayer [Thu, 19 Oct 2023 15:21:26 +0000 (11:21 -0400)] 
dont mis-render value from previous loop iteration

Fixed issue where using the same bound parameter more than once with
``literal_execute=True`` in some combinations with other literal rendering
parameters would cause the wrong values to render due to an iteration
issue.

Fixes: #10142
Change-Id: Idde314006568e3445558f0104aed9d2f4af72b56

21 months agorevise argument to mysqlclient/pymysql ping
Mike Bayer [Tue, 17 Oct 2023 22:54:23 +0000 (18:54 -0400)] 
revise argument to mysqlclient/pymysql ping

Repaired a new incompatibility in the MySQL "pre-ping" routine where the
``False`` argument passed to ``connection.ping()``, which is intended to
disable an unwanted "automatic reconnect" feature,  is being deprecated in
MySQL drivers and backends, and is producing warnings for some versions of
MySQL's native client drivers.  It's removed for mysqlclient, whereas for
PyMySQL and drivers based on PyMySQL, the parameter will be deprecated and
removed at some point, so API introspection is used to future proof against
these various stages of removal.

Fixes: #10492
Change-Id: I8a52428c6f93a03b66a605cb0b85cc5924803d6d
references: #10489

21 months agofix AsyncSession.close_all()
Bryan不可思议 [Wed, 18 Oct 2023 20:31:45 +0000 (16:31 -0400)] 
fix AsyncSession.close_all()

Fixed bug with method :meth:`_asyncio.AsyncSession.close_all`
that was not working correctly.
Also added function :func:`_asyncio.close_all_sessions` that's
the equivalent of :func:`_orm.close_all_sessions`.

Fixes: #10421
Closes: #10429
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10429
Pull-request-sha: a35c29d41213bd79bfa73ac559a29035ca4e9eb9

Change-Id: If2c3f0130a71b239382c2ea11a3436788ee242be