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

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

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

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

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

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

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

Change-Id: I081f59dd687d6230d2a15a6e068938bc5dd52595

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

Change-Id: I97f4985ccfcaaa6da75ff89defe0dd62c61d0559

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

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

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

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

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

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

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

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

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

21 months 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)

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

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

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

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

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

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

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

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

Change-Id: Id212e8b4ff7427872ead8fd409a68408813f7d76

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

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

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

22 months 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)

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

Change-Id: Ib469e4807ac3eb2181b8083e8ef5772636a48a88

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

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

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

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

22 months 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)

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

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

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

22 months 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>
22 months 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>
22 months agoFixed typo: `extend` -> `extent` (#10304)
rene [Sun, 3 Sep 2023 19:35:11 +0000 (05:35 +1000)] 
Fixed typo: `extend` -> `extent` (#10304)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

23 months agoupdate CI supported DB versions
Mike Bayer [Mon, 14 Aug 2023 18:20:12 +0000 (14:20 -0400)] 
update CI supported DB versions

Change-Id: I6f7991242eebc2b25df96e6779881882d29eb7a1

23 months agoMerge "restore slotscheck, skipping mypy extension" into main
mike bayer [Mon, 14 Aug 2023 14:37:33 +0000 (14:37 +0000)] 
Merge "restore slotscheck, skipping mypy extension" into main

23 months agodon't encourage "reader/writer" engines in one session
Mike Bayer [Mon, 14 Aug 2023 14:13:01 +0000 (10:13 -0400)] 
don't encourage "reader/writer" engines in one session

Change-Id: Ia18db210bf22d76147c80e901ac755442faa19be
References: #10233

23 months agorestore slotscheck, skipping mypy extension
Mike Bayer [Mon, 14 Aug 2023 13:46:47 +0000 (09:46 -0400)] 
restore slotscheck, skipping mypy extension

in [1] it was identified that import issues in the mypy extension
in interaction with mypy 1.5 is the source of the error in slotscheck.

I'm happy to remove mypy as a dependency for the slotscheck step
in any case.

[1] https://github.com/ariebovenberg/slotscheck/issues/178

Change-Id: I750de591179840a586650d303bcaf2ede59ec048

23 months agodisable slotscheck pending core dump issue
Mike Bayer [Sun, 13 Aug 2023 18:26:57 +0000 (14:26 -0400)] 
disable slotscheck pending core dump issue

Change-Id: I7083d0a9955caa28156e2ed183875b42dbada4c1
References: https://github.com/ariebovenberg/slotscheck/issues/178

23 months agosafe annotate QueryableAttribute inside of join() condition
Mike Bayer [Thu, 10 Aug 2023 22:26:45 +0000 (18:26 -0400)] 
safe annotate QueryableAttribute inside of join() condition

Fixed fundamental issue which prevented some forms of ORM "annotations"
from taking place for subqueries which made use of :meth:`_sql.Select.join`
against a relationship target.  These annotations are used whenever a
subquery is used in special situations such as within
:meth:`_orm.PropComparator.and_` and other ORM-specific scenarios.

Fixes: #10223
Change-Id: I40f04265a6caa0fdcbc9f1b121a35561ab4b1fcf

23 months agoupdate slotscheck
Mike Bayer [Fri, 11 Aug 2023 19:30:58 +0000 (15:30 -0400)] 
update slotscheck

we are getting intermittent crashes from slotscheck on CI.
actually I saw one just happen here with the latest version, it's
a core dump :(.  anyway, try it anyway see if things improve

Change-Id: I8c0a37df245e44dbffb4713e52ef27894843a720

23 months agoMerge "implement custom setstate to work around implicit type/comparator" into main
mike bayer [Thu, 10 Aug 2023 21:04:35 +0000 (21:04 +0000)] 
Merge "implement custom setstate to work around implicit type/comparator" into main

23 months agore-add aiomysql to the ci, remove unmaintained note
Federico Caselli [Sat, 5 Aug 2023 10:02:53 +0000 (12:02 +0200)] 
re-add aiomysql to the ci, remove unmaintained note

References: #6893
Change-Id: Ifb70975f686eef2b7239ca266e9dbfff1f1007cb

23 months agoimplement custom setstate to work around implicit type/comparator
Mike Bayer [Wed, 9 Aug 2023 14:17:35 +0000 (10:17 -0400)] 
implement custom setstate to work around implicit type/comparator

Fixed issue where unpickling of a :class:`_schema.Column` or other
:class:`_sql.ColumnElement` would fail to restore the correct "comparator"
object, which is used to generate SQL expressions specific to the type
object.

Fixes: #10213
Change-Id: I74e805024bcc0d93d549bd94757c2865b3117d72

23 months agoupdate for mypy 1.5
Mike Bayer [Thu, 10 Aug 2023 18:34:14 +0000 (14:34 -0400)] 
update for mypy 1.5

Change-Id: I70a210caa71d538c3c3baf56f25f218edaa6250d

23 months agoMerge "Fix type annotation of schema.MetaData.naming_convention" into main
mike bayer [Thu, 10 Aug 2023 15:34:49 +0000 (15:34 +0000)] 
Merge "Fix type annotation of schema.MetaData.naming_convention" into main

23 months agoMerge "Add where criteria example to selected_columns attribute" into main
mike bayer [Wed, 9 Aug 2023 23:38:27 +0000 (23:38 +0000)] 
Merge "Add where criteria example to selected_columns attribute" into main

23 months agoMerge "Fix annotations" into main
mike bayer [Wed, 9 Aug 2023 22:59:31 +0000 (22:59 +0000)] 
Merge "Fix annotations" into main

23 months agoAdd where criteria example to selected_columns attribute
Federico Caselli [Tue, 8 Aug 2023 19:41:29 +0000 (21:41 +0200)] 
Add where criteria example to selected_columns attribute

Change-Id: Ic9050dd846d5a3103aabe6c4d90e5bf2d7b8372d

23 months agoFix annotations
Mehdi Gmira [Mon, 7 Aug 2023 14:50:39 +0000 (10:50 -0400)] 
Fix annotations

Typing improvements:

* :class:`.CursorResult` is returned for some forms of
:meth:`_orm.Session.execute` where DML without RETURNING is used
* fixed type for :paramref:`_orm.Query.with_for_update.of` parameter within
:meth:`_orm.Query.with_for_update`
* improvements to ``_DMLColumnArgument`` type used by some DML methods to
pass column expressions
* Add overload to :func:`_sql.literal` so that it is inferred that the
return type is ``BindParameter[NullType]`` where
:paramref:`_sql.literal.type_` param is None
* Add overloads to :meth:`_sql.ColumnElement.op` so that the inferred
type when :paramref:`_sql.ColumnElement.op.return_type` is not provided
is ``Callable[[Any], BinaryExpression[Any]]``
* Add missing overload to :meth:`_sql.ColumnElement.__add__`

Pull request courtesy Mehdi Gmira.

Fixes: #9185
Closes: #10108
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10108
Pull-request-sha: 6017526c9cd1282025885cb002de1f984f64205b

Change-Id: I77a2a199b7a8b137b405001bef8813cf2d327bca

23 months agoFix type annotation of schema.MetaData.naming_convention
Federico Caselli [Mon, 7 Aug 2023 20:37:12 +0000 (22:37 +0200)] 
Fix type annotation of schema.MetaData.naming_convention

Fixed #9600
Closes: #9598
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9598
Pull-request-sha: d458e36242c60f44b1140697ae04cc8ad8ac5b98

Change-Id: I2290d1955c21f8d40765f78e486c739263f6e4ab

23 months agoMerge "Modernize Self-Referential example" into main
mike bayer [Tue, 8 Aug 2023 14:29:23 +0000 (14:29 +0000)] 
Merge "Modernize Self-Referential example" into main

23 months agoimplement RETURNING * for ORM DML
Mike Bayer [Mon, 7 Aug 2023 14:47:11 +0000 (10:47 -0400)] 
implement RETURNING * for ORM DML

Implemented the "RETURNING '*'" use case for ORM enabled DML statements.
This will render in as many cases as possible and return the unfiltered
result set, however is not supported for multi-parameter "ORM bulk INSERT"
statements that have specific column rendering requirements.

Fixes: #10192
Change-Id: I04297d08eacb9ad1d5fd6d9dd21afefb8e9dc0b1

23 months agoModernize Self-Referential example
Federico Caselli [Tue, 18 Jul 2023 18:18:47 +0000 (20:18 +0200)] 
Modernize Self-Referential example

References: #10115
Change-Id: Iee85b1277cdfee93ffb096df8ba85af48d09f1bc

23 months ago[docs] Typo: Update session_transaction.rst (#10185)
Gabriel Izoton [Fri, 4 Aug 2023 17:48:41 +0000 (14:48 -0300)] 
[docs] Typo: Update session_transaction.rst (#10185)

Fixed typo: `tranasction` -> `transaction`

23 months agoMerge "apply correct type to orm connection.execution_options" into main
mike bayer [Fri, 4 Aug 2023 14:59:06 +0000 (14:59 +0000)] 
Merge "apply correct type to orm connection.execution_options" into main

23 months agoapply correct type to orm connection.execution_options
Mike Bayer [Fri, 4 Aug 2023 00:14:39 +0000 (20:14 -0400)] 
apply correct type to orm connection.execution_options

Fixed issue in :class:`_orm.Session` and :class:`_asyncio.AsyncSession`
methods such as :meth:`_orm.Session.connection` where the
:paramref:`_orm.Session.connection.execution_options` parameter were
hardcoded to an internal type that is not user-facing.

Fixes: #10182
Change-Id: Iab9d510bf182c7dfc0521c948cf63396d05078e5

23 months agofix typo
Mike Bayer [Fri, 4 Aug 2023 14:01:07 +0000 (10:01 -0400)] 
fix typo

Change-Id: I55855508fdf7e0f0af346f4f1f79292d83784aea

23 months agoMerge "ensure collection adapter is serialized" into main
mike bayer [Thu, 3 Aug 2023 14:12:45 +0000 (14:12 +0000)] 
Merge "ensure collection adapter is serialized" into main

23 months agoupdate dogpile_caching examples
Mike Bayer [Thu, 3 Aug 2023 03:40:17 +0000 (23:40 -0400)] 
update dogpile_caching examples

Change-Id: I10e2b48afae01b65d61849841b528f1d275439ba

23 months agoensure collection adapter is serialized
Mike Bayer [Wed, 2 Aug 2023 17:34:03 +0000 (13:34 -0400)] 
ensure collection adapter is serialized

Fixed issue where dictionary-based collections such as
:func:`_orm.attribute_keyed_dict` did not fully pickle/unpickle correctly,
leading to issues when attempting to mutate such a collection after
unpickling.

Fixes: #10175
Change-Id: I1281f8695a0c95a20cab9449ee9c5d2db0d544fe

23 months agoMerge "`AsyncConnection[AsyncSession].aclose` implementation" into main
mike bayer [Tue, 1 Aug 2023 19:40:12 +0000 (19:40 +0000)] 
Merge "`AsyncConnection[AsyncSession].aclose` implementation" into main

23 months agoMerge "expand out all columns for _all_column_expressions" into main
mike bayer [Tue, 1 Aug 2023 18:35:43 +0000 (18:35 +0000)] 
Merge "expand out all columns for _all_column_expressions" into main

23 months agoexpand out all columns for _all_column_expressions
Mike Bayer [Mon, 31 Jul 2023 21:47:07 +0000 (17:47 -0400)] 
expand out all columns for _all_column_expressions

Fixed issue where the ORM's generation of a SELECT from a joined
inheritance model with same-named columns in superclass and subclass would
somehow not send the correct list of column names to the :class:`.CTE`
construct, when the RECURSIVE column list were generated.

Fixes: #10169
Change-Id: I531d9bb469443c077ee34cbc1eeb097ada46f20f

23 months ago`AsyncConnection[AsyncSession].aclose` implementation
semen603089 [Sat, 29 Jul 2023 03:09:20 +0000 (23:09 -0400)] 
`AsyncConnection[AsyncSession].aclose` implementation

Added new methods :meth:`_asyncio.AsyncConnection.aclose` as a synonym for
:meth:`_asyncio.AsyncConnection.close` and
:meth:`_asyncio.AsyncSession.aclose` as a synonym for
:meth:`_asyncio.AsyncSession.close` to the
:class:`_asyncio.AsyncConnection` and :class:`_asyncio.AsyncSession`
objects, to provide compatibility with Python standard library
``@contextlib.aclosing`` construct. Pull request courtesy Grigoriev Semyon.

Fixes: #9698
Closes: #10106
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10106
Pull-request-sha: 9dbe87324d496323f1da4a131b4c3d485a8eea1b

Change-Id: I861d1fd4586018c2bdd6b45d7918af4f7d48d193

23 months agopass along independent CTE attributes in ORM context
Mike Bayer [Mon, 31 Jul 2023 15:17:20 +0000 (11:17 -0400)] 
pass along independent CTE attributes in ORM context

Fixed issue where an ORM-enabled :func:`_sql.select` construct would not
render any CTEs added only via the :meth:`_sql.Select.add_cte` method that
were not otherwise referenced in the statement.

Fixes: #10167
Change-Id: Ib13f478607628b02742e6026e94bce54b089627d

23 months agoindicate pymssql as only binary
Mike Bayer [Mon, 31 Jul 2023 18:07:45 +0000 (14:07 -0400)] 
indicate pymssql as only binary

a new release of pymssql is out and they don't have wheel files,
so builds are failing.

we don't have deps set up to build pymssql, so hack into tox.ini
to force pip to only use a wheel.

additionally, add "py3" as a recognized target where we are referring
to specific py3 versions.

Change-Id: Id876fe902d4d7cae964a241c9fd7b678645b0ea5

23 months agoMerge "implement join_depth for immediateload, fix expunged loading" into main
mike bayer [Sat, 29 Jul 2023 03:08:44 +0000 (03:08 +0000)] 
Merge "implement join_depth for immediateload, fix expunged loading" into main