]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
23 months agoMake Values().data input covariant with Sequence
Iuri de Silvio [Thu, 12 Oct 2023 12:25:40 +0000 (08:25 -0400)] 
Make Values().data input covariant with Sequence

Fixed typing issue where the argument list passed to :class:`.Values` was
too-restrictively tied to ``List`` rather than ``Sequence``.  Pull request
courtesy Iuri de Silvio.

Fixes: #10451
Closes: #10452
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10452
Pull-request-sha: 7800f0d631f75b716b8870755e5d0a3fbe950277

Change-Id: If631455d049b2308ec42602b72a60a5ede35fa32

23 months agoupdates for mypy 1.6.0
Mike Bayer [Wed, 11 Oct 2023 15:54:26 +0000 (11:54 -0400)] 
updates for mypy 1.6.0

Change-Id: I33b8e2f55b9049ed412dbe1d0ccd5c9e83e4d1d5

23 months agoMerge "Fix typo in Session.get_one() docs" into main
mike bayer [Tue, 10 Oct 2023 17:05:16 +0000 (17:05 +0000)] 
Merge "Fix typo in Session.get_one() docs" into main

23 months agoclarify one-to-one double parent behaviors
Mike Bayer [Tue, 10 Oct 2023 13:55:57 +0000 (09:55 -0400)] 
clarify one-to-one double parent behaviors

includes that single_parent can be set as an additional measure.

Change-Id: I81d7115ddc7b76ee045582b212e662e0c9d41408
References: #10448

23 months agoFix typo in Session.get_one() docs
Jens Troeger [Sat, 7 Oct 2023 06:48:29 +0000 (02:48 -0400)] 
Fix typo in Session.get_one() docs

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

A typo in the docstrings [here](https://docs.sqlalchemy.org/en/20/orm/session_api.html#sqlalchemy.orm.Session.get_one) shows the incorrectly formatted text:

![Screenshot 2023-10-07 at 16 24 19](https://github.com/sqlalchemy/sqlalchemy/assets/12053937/95cbfbfa-dac3-465a-8e27-ec8e2a223117)

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: #10437
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10437
Pull-request-sha: 82ef25ecbc5b39487b5b55bedb43df9c2a57ae2e

Change-Id: I4ae54733c4bd63239fc94a7fd2099bb3896718ca

23 months agoprovide better detail on declared mixins w/ naming conventions
Mike Bayer [Mon, 9 Oct 2023 13:03:42 +0000 (09:03 -0400)] 
provide better detail on declared mixins w/ naming conventions

Fixes: #10441
Change-Id: I392bc725a850616528d32a8b17805e219ff10aa3

23 months agorepair / test repr() for DDL
Iuri de Silvio [Mon, 9 Oct 2023 12:21:01 +0000 (08:21 -0400)] 
repair / test repr() for DDL

Fixed 2.0 regression where the :class:`.DDL` construct would no longer
``__repr__()`` due to the removed ``on`` attribute not being accommodated.
Pull request courtesy Iuri de Silvio.

Fixes: #10443
Closes: #10442
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10442
Pull-request-sha: 76f0484091b6a35e5953b8d13f3c66c0b1baa9b0

Change-Id: Id49afd681a04e0f05014105b8f15fdb66e6594a0

2 years agotry to clarify defaultload option docs
Federico Caselli [Fri, 6 Oct 2023 19:36:50 +0000 (21:36 +0200)] 
try to clarify defaultload option docs

Change-Id: I529279ba5c7b546faf71a63aa680233cc3cae326

2 years agoMerge "enable 3.12 wheels / actions" into main
mike bayer [Fri, 6 Oct 2023 16:55:40 +0000 (16:55 +0000)] 
Merge "enable 3.12 wheels / actions" into main

2 years agoenable 3.12 wheels / actions
Mike Bayer [Wed, 4 Oct 2023 15:55:36 +0000 (11:55 -0400)] 
enable 3.12 wheels / actions

Change-Id: I823dc9378fe2c18c59237f30906c1efc4b041d54

2 years agoFix typos in pooling docs
Stefanie Molin [Fri, 6 Oct 2023 13:39:41 +0000 (09:39 -0400)] 
Fix typos in pooling docs

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

### Description
<!-- Describe your changes in detail -->
- fixed typo in pooling doc that mentioned three items but had a list of 4
- fixed typo "whish" to "wish" in pooling doc

### 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: #10411
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10411
Pull-request-sha: 652ead00466ce2e85bdc2a62f7c69c16da6bb4fc

Change-Id: Ia5f2c5abfb0d76b5222aa883473291bba6df6de0

2 years agoMerge "check fairy for None in pool cleanup" into main
mike bayer [Fri, 6 Oct 2023 13:09:02 +0000 (13:09 +0000)] 
Merge "check fairy for None in pool cleanup" into main

2 years agoBump pypa/cibuildwheel from 2.16.1 to 2.16.2 (#10416)
dependabot[bot] [Wed, 4 Oct 2023 19:54:07 +0000 (21:54 +0200)] 
Bump pypa/cibuildwheel from 2.16.1 to 2.16.2 (#10416)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.16.1 to 2.16.2.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.16.1...v2.16.2)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoMerge "Added an option to permanently close sessions." into main
mike bayer [Wed, 4 Oct 2023 15:02:47 +0000 (15:02 +0000)] 
Merge "Added an option to permanently close sessions." into main

2 years agocheck fairy for None in pool cleanup
Mike Bayer [Wed, 4 Oct 2023 13:42:55 +0000 (09:42 -0400)] 
check fairy for None in pool cleanup

Fixed issue where under some garbage collection / exception scenarios the
connection pool's cleanup routine would raise an error due to an unexpected
set of state, which can be reproduced under specific conditions.

Fixes: #10414
Change-Id: Ie732f23290d0d3d641f37cd2fee55aff5b9d0857

2 years agoMerge "consider indpendent CTE for UPDATE..FROM" into main
mike bayer [Tue, 3 Oct 2023 19:49:25 +0000 (19:49 +0000)] 
Merge "consider indpendent CTE for UPDATE..FROM" into main

2 years agoinclude WriteOnlyMapped, DynamicMapped in abs import lookup
Mike Bayer [Tue, 3 Oct 2023 17:42:35 +0000 (13:42 -0400)] 
include WriteOnlyMapped, DynamicMapped in abs import lookup

Fixed issue where :class:`.Mapped` symbols like :class:`.WriteOnlyMapped`
and :class:`.DynamicMapped` could not be correctly resolved when referenced
as an element of a sub-module in the given annotation, assuming
string-based or "future annotations" style annotations.

Fixes: #10412
Change-Id: I188146a6de7f6f80ec0ebf6e982b7842a78adc54

2 years agoconsider indpendent CTE for UPDATE..FROM
Mike Bayer [Tue, 3 Oct 2023 12:40:06 +0000 (08:40 -0400)] 
consider indpendent CTE for UPDATE..FROM

Fixed issue where referring to a FROM entry in the SET clause of an UPDATE
statement would not include it in the FROM clause of the UPDATE statement,
if that entry were nowhere else in the statement; this occurs currently for
CTEs that were added using :meth:`.Update.add_cte` to provide the desired
CTE at the top of the statement.

Fixes: #10408
Change-Id: I6e3c6ca7a00cc884bda7e0f24c62c34c75134e5b

2 years agoAdded an option to permanently close sessions.
Daniel Krzeminski [Tue, 22 Aug 2023 18:18:48 +0000 (14:18 -0400)] 
Added an option to permanently close sessions.

Set to ``False`` the new parameter :paramref:`_orm.Session.close_is_reset`
will prevent a :class:`_orm.Session` from performing any other
operation after :meth:`_orm.Session.close` has been called.

Added new method :meth:`_orm.Session.reset` that will reset a :class:`_orm.Session`
to its initial state. This is an alias of :meth:`_orm.Session.close`,
unless :paramref:`_orm.Session.close_is_reset` is set to ``False``.

Fixes: #7787
Closes: #10137
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10137
Pull-request-sha: 881241e19b24f34e4553b2d58070bfa99597f4e4

Change-Id: Ic3512874600daff4ed66bb0cd29a3a88f667d258

2 years agoMerge "Add flake8-unused-arguments to catch unused args typos" into main
mike bayer [Mon, 2 Oct 2023 12:25:29 +0000 (12:25 +0000)] 
Merge "Add flake8-unused-arguments to catch unused args typos" into main

2 years agoMerge "Add get_one to Session, AsyncSession, scoped, etc" into main
mike bayer [Sun, 1 Oct 2023 14:28:04 +0000 (14:28 +0000)] 
Merge "Add get_one to Session, AsyncSession, scoped, etc" into main

2 years agoAdd get_one to Session, AsyncSession, scoped, etc
Carlos Sousa [Mon, 25 Sep 2023 17:03:26 +0000 (13:03 -0400)] 
Add get_one to Session, AsyncSession, scoped, etc

Added method :meth:`_orm.Session.get_one` that behaves like
meth:`_orm.Session.get` but raises an exception instead of returning
None`` if no instance was found with the provided primary key.
Pull request courtesy of Carlos Sousa.

Fixed the :paramref:`_asyncio.AsyncSession.get.execution_options` parameter
which was not being propagated to the underlying :class:`_orm.Session` and
was instead being ignored.

Fixes #10292
Closes: #10376
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10376
Pull-request-sha: 70e4505e93905ee3cebc52f828a95c6bf987c9be

Change-Id: I78eb9816c26446757b6c6c171df2e400777a3d36

2 years agoMerge "handle builtins types in annotations with __allow_unmapped__" into main
mike bayer [Sat, 30 Sep 2023 15:12:55 +0000 (15:12 +0000)] 
Merge "handle builtins types in annotations with __allow_unmapped__" into main

2 years agoAdd flake8-unused-arguments to catch unused args typos
Federico Caselli [Wed, 27 Sep 2023 19:01:57 +0000 (21:01 +0200)] 
Add flake8-unused-arguments to catch unused args typos

Change-Id: I85447bf6587074c521c3673d2999a7ce05fefaec

2 years agoinvoke mariadb-connector .rowcount after all statements
Mike Bayer [Thu, 28 Sep 2023 12:58:16 +0000 (08:58 -0400)] 
invoke mariadb-connector .rowcount after all statements

Modified the mariadb-connector driver to pre-load the ``cursor.rowcount``
value for all queries, to suit tools such as Pandas that hardcode to
calling :attr:`.Result.rowcount` in this way. SQLAlchemy normally pre-loads
``cursor.rowcount`` only for UPDATE/DELETE statements and otherwise passes
through to the DBAPI where it can return -1 if no value is available.
However, mariadb-connector does not support invoking ``cursor.rowcount``
after the cursor itself is closed, raising an error instead.  Generic test
support has been added to ensure all backends support the allowing
:attr:`.Result.rowcount` to succceed (that is, returning an integer value
with -1 for "not available") after the result is closed.

This change also restores mariadb-connector to CI including
as part of the "dbdriver" suite; in 366a5e3e2e503a20ef0334fbf9f we had
taken it out of the DBAPI main job.

Additional fixes for the mariadb-connector dialect to support UUID data
values in the result in INSERT..RETURNING statements.

Added rounding to one remaining INSERT..RETURNING with floats test
to allow mariadbconnector to pass (likely similar issue as the one with
UUID but not worth making a new handler)

Fixes: #10396
Change-Id: Ic11b1b5d0c41356863829d0eacbb812d401e8dd1

2 years agohandle builtins types in annotations with __allow_unmapped__
Pascal Corpet [Thu, 28 Sep 2023 18:08:23 +0000 (14:08 -0400)] 
handle builtins types in annotations with __allow_unmapped__

Fixed issue with ``__allow_unmapped__`` declarative option where types that
were declared using collection types such as ``list[SomeClass]`` vs. the
typing construct ``List[SomeClass]`` would fail to be recognized correctly.
Pull request courtesy Pascal Corpet.

Fixes: #10385
Closes: #10390
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10390
Pull-request-sha: f8796965aefc1852d4b1137d04bf811072a1a0e9

Change-Id: I114d29c3c076386508300e979371b0d760b761c7

2 years agoMerge "Type annotations for sqlalchemy.orm.dynamic" into main
Federico Caselli [Thu, 28 Sep 2023 21:01:07 +0000 (21:01 +0000)] 
Merge "Type annotations for sqlalchemy.orm.dynamic" into main

2 years agoType annotations for sqlalchemy.orm.dynamic
Maksim Latysh [Thu, 23 Mar 2023 12:37:40 +0000 (08:37 -0400)] 
Type annotations for sqlalchemy.orm.dynamic

Closes: #9039
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9039
Pull-request-sha: dae9138f8019bf7e2b305ec869734373a997350d

Change-Id: I89a96213558928877abffc450aeeecbbd196aa92

2 years agonext attempt, try building pyodbc from github rather than released
Mike Bayer [Wed, 27 Sep 2023 21:45:05 +0000 (17:45 -0400)] 
next attempt, try building pyodbc from github rather than released

Change-Id: I87b39ae7fdf3d57e1e0c3ccb4e826e733c3c21ce

2 years agoback out pymssql for py312
Mike Bayer [Wed, 27 Sep 2023 21:39:45 +0000 (17:39 -0400)] 
back out pymssql for py312

in ff80019212a5632c9dd01e we opened up for py312.
all the drivers passed except the mssql build as there is no wheel for
pymssql and we have not been able to build that one.

try it with just pyodbc.

Change-Id: I3f792034656de7aee93b77a3525ca41fa00b4f19

2 years agoBump pypa/cibuildwheel from 2.16.0 to 2.16.1 (#10391)
dependabot[bot] [Wed, 27 Sep 2023 20:42:06 +0000 (22:42 +0200)] 
Bump pypa/cibuildwheel from 2.16.0 to 2.16.1 (#10391)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.16.0 to 2.16.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.16.0...v2.16.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoopen up py312 for all DBAPIs
Mike Bayer [Wed, 27 Sep 2023 15:27:47 +0000 (11:27 -0400)] 
open up py312 for all DBAPIs

this wont run under jenkins gerrit job but will hit for jenkins_main /
jenkins_dbapi_main.    will merge and then revert if main / github
builds are really tanking

Change-Id: I29e372ad14bd1005c12176db2d837ecd451c0922

2 years agoMerge "accommodate all mapped_column() parameters in Annotated transfer" into main
mike bayer [Tue, 26 Sep 2023 18:41:55 +0000 (18:41 +0000)] 
Merge "accommodate all mapped_column() parameters in Annotated transfer" into main

2 years agoRevise / rewrite sentences that use the phrase "referred towards"
Eric Hanchrow [Wed, 20 Sep 2023 21:02:08 +0000 (17:02 -0400)] 
Revise / rewrite sentences that use the phrase "referred towards"

Comments by Mike <mike_mp@zzzcomputing.com>:

"Referred towards" is not correct English and can be replaced directly
with "referred to".  However, this then introduces a dangling
preposition to sentences which I don't think is appropriate for this
style of writing.  So instead, use phrases like "known as",
"references", "to which X refers".

To help me identify dangling prepositions I made use of ChatGPT,
here's the log of how that transpired:
https://chat.openai.com/share/60d42ff4-c1ac-4232-893a-415c2b6d7320

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Closes: #10210
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10210
Pull-request-sha: 5d30e79c14fe78996d332fefd4bae36d76626ff4

Change-Id: Ib6a98e5be441f5b25d3929a2efb7d873bcfef98e

2 years agoaccommodate all mapped_column() parameters in Annotated transfer
Mike Bayer [Tue, 19 Sep 2023 21:57:50 +0000 (17:57 -0400)] 
accommodate all mapped_column() parameters in Annotated transfer

Fixed a wide range of :func:`_orm.mapped_column` parameters that were not
being transferred when using the :func:`_orm.mapped_column` object inside
of a pep-593 ``Annotated`` object, including
:paramref:`_orm.mapped_column.sort_order`,
:paramref:`_orm.mapped_column.deferred`,
:paramref:`_orm.mapped_column.autoincrement`,
:paramref:`_orm.mapped_column.system`, :paramref:`_orm.mapped_column.info`
etc.

Additionally, it remains not supported to have dataclass arguments, such as
:paramref:`_orm.mapped_column.kw_only`,
:paramref:`_orm.mapped_column.default_factory` etc. indicated within the
:func:`_orm.mapped_column` received by ``Annotated``, as this is not
supported with pep-681 Dataclass Transforms.  A warning is now emitted when
these parameters are used within ``Annotated`` in this way (and they
continue to be ignored).

Fixes: #10369
Fixes: #10046
Change-Id: Ibcfb287cba0e764db0ae15fab8049bbb9f94dd1b

2 years agoMerge "adjust view definition reflection test for pg16" into main
mike bayer [Wed, 20 Sep 2023 20:45:55 +0000 (20:45 +0000)] 
Merge "adjust view definition reflection test for pg16" into main

2 years agoBump pypa/cibuildwheel from 2.15.0 to 2.16.0 (#10371)
dependabot[bot] [Wed, 20 Sep 2023 19:41:51 +0000 (21:41 +0200)] 
Bump pypa/cibuildwheel from 2.15.0 to 2.16.0 (#10371)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.15.0 to 2.16.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.15.0...v2.16.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoadjust view definition reflection test for pg16
Mike Bayer [Wed, 20 Sep 2023 17:43:21 +0000 (13:43 -0400)] 
adjust view definition reflection test for pg16

Change-Id: Idd45f8f9dab14bfb0e3f69e82e8c7898ab7d87ba

2 years agoEnsure loader criteria used for ORM join with expression condition
Mike Bayer [Tue, 19 Sep 2023 12:58:52 +0000 (08:58 -0400)] 
Ensure loader criteria used for ORM join with expression condition

Fixed bug where ORM :func:`_orm.with_loader_criteria` would not apply
itself to a :meth:`_sql.Select.join` where the ON clause were given as a
plain SQL comparison, rather than as a relationship target or similar.

Fixes: #10365
Change-Id: Ie6d08fb01a3079b7c3ccd3a8241031d46a56e19d

2 years agoVersion 2.0.22 placeholder
Mike Bayer [Mon, 18 Sep 2023 21:15:13 +0000 (17:15 -0400)] 
Version 2.0.22 placeholder

2 years ago- 2.0.21 rel_2_0_21
Mike Bayer [Mon, 18 Sep 2023 21:02:11 +0000 (17:02 -0400)] 
- 2.0.21

2 years agomore doc fixes
Mike Bayer [Mon, 18 Sep 2023 21:00:49 +0000 (17:00 -0400)] 
more doc fixes

Change-Id: I081f59dd687d6230d2a15a6e068938bc5dd52595

2 years agodoc fixes
Mike Bayer [Mon, 18 Sep 2023 20:43:31 +0000 (16:43 -0400)] 
doc fixes

Change-Id: I97f4985ccfcaaa6da75ff89defe0dd62c61d0559

2 years agoMerge "Update type annotations for loading options" into main
mike bayer [Mon, 18 Sep 2023 20:15:48 +0000 (20:15 +0000)] 
Merge "Update type annotations for loading options" into main

2 years agoMerge "parse for parenthesis in referenced tablename, columnname" into main
mike bayer [Mon, 18 Sep 2023 20:15:10 +0000 (20:15 +0000)] 
Merge "parse for parenthesis in referenced tablename, columnname" into main

2 years agoparse for parenthesis in referenced tablename, columnname
Mike Bayer [Tue, 12 Sep 2023 15:05:48 +0000 (11:05 -0400)] 
parse for parenthesis in referenced tablename, columnname

Fixed a series of reflection issues affecting the PostgreSQL,
MySQL/MariaDB, and SQLite dialects when reflecting foreign key constraints
where the target column contained parenthesis in one or both of the table
name or column name.

Fixes: #10275
Change-Id: Ia2393d45416af6b36e7cab4ee10c2ade7a7e49b3

2 years agoMerge "consider _ClassStrategyLoad as part of endpoint path" into main
mike bayer [Mon, 18 Sep 2023 17:44:37 +0000 (17:44 +0000)] 
Merge "consider _ClassStrategyLoad as part of endpoint path" into main

2 years agoUpdate type annotations for loading options
Janek Nouvertné [Wed, 16 Aug 2023 15:01:39 +0000 (11:01 -0400)] 
Update type annotations for loading options

Update type annotations for ORM loading options, restricting them to accept
only `"*"` instead of any string for string arguments.  Pull request
courtesy Janek Nouvertné.

Fixes: #10131
Closes: #10133
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10133
Pull-request-sha: 08793ed5bfbffbc8688a2573f021e834fc7de367

Change-Id: I33bb93d36cd1eb9d8c7390ed0e94a784e0b8af46

2 years agoFix typing to ensure that InstrumentedAttribute is hashable
Federico Caselli [Sat, 16 Sep 2023 09:06:17 +0000 (11:06 +0200)] 
Fix typing to ensure that InstrumentedAttribute is hashable

Repaired the core "SQL element" class ``SQLCoreOperations`` to support the
``__hash__()`` method from a typing perspective, as objects like
:class:`.Column` and ORM :class:`.InstrumentedAttribute` are hashable and
are used as dictionary keys in the public API for the :class:`_dml.Update`
and :class:`_dml.Insert` constructs.  Previously, type checkers were not
aware the root SQL element was hashable.

Fixes: #10353
Change-Id: I3c8eeb7ceb29a3087596e17d09aa6a7f45a8cf99

2 years agoconsider _ClassStrategyLoad as part of endpoint path
Mike Bayer [Thu, 14 Sep 2023 14:48:03 +0000 (10:48 -0400)] 
consider _ClassStrategyLoad as part of endpoint path

Added new capability to the :func:`_orm.selectin_polymorphic` loader option
which allows other loader options to be bundled as siblings, referring to
one of its subclasses, within the sub-options of parent loader option.
Previously, this pattern was only supported if the
:func:`_orm.selectin_polymorphic` were at the top level of the options for
the query.   See new documentation section for example.

As part of this change, improved the behavior of the
:meth:`_orm.Load.selectin_polymorphic` method / loader strategy so that the
subclass load does not load most already-loaded columns from the parent
table, when the option is used against a class that is already being
relationship-loaded.  Previously, the logic to load only the subclass
columns worked only for a top level class load.

Fixes: #10348
Change-Id: I13a8cad5484e97b2ab51402f100193cb054e2155

2 years agosql/sqltypes/Enum: explicitly document values_callable order (#10248)
Huw Jones [Sat, 16 Sep 2023 09:41:16 +0000 (10:41 +0100)] 
sql/sqltypes/Enum: explicitly document values_callable order (#10248)

Fixes #9911

2 years agoupdate PR template
Federico Caselli [Sat, 16 Sep 2023 08:34:08 +0000 (10:34 +0200)] 
update PR template

include small typing fixes in the cases that don't need an issue

Change-Id: Ibe17267bde0b7a747e1a50ca43124f3a661c6a99

2 years agoFix the type annotation of MetaData.reflect's argument `only` (#10352)
Markus Hauru [Sat, 16 Sep 2023 08:31:43 +0000 (10:31 +0200)] 
Fix the type annotation of MetaData.reflect's argument `only` (#10352)

2 years agoMerge "Add support for SQL string aggregation function aggregate_strings." into main
mike bayer [Fri, 15 Sep 2023 12:28:28 +0000 (12:28 +0000)] 
Merge "Add support for SQL string aggregation function aggregate_strings." into main

2 years agoAdd support for SQL string aggregation function aggregate_strings.
Joshua Morris [Tue, 11 Jul 2023 06:21:37 +0000 (02:21 -0400)] 
Add support for SQL string aggregation function aggregate_strings.

Add support for SQL string aggregation function :class:`.aggregate_strings`.
Pull request curtesy Joshua Morris.

Fixes #9873
Closes: #9892
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9892
Pull-request-sha: 0f4f83bade675f2ff734579fc411d0b354e5a4e6

Change-Id: I6e4afc83664a142e3b1e245978b08a200b6d03d9

2 years agoMerge "qualify hashlib.md5() with usedforsecurity=False" into main
mike bayer [Thu, 14 Sep 2023 15:49:37 +0000 (15:49 +0000)] 
Merge "qualify hashlib.md5() with usedforsecurity=False" into main

2 years agoMerge "Improve the GUID typedecorator example" into main
mike bayer [Thu, 14 Sep 2023 15:48:09 +0000 (15:48 +0000)] 
Merge "Improve the GUID typedecorator example" into main

2 years agoMerge "remove unused type ignores" into main
mike bayer [Thu, 14 Sep 2023 15:46:16 +0000 (15:46 +0000)] 
Merge "remove unused type ignores" into main

2 years agoMerge "allow any key for naming_convention dict, typing is not possible" into main
mike bayer [Thu, 14 Sep 2023 15:46:10 +0000 (15:46 +0000)] 
Merge "allow any key for naming_convention dict, typing is not possible" into main

2 years agoFix Existing.select_from type definition
Federico Caselli [Tue, 12 Sep 2023 20:08:25 +0000 (22:08 +0200)] 
Fix Existing.select_from type definition

Fixed typing issue with :meth:`_sql.Existing.select_from` that
prevented its use with ORM classes.

Fixes: #10337
Change-Id: I4324c09054803f0b1ae7c4bde202cad0b55e1a4f

2 years agoremove unused type ignores
Federico Caselli [Tue, 12 Sep 2023 19:56:15 +0000 (21:56 +0200)] 
remove unused type ignores

Change-Id: Id212e8b4ff7427872ead8fd409a68408813f7d76

2 years agoqualify hashlib.md5() with usedforsecurity=False
Mike Bayer [Tue, 12 Sep 2023 16:24:14 +0000 (12:24 -0400)] 
qualify hashlib.md5() with usedforsecurity=False

Qualified the use of ``hashlib.md5()`` within the DDL compiler, which is
used to generate deterministic four-character suffixes for long index and
constraint names in DDL statements, to include the Python 3.9+
``usedforsecurity=False`` parameter so that Python interpreters built for
restricted environments such as FIPS do not consider this call to be
related to security concerns.

Fixes: #10342
Change-Id: I3af0d3de3d140663c70921ab1ed4b66ad9512ec4

2 years agoBump docker/setup-qemu-action from 2 to 3 (#10343)
dependabot[bot] [Tue, 12 Sep 2023 18:53:53 +0000 (20:53 +0200)] 
Bump docker/setup-qemu-action from 2 to 3 (#10343)

Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  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 agoImprove the GUID typedecorator example
Federico Caselli [Mon, 11 Sep 2023 20:57:20 +0000 (22:57 +0200)] 
Improve the GUID typedecorator example

Change-Id: I92909b1262f994a3ff0dd201bc87612ff1d37822
References: #10336

2 years agoallow any key for naming_convention dict, typing is not possible
Mike Bayer [Tue, 12 Sep 2023 12:01:54 +0000 (08:01 -0400)] 
allow any key for naming_convention dict, typing is not possible

Fixed regression introduced in 2.0.20 via :ticket:`9600` fix which
attempted to add more formal typing to
:paramref:`_schema.MetaData.naming_convention`. This change prevented basic
naming convention dictionaries from passing typing and has been adjusted so
that a plain dictionary of strings for keys as well as dictionaries that
use constraint types as keys or a mix of both, are again accepted.

As part of this change, lesser used forms of the naming convention
dictionary are also typed, including that it currently allows for
``Constraint`` type objects as keys as well.

Fixes: #9284
Fixes: #10264
Change-Id: Ic6561dd65058e4de3a7a393295b9863fc065db13

2 years agoadd row order after grouping (#10333)
Marat Idrisov [Sun, 10 Sep 2023 17:34:54 +0000 (20:34 +0300)] 
add row order after grouping (#10333)

2 years agomore covariant typing tests
Federico Caselli [Fri, 8 Sep 2023 20:05:33 +0000 (22:05 +0200)] 
more covariant typing tests

Change-Id: Ib469e4807ac3eb2181b8083e8ef5772636a48a88

2 years agoMerge "Clarify what float are compiled to" into main
mike bayer [Fri, 8 Sep 2023 12:55:51 +0000 (12:55 +0000)] 
Merge "Clarify what float are compiled to" into main

2 years agoMerge "ensure all modules are importable without pytest harnesses" into main
mike bayer [Fri, 8 Sep 2023 12:54:05 +0000 (12:54 +0000)] 
Merge "ensure all modules are importable without pytest harnesses" into main

2 years agoremove ancient engine.execute() reference from main engine doc
Mike Bayer [Thu, 7 Sep 2023 22:28:32 +0000 (18:28 -0400)] 
remove ancient engine.execute() reference from main engine doc

Change-Id: I51a30c2e53ad7da3e1209b5623388dd2aea7589c

2 years agoensure all modules are importable without pytest harnesses
Mike Bayer [Thu, 7 Sep 2023 21:37:13 +0000 (17:37 -0400)] 
ensure all modules are importable without pytest harnesses

Fixed very old issue where the full extent of SQLAlchemy modules, including
``sqlalchemy.testing.fixtures``, could not be imported outside of a pytest
run. This suits inspection utilities such as ``pkgutil`` that attempt to
import all installed modules in all packages.

Fixes: #10321
Change-Id: Ic2247c59b98f462036ad0d734aef9a96f290d778

2 years agoAdd return type annotation to `configure_mappers` (#10294)
Daniel Thorne [Thu, 7 Sep 2023 21:41:33 +0000 (17:41 -0400)] 
Add return type annotation to `configure_mappers` (#10294)

2 years agoClarify what float are compiled to
Federico Caselli [Wed, 6 Sep 2023 20:18:29 +0000 (22:18 +0200)] 
Clarify what float are compiled to

Change-Id: I8b1c083ae7ccf803a94401f57a00d058a8ce7aae
References: #10300

2 years agoFix async ORM example
Gord Thompson [Wed, 6 Sep 2023 15:33:27 +0000 (09:33 -0600)] 
Fix async ORM example

Reverting change from b3216486 that causes error

sqlalchemy.exc.MultipleResultsFound: Multiple rows were found when exactly one was required

Change-Id: I9b249ff6e8e336f9c224e670359b4df99bc06092

2 years agoMerge "Make `Mapped` covariant" into main
mike bayer [Tue, 5 Sep 2023 23:23:16 +0000 (23:23 +0000)] 
Merge "Make `Mapped` covariant" into main

2 years agoBump pypa/cibuildwheel from 2.14.1 to 2.15.0 (#10215)
dependabot[bot] [Mon, 4 Sep 2023 19:31:57 +0000 (21:31 +0200)] 
Bump pypa/cibuildwheel from 2.14.1 to 2.15.0 (#10215)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.14.1 to 2.15.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.14.1...v2.15.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoBump actions/checkout from 3 to 4 (#10311)
dependabot[bot] [Mon, 4 Sep 2023 19:30:18 +0000 (21:30 +0200)] 
Bump actions/checkout from 3 to 4 (#10311)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  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 agoFixed typo: `extend` -> `extent` (#10304)
rene [Sun, 3 Sep 2023 19:35:11 +0000 (05:35 +1000)] 
Fixed typo: `extend` -> `extent` (#10304)

2 years agoMerge "simplify oracle enterprise check and update test_reflect_oltp_compression...
mike bayer [Sun, 3 Sep 2023 14:27:35 +0000 (14:27 +0000)] 
Merge "simplify oracle enterprise check and update test_reflect_oltp_compression" into main

2 years agoMerge "automatically create proxy col for already-used col in values" into main
mike bayer [Wed, 30 Aug 2023 15:01:41 +0000 (15:01 +0000)] 
Merge "automatically create proxy col for already-used col in values" into main

2 years agoMake `Mapped` covariant
RomeoDespres [Tue, 29 Aug 2023 10:11:11 +0000 (06:11 -0400)] 
Make `Mapped` covariant

Made the contained type for :class:`.Mapped` covariant; this is to allow
greater flexibility for end-user typing scenarios, such as the use of
protocols to represent particular mapped class structures that are passed
to other functions. As part of this change, the contained type was also
made covariant for dependent and related types such as
:class:`_orm.base.SQLORMOperations`, :class:`_orm.WriteOnlyMapped`, and
:class:`_sql.SQLColumnExpression`. Pull request courtesy Roméo Després.

within the change, there is a bit of adjustment to ``__radd__()`` to
match the typing of ``__add__()``, which previously was slightly
different for some reason and not passing on mypy with this change.

Fixes: #10288
Closes: #10289
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10289
Pull-request-sha: 50eee7021cd29d59f52d8ff10c69d2970e1c1534

Change-Id: Ic55723a78b0b3b47dfff927d9ee0b94301272a6a

2 years agosimplify oracle enterprise check and update test_reflect_oltp_compression
suraj shaw [Tue, 29 Aug 2023 12:01:35 +0000 (08:01 -0400)] 
simplify oracle enterprise check and update test_reflect_oltp_compression

Fixes: #10271
Closes: #10272
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10272
Pull-request-sha: 10d1f22264dbf4e0715af3ccfc2d4064ca2a2020

Change-Id: I8a3774803256dd60f7c7333e26b767bb0d38d6af

2 years agoautomatically create proxy col for already-used col in values
Mike Bayer [Fri, 25 Aug 2023 14:48:59 +0000 (10:48 -0400)] 
automatically create proxy col for already-used col in values

The :class:`.Values` construct will now automatically create a proxy (i.e.
a copy) of a :class:`_sql.column` if the column were already associated
with an existing FROM clause.  This allows that an expression like
``values_obj.c.colname`` will produce the correct FROM clause even in the
case that ``colname`` was passed as a :class:`_sql.column` that was already
used with a previous :class:`.Values` or other table construct.
Originally this was considered to be a candidate for an error condition,
however it's likely this pattern is already in widespread use so it's
now added to support.

* adjust unrelated dml test recently added for update..returning *
  case to not rely upon ordering

Fixes: #10280
Change-Id: I6e60e5b7cb7abd6a7bbd4722970ebf025596ab9c

2 years agoadd explicit support for aliased ORM models in UPDATE/DELETE
Mike Bayer [Fri, 25 Aug 2023 16:12:06 +0000 (12:12 -0400)] 
add explicit support for aliased ORM models in UPDATE/DELETE

Adjusted the ORM's interpretation of UPDATE/DELETE targets to not interfere
with the target table passed to the statement, such as for
:class:`_orm.aliased` constructs.   Cases like ORM session synchonize using
"SELECT" statements such as with MySQL/ MariaDB will still have issues with
UPDATE/DELETE of this form so it's best to disable synchonize_session when
using DML statements of this type.

A separate issue to identify RETURNING should be used for
ORM UPDATE of an aliased() with fetch strategy and that these columns
should come back was attempted here, but is failing tests and is beyond
the scope of the immediate issue.

also updates the mssql URL in config to suit current preferences :)

Change-Id: If1609ad500abb10d430717786142fb430d1c9265

2 years agoAllow using Enum with length=None
Eugene Toder [Tue, 22 Aug 2023 17:54:02 +0000 (13:54 -0400)] 
Allow using Enum with length=None

Adjusted the :class:`_types.Enum` datatype to accept an argument of
``None`` for the :paramref:`_types.Enum.length` parameter, resulting in a
VARCHAR or other textual type with no length in the resulting DDL. This
allows for new elements of any length to be added to the type after it
exists in the schema.  Pull request courtesy Eugene Toder.

Fixes: #10269
Closes: #10274
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10274
Pull-request-sha: 651afaaea76c1ec868402cdd7106ec8b2de76254

Change-Id: I374ae9e5fa63da21a4cc87e323ce1a54acd6e39b

2 years agoMerge "Fix type hint of `key` on `Visitable.__class_getitem__()`" into main
mike bayer [Tue, 22 Aug 2023 03:30:56 +0000 (03:30 +0000)] 
Merge "Fix type hint of `key` on `Visitable.__class_getitem__()`" into main

2 years agoFix type hint of `key` on `Visitable.__class_getitem__()`
Jordan Macdonald [Wed, 16 Aug 2023 15:00:59 +0000 (11:00 -0400)] 
Fix type hint of `key` on `Visitable.__class_getitem__()`

Fixed the type annotation for ``__class_getitem__()`` as applied to the
``Visitable`` class at the base of expression constructs to accept ``Any``
for a key, rather than ``str``, which helps with some IDEs such as PyCharm
when attempting to write typing annotations for SQL constructs which
include generic selectors.  Pull request courtesy Jordan Macdonald.

Fixes: #9878
Closes: #9881
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9881
Pull-request-sha: 5aefaaf1065d1f946137a8b2f5be0767856cf9b0

Change-Id: I956e6d41142c50d870a142c3e99567a7ed2f7114

2 years agoadjust concat precedence to match that of string comparison
Mike Bayer [Mon, 21 Aug 2023 14:40:09 +0000 (10:40 -0400)] 
adjust concat precedence to match that of string comparison

Adjusted the operator precedence for the string concatenation operator to
be equal to that of string matching operators, such as
:meth:`.ColumnElement.like`, :meth:`.ColumnElement.regexp_match`,
:meth:`.ColumnElement.match`, etc., as well as plain ``==`` which has the
same precedence as string comparison operators, so that parenthesis will be
applied to a string concatenation expression that follows a string match
operator. This provides for backends such as PostgreSQL where the "regexp
match" operator is apparently of higher precedence than the string
concatenation operator.

Fixes: #9610
Change-Id: I73640e40e445375177340e1ed8f45b5da98d6dfb

2 years agoMerge "place asyncpg do_ping within a transaction if one not begun already" into...
mike bayer [Fri, 18 Aug 2023 16:33:13 +0000 (16:33 +0000)] 
Merge "place asyncpg do_ping within a transaction if one not begun already" into main

2 years agoplace asyncpg do_ping within a transaction if one not begun already
Mike Bayer [Wed, 16 Aug 2023 19:38:51 +0000 (15:38 -0400)] 
place asyncpg do_ping within a transaction if one not begun already

Fixed regression which appeared in 2.0 due to :ticket:`8491` where the
revised "ping" used for PostgreSQL dialects when the
:paramref:`_sa.create_engine.pool_pre_ping` parameter is in use would
interfere with the use of asyncpg with PGBouncer "transaction" mode, as the
multiple PostgreSQL commands emitted by asnycpg could be broken out among
multiple connections leading to errors, due to the lack of any transaction
around this newly revised "ping".   The ping is now invoked within a
transaction, in the same way that is implicit with all other backends that
are based on the pep-249 DBAPI; this guarantees that the series of PG
commands sent by asyncpg for this command are invoked on the same backend
connection without it jumping to a different connection mid-command.  The
transaction is not used if the asyncpg dialect is used in "AUTOCOMMIT"
mode, which remains incompatible with pgbouncer transaction mode.

Fixes: #10226
Change-Id: I93156ad7c353a865d93e5296bd7bc137f0350f3c

2 years agoMerge "Fix rendering of order in sequences and identity columns." into main
mike bayer [Thu, 17 Aug 2023 17:05:40 +0000 (17:05 +0000)] 
Merge "Fix rendering of order in sequences and identity columns." into main

2 years agoFix rendering of order in sequences and identity columns.
Federico Caselli [Wed, 9 Aug 2023 21:27:21 +0000 (23:27 +0200)] 
Fix rendering of order in sequences and identity columns.

Fixes the rendering of the Oracle only ``order`` attribute in
Sequence and Identity that was passed also when rendering
the DDL in PostgreSQL.

Fixes: #10207
Change-Id: I5b918eab38ba68fa10a213a79e2bd0cc48401a02

2 years agogeneralize pydantic version warning 10249/head
Sebastian Bayer [Thu, 17 Aug 2023 11:30:45 +0000 (13:30 +0200)] 
generalize pydantic version warning

Pydantic 1.x and 2.x both have compatibility issues with sqlalchemy, which we denote by removing the restriction on the 1.x version of pydantic

2 years agoVersion 2.0.21 placeholder
Mike Bayer [Tue, 15 Aug 2023 18:51:00 +0000 (14:51 -0400)] 
Version 2.0.21 placeholder

2 years ago- 2.0.20 rel_2_0_20
Mike Bayer [Tue, 15 Aug 2023 18:34:31 +0000 (14:34 -0400)] 
- 2.0.20

2 years agolimit drivers for memusage target
Mike Bayer [Tue, 15 Aug 2023 18:27:34 +0000 (14:27 -0400)] 
limit drivers for memusage target

apparently on CI the memusage target is running with the much
slower sqlite_numeric "fake" dialect.  limit this target to straight
sqlite and psycopg2

Change-Id: Ica66204cd5d612439f7d6ce53eff0965e97176b1

2 years agofix test case for SQL server
Mike Bayer [Tue, 15 Aug 2023 13:38:52 +0000 (09:38 -0400)] 
fix test case for SQL server

Change-Id: I607a825e8d2c5b27e7404239e1a6c1a5340532e7

2 years agoadd nullable construct to better type outer joins
Federico Caselli [Sat, 5 Aug 2023 13:07:26 +0000 (15:07 +0200)] 
add nullable construct to better type outer joins

Fixes: #10173
Change-Id: Ie203232de744882235f1543ec8c73c7d5fe99e3e

2 years agoMerge "propagate regular execution_options to secondary eager loaders" into main
mike bayer [Mon, 14 Aug 2023 22:35:10 +0000 (22:35 +0000)] 
Merge "propagate regular execution_options to secondary eager loaders" into main

2 years agopropagate regular execution_options to secondary eager loaders
Mike Bayer [Sun, 13 Aug 2023 15:16:03 +0000 (11:16 -0400)] 
propagate regular execution_options to secondary eager loaders

Fixed fairly major issue where execution options passed to
:meth:`_orm.Session.execute`, as well as execution options local to the ORM
executed statement itself, would not be propagated along to eager loaders
such as that of :func:`_orm.selectinload`, :func:`_orm.immediateload`, and
:meth:`_orm.subqueryload`, making it impossible to do things such as
disabling the cache for a single statement or using
``schema_translate_map`` for a single statement, as well as the use of
user-custom execution options.   A change has been made where **all**
user-facing execution options present for :meth:`_orm.Session.execute` will
be propagated along to additional loaders.

As part of this change, the warning for "excessively deep" eager loaders
leading to caching being disabled can be silenced on a per-statement
basis by sending ``execution_options={"compiled_cache": None}`` to
:meth:`_orm.Session.execute`, which will disable caching for the full
series of statements within that scope.

Fixes: #10231
Change-Id: I5304d3af0b78e1b4593c3558f117b7ac10b499ae