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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: I55855508fdf7e0f0af346f4f1f79292d83784aea

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

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

Change-Id: I10e2b48afae01b65d61849841b528f1d275439ba

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

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

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

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

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

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

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

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

2 years agodont rely on default_isolation_level to restore engine-level iso
Mike Bayer [Wed, 26 Jul 2023 16:10:48 +0000 (12:10 -0400)] 
dont rely on default_isolation_level to restore engine-level iso

Fixed critical issue where setting
:paramref:`_sa.create_engine.isolation_level` to ``AUTOCOMMIT`` (as opposed
to using the :meth:`_engine.Engine.execution_options` method) would fail to
restore "autocommit" to a pooled connection if an alternate isolation level
were temporarily selected using
:paramref:`_engine.Connection.execution_options.isolation_level`.

Fixes: #10147
Change-Id: Ia22c15ab460cbbf8f6a731660874ace10df7c6a6

2 years agoimplement join_depth for immediateload, fix expunged loading
Mike Bayer [Tue, 25 Jul 2023 15:26:03 +0000 (11:26 -0400)] 
implement join_depth for immediateload, fix expunged loading

Fixed issue where the ``lazy="immediateload"`` loader strategy would place
an internal loading token into the ORM mapped attribute under circumstances
where the load should not occur, such as in a recursive self-referential
load.   As part of this change, the ``lazy="immediateload"`` strategy now
honors the :paramref:`_orm.relationship.join_depth` parameter for
self-referential eager loads in the same way as that of other eager
loaders, where leaving it unset or set at zero will lead to a
self-referential immediateload not occurring, setting it to a value of one
or greater will immediateload up until that given depth.

Fixes: #10139
Change-Id: I319d8cd86d7dd57f8ba61a9d483dc84505e02c72

2 years agoMerge "have token load flatten aliases unconditionally" into main
mike bayer [Tue, 25 Jul 2023 23:35:30 +0000 (23:35 +0000)] 
Merge "have token load flatten aliases unconditionally" into main

2 years agohave token load flatten aliases unconditionally
Mike Bayer [Thu, 20 Jul 2023 17:06:22 +0000 (13:06 -0400)] 
have token load flatten aliases unconditionally

Fixed issue where chaining :func:`_orm.load_only` or other wildcard use of
:func:`_orm.defer` from another eager loader using a :func:`_orm.aliased`
against a joined inheritance subclass would fail to take effect for columns
local to the superclass.

Fixes: #10125
Change-Id: I15e4b8be5a6d2ba49d2354fcd1daa099d8c3498f

2 years agode-clone FROM objects placed into from_linter.froms
Mike Bayer [Thu, 20 Jul 2023 16:36:35 +0000 (12:36 -0400)] 
de-clone FROM objects placed into from_linter.froms

Fixed issue where internal cloning used by the ORM for expressions like
:meth:`_orm.relationship.Comparator.any` to produce correlated EXISTS
constructs would interfere with the "cartesian product warning" feature of
the SQL compiler, leading the SQL compiler to warn when all elements of the
statement were correctly joined.

Fixes: #10124
Change-Id: I31c1ba538e2b943278e8cc0b7fddc107968a0826

2 years agoupdate callcount for cython 3
Mike Bayer [Wed, 19 Jul 2023 15:44:28 +0000 (11:44 -0400)] 
update callcount for cython 3

Change-Id: Iffe36d61e4872d0c59690aa837fd32f98fa4c403

2 years agoBump pypa/cibuildwheel from 2.14.0 to 2.14.1 (#10112)
dependabot[bot] [Mon, 17 Jul 2023 19:31:37 +0000 (21:31 +0200)] 
Bump pypa/cibuildwheel from 2.14.0 to 2.14.1 (#10112)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.14.0 to 2.14.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.14.0...v2.14.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 agoSwitch badge provider (#10067)
Jeff Widman [Sun, 16 Jul 2023 09:19:31 +0000 (02:19 -0700)] 
Switch badge provider (#10067)

Switch badge provider to point at Pepy.tech which provides further stats on the downloads.

Also they use a blue color which better matches the blue color of the other badges. 😁

2 years agoVersion 2.0.20 placeholder
Mike Bayer [Sat, 15 Jul 2023 13:07:05 +0000 (09:07 -0400)] 
Version 2.0.20 placeholder

2 years ago- 2.0.19 rel_2_0_19
Mike Bayer [Sat, 15 Jul 2023 12:55:40 +0000 (08:55 -0400)] 
- 2.0.19

2 years agoMerge "Rename Row t and tuples with underscored versions." into main
mike bayer [Fri, 14 Jul 2023 21:25:18 +0000 (21:25 +0000)] 
Merge "Rename Row t and tuples with underscored versions." into main