]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
22 months agoremove new line 10959/head
Tomasz Nowacki [Mon, 4 Mar 2024 14:14:00 +0000 (15:14 +0100)] 
remove new line

22 months agofix field name in test
Tomasz Nowacki [Mon, 4 Mar 2024 14:12:59 +0000 (15:12 +0100)] 
fix field name in test

22 months agofix with_loader_criteria and LoaderCriteriaOption
Tomasz Nowacki [Mon, 4 Mar 2024 14:10:33 +0000 (15:10 +0100)] 
fix with_loader_criteria and LoaderCriteriaOption

23 months agomove tests to a common file
Tomasz Nowacki [Wed, 7 Feb 2024 17:28:07 +0000 (18:28 +0100)] 
move tests to a common file

23 months agochange DeferredLambdaElement to accept any lambda type
Tomasz Nowacki [Sat, 3 Feb 2024 19:21:55 +0000 (20:21 +0100)] 
change DeferredLambdaElement to accept any lambda type

23 months agoFixes: sqlalchemy#10933 typing in ColumnExpressionArgument
Tomasz Nowacki [Sat, 3 Feb 2024 13:28:06 +0000 (14:28 +0100)] 
Fixes: sqlalchemy#10933 typing in ColumnExpressionArgument
23 months agoMerge "Support PEP-621 and PEP-685" into main
Michael Bayer [Tue, 30 Jan 2024 13:25:15 +0000 (13:25 +0000)] 
Merge "Support PEP-621 and PEP-685" into main

23 months agoExport array module from postgresql
Federico Caselli [Mon, 29 Jan 2024 19:09:56 +0000 (20:09 +0100)] 
Export array module from postgresql

Before this module was shadowed by same named array classe.

Change-Id: I6fc56795c9363a9a07466fd36fcd49d0fb9658f7

2 years agoMerge "suffix index names with "_history" just like tables" into main
Michael Bayer [Sat, 27 Jan 2024 22:55:10 +0000 (22:55 +0000)] 
Merge "suffix index names with "_history" just like tables" into main

2 years agore-establish section on why __init__ not called on load
Mike Bayer [Fri, 26 Jan 2024 14:17:31 +0000 (09:17 -0500)] 
re-establish section on why __init__ not called on load

this section got lost, leaving the FAQ to point to an
empty document.  Rewrite a new section introducing that
__init__ is not called on load, illustrate strategies.

I am not that happy with *where* this doc is, as this is
supposed to be "mapping styles" high level introductory
type stuff, but there's nowhere else for it.

References: https://github.com/sqlalchemy/sqlalchemy/discussions/10923
Change-Id: Ie9260e4076bc82da0ef6dc11349a85beb0223a33

2 years agoFix typo in a docstring (#10925)
Eugene Toder [Thu, 25 Jan 2024 22:19:44 +0000 (17:19 -0500)] 
Fix typo in a docstring (#10925)

* Fix typo in a docstring

It's "compiled_cache" not "query_cache".

* Update async engine as well

2 years agoSupport PEP-621 and PEP-685
KOLANICH [Thu, 16 Feb 2023 18:31:29 +0000 (21:31 +0300)] 
Support PEP-621 and PEP-685

Move the metadata for `setuptools` into `PEP 621`-compliant `pyproject.toml`.
Use PEP-685 extras, keeping the old names for backward compatibility.

Closes: #9324
Closes: #10481
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9324
Change-Id: I14170e33a4a7370257d941adea4f96a39e785911

2 years agoMerge "Add PEP 646 integration" into main
Michael Bayer [Wed, 24 Jan 2024 15:42:11 +0000 (15:42 +0000)] 
Merge "Add PEP 646 integration" into main

2 years agoMerge "Support specifying access method when creating Postgres tables" into main
Michael Bayer [Wed, 24 Jan 2024 15:32:37 +0000 (15:32 +0000)] 
Merge "Support specifying access method when creating Postgres tables" into main

2 years agoMerge "Correct type hint for FunctionElement.table_valued()" into main
Michael Bayer [Wed, 24 Jan 2024 15:31:49 +0000 (15:31 +0000)] 
Merge "Correct type hint for FunctionElement.table_valued()" into main

2 years agosuffix index names with "_history" just like tables
Mike Bayer [Tue, 23 Jan 2024 19:06:01 +0000 (14:06 -0500)] 
suffix index names with "_history" just like tables

Fixed regression in history_meta example where the use of
:meth:`_schema.MetaData.to_metadata` to make a copy of the history table
would also copy indexes (which is a good thing), but causing naming
conflicts indexes regardless of naming scheme used for those indexes. A
"_history" suffix is now added to these indexes in the same way as is
achieved for the table name.

Fixes: #10920
Change-Id: I78823650956ff979d500bedbdbce261048894ce9

2 years agofix a docs typo (#10912)
Jeff Balogh [Tue, 23 Jan 2024 19:25:10 +0000 (13:25 -0600)] 
fix a docs typo (#10912)

The code following this declaration suggests the employee.type should be `sysadmin`

2 years agoUpdate cascades.rst (#10918)
Gord Thompson [Tue, 23 Jan 2024 19:22:32 +0000 (12:22 -0700)] 
Update cascades.rst (#10918)

"delete-cascade" → "delete-orphan"

2 years agoParse NOT NULL for MySQL generated columns
Georg Wicke-Arndt [Mon, 22 Jan 2024 15:22:43 +0000 (10:22 -0500)] 
Parse NOT NULL for MySQL generated columns

Fixed issue where NULL/NOT NULL would not be properly reflected from a
MySQL column that also specified the VIRTUAL or STORED directives.  Pull
request courtesy Georg Wicke-Arndt.

Fixes: #10850
Closes: #10851
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10851
Pull-request-sha: fb9a81020c393231ca90a1e88342b11cf64414a1

Change-Id: I9a80d0db722c15682e18f0390a7b58e5979e73a1

2 years agoAdd PEP 646 integration
Yurii Karabas [Wed, 17 Jan 2024 17:08:05 +0000 (12:08 -0500)] 
Add PEP 646 integration

The :class:`.Row` object now no longer makes use of an intermediary
``Tuple`` in order to represent its individual element types; instead,
the individual element types are present directly, via new :pep:`646`
integration, now available in more recent versions of Mypy.  Mypy
1.7 or greater is now required for statements, results and rows
to be correctly typed.   Pull request courtesy Yurii Karabas.

Fixes: #10635
Closes: #10634
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10634
Pull-request-sha: 430785c8a04a48fe96ce35b4f4e08476700c1f79

Change-Id: Ibd0ae31a98b4ea69dcb89f970e640920b2be6c48

2 years agoSupport specifying access method when creating Postgres tables
Edgar Ramírez Mondragón [Mon, 22 Jan 2024 07:29:44 +0000 (02:29 -0500)] 
Support specifying access method when creating Postgres tables

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

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

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

-->

This pull request is:

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

Fixes #10904

**Have a nice day!**

Closes: #10905
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10905
Pull-request-sha: 85f232a303a5543725dac42206cb2395fc34109e

Change-Id: I5e2fc05a696eb6da71bbd695f0466e8552d203b6

2 years agouse sequence instead of list in result docs
Federico Caselli [Sat, 20 Jan 2024 17:33:28 +0000 (18:33 +0100)] 
use sequence instead of list in result docs

Change-Id: Iaed8505c495455f0d82e4b0cbcc7dffd2d833408

2 years agoMerge "remove loader depth warning, replace with logging message" into main
Michael Bayer [Fri, 19 Jan 2024 16:14:09 +0000 (16:14 +0000)] 
Merge "remove loader depth warning, replace with logging message" into main

2 years agoremove loader depth warning, replace with logging message
Mike Bayer [Thu, 18 Jan 2024 02:15:37 +0000 (21:15 -0500)] 
remove loader depth warning, replace with logging message

Replaced the "loader depth is excessively deep" warning with a shorter
message added to the caching badge within SQL logging, for those statements
where the ORM disabled the cache due to a too-deep chain of loader options.
The condition which this warning highlights is difficult to resolve and is
generally just a limitation in the ORM's application of SQL caching. A
future feature may include the ability to tune the threshold where caching
is disabled, but for now the warning will no longer be a nuisance.

Fixes: #10896
Change-Id: Ic3be2086d1db16f9a75390323f00a43ef72aca12

2 years agoMerge "Oracle default arraysize is now set by the driver" into main
Federico Caselli [Thu, 18 Jan 2024 18:54:20 +0000 (18:54 +0000)] 
Merge "Oracle default arraysize is now set by the driver" into main

2 years agoOracle default arraysize is now set by the driver
Federico Caselli [Fri, 12 Jan 2024 18:17:30 +0000 (19:17 +0100)] 
Oracle default arraysize is now set by the driver

Changed the default arraysize of the Oracle dialects so that the value set
by the driver is used, that is 100 at the time of writing for both
cx_oracle and oracledb. Previously the value was set to 50 by default.

Fixes: #10877
Change-Id: Ie4c53f42437d3d7dbbad36398d7883472577f367

2 years agoMerge "use ensure_closed() for async close, close() for terminate" into main
Michael Bayer [Wed, 17 Jan 2024 19:34:11 +0000 (19:34 +0000)] 
Merge "use ensure_closed() for async close, close() for terminate" into main

2 years agoMerge "allow callable for relationship.back_populates" into main
Michael Bayer [Wed, 17 Jan 2024 19:33:24 +0000 (19:33 +0000)] 
Merge "allow callable for relationship.back_populates" into main

2 years agoallow callable for relationship.back_populates
Priyanshu Parikh [Sun, 15 Oct 2023 14:34:25 +0000 (10:34 -0400)] 
allow callable for relationship.back_populates

The :paramref:`_orm.relationship.back_populates` argument to
:func:`_orm.relationship` may now be passed as a Python callable, which
resolves to either the direct linked ORM attribute, or a string value as
before.  ORM attributes are also accepted directly by
:paramref:`_orm.relationship.back_populates`.   This change allows type
checkers and IDEs to confirm the argument for
:paramref:`_orm.relationship.back_populates` is valid. Thanks to Priyanshu
Parikh for the help on suggesting and helping to implement this feature.

An attempt was made to do this for ForeignKey as well, however this
is not feasible since there is no "deferred configuration" step
for Table objects; Table objects set each other up on ForeignKey
as they are created, such as setting the type of a column
in a referencing Column when the referenced table is created.  We
have no way to know which Table a foreign key intends to represent
when it's a callable whereas when it's a string, we do know, and
we actually make a lot of use of that string to match it to the
target table as that target is created (see _fk_memos).  However
the commit keeps a little bit of the cleanup to ForeignKey intact.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #10050
Closes: #10260
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10260
Pull-request-sha: 6f21002e1d5bbe291111655f33b19e4eb4b3cb84

Change-Id: I8e0a40c9898ec91d44f2df06dcc22f33b06745c3

2 years agouse ensure_closed() for async close, close() for terminate
Gord Thompson [Sun, 14 Jan 2024 16:49:11 +0000 (09:49 -0700)] 
use ensure_closed() for async close, close() for terminate

Fixed issue in asyncio dialects asyncmy and aiomysql, where their
``.close()`` method is apparently not a graceful close.  replace with
non-standard ``.ensure_closed()`` method that's awaitable and move
``.close()`` to the so-called "terminate" case.

Fixes: #10893
Change-Id: I33d871e67854d85f770c46f699e41a6e73b6fbe0

2 years agoCorrect type hint for FunctionElement.table_valued()
Martijn Pieters [Tue, 16 Jan 2024 12:03:09 +0000 (07:03 -0500)] 
Correct type hint for FunctionElement.table_valued()

### Description

The documentation and the type annotations for `TableValueType()` clearly
state that both strings and column expression arguments are accepted
but the annotation omits `str`, which is the most common use case.

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

Closes: #10886
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10886
Pull-request-sha: 624a97f051b378516518a30d88e7f216456d1c50

Change-Id: I2a1d2eb9b70815c33a27dd238ff2a9f11e5f5a64

2 years agoFix type of CASE expressions which include NULLs
David Evans [Mon, 15 Jan 2024 15:13:53 +0000 (10:13 -0500)] 
Fix type of CASE expressions which include NULLs

Fixed issues in :func:`_sql.case` where the logic for determining the
type of the expression could result in :class:`.NullType` if the last
element in the "whens" had no type, or in other cases where the type
could resolve to ``None``.  The logic has been updated to scan all
given expressions so that the first non-null type is used, as well as
to always ensure a type is present.  Pull request courtesy David Evans.

updates to test suite to use modern fixture patterns by Mike

Fixes: #10843
Closes: #10847
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10847
Pull-request-sha: 4fd5c39ab56de046e68c08f6c20cd1f7b2cb0e0d

Change-Id: I40f905ac336a8a42b617ff9473dbd9c22ac57505

2 years agoMerge "add Identity() for remaining examples" into main
Michael Bayer [Sat, 13 Jan 2024 15:27:10 +0000 (15:27 +0000)] 
Merge "add Identity() for remaining examples" into main

2 years agoadd Identity() for remaining examples
Mike Bayer [Fri, 12 Jan 2024 14:29:28 +0000 (09:29 -0500)] 
add Identity() for remaining examples

Fixed the performance example scripts in examples/performance to mostly
work with the Oracle database, by adding the :class:`.Identity` construct
to all the tables and allowing primary generation to occur on this backend.
A few of the "raw DBAPI" cases still are not compatible with Oracle.

Change-Id: I7ce19645ea78736dddfda6f33b9356ad75dee68f

2 years agoMerge "Support reflecting no inherit check constraint in pg." into main
Michael Bayer [Thu, 11 Jan 2024 18:55:16 +0000 (18:55 +0000)] 
Merge "Support reflecting no inherit check constraint in pg." into main

2 years agoSupport reflecting no inherit check constraint in pg.
Ellis Valentiner [Mon, 8 Jan 2024 16:16:21 +0000 (11:16 -0500)] 
Support reflecting no inherit check constraint in pg.

Added support for reflection of PostgreSQL CHECK constraints marked with
"NO INHERIT", setting the key ``no_inherit=True`` in the reflected data.
Pull request courtesy Ellis Valentiner.

Fixes: #10777
Closes: #10778
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10778
Pull-request-sha: 058082ff6297f9ccdc4977e65ef024e9a093426e

Change-Id: Ia33e29c0c57cf0076e8819311f4628d712fdc332

2 years agoMerge "remove unnecessary execution_options.merge_with in _execute_ddl" into main
Michael Bayer [Thu, 11 Jan 2024 16:54:48 +0000 (16:54 +0000)] 
Merge "remove unnecessary execution_options.merge_with in _execute_ddl" into main

2 years agocatch OSError (base of ConnectionError) and asyncpg errors for terminate
Mike Bayer [Thu, 11 Jan 2024 03:31:59 +0000 (22:31 -0500)] 
catch OSError (base of ConnectionError) and asyncpg errors for terminate

Fixed regression in the asyncpg dialect caused by :ticket:`10717` in
release 2.0.24 where the change that now attempts to gracefully close the
asyncpg connection before terminating would not fall back to
``terminate()`` for other potential connection-related exceptions other
than a timeout error, not taking into account cases where the graceful
``.close()`` attempt fails for other reasons such as connection errors.

Fixes: #10863
Change-Id: If1791bce26803f92547cdf26fb641996c7f638fa

2 years agoremove unnecessary execution_options.merge_with in _execute_ddl
Federico Caselli [Wed, 10 Jan 2024 18:30:53 +0000 (19:30 +0100)] 
remove unnecessary execution_options.merge_with in _execute_ddl

Change-Id: Idcd886bf6ad5db28c4dc581a7f1e91e12f6f9a05

2 years agoAdd note that password parameter is not to be url encoded
Mike Bayer [Tue, 9 Jan 2024 18:45:52 +0000 (13:45 -0500)] 
Add note that password parameter is not to be url encoded

References: #10852
Change-Id: Ifa44513ce315214fa5d1b55d3e92b53889caeacc

2 years agofix code typo in doc:faq:sqlexpressions on `in_()` (#10845)
Xiaokui Shu [Mon, 8 Jan 2024 18:44:53 +0000 (13:44 -0500)] 
fix code typo in doc:faq:sqlexpressions on `in_()` (#10845)

2 years agoFix typo in 'Mapping Table Columns' documentation (#10842)
Mateusz Bączek [Mon, 8 Jan 2024 18:44:18 +0000 (19:44 +0100)] 
Fix typo in 'Mapping Table Columns' documentation (#10842)

Co-authored-by: Mateusz Bączek <mateusz.baczek@creotech.pl>
2 years agoDBAPIConnection can be None for checkin event
Mike Bayer [Mon, 8 Jan 2024 14:15:17 +0000 (09:15 -0500)] 
DBAPIConnection can be None for checkin event

Fixed the type signature for the :meth:`.PoolEvents.checkin` event to
indicate that the given :class:`.DBAPIConnection` argument may be ``None``
in the case where the connection has been invalidated.

Change-Id: I4c6f0cf999f2ffb730909e2688eb3b0794ecf2ab

2 years agocherry-pick changelog update for 2.0.26
Mike Bayer [Wed, 3 Jan 2024 02:22:17 +0000 (21:22 -0500)] 
cherry-pick changelog update for 2.0.26

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