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

2 years agoRename Row t and tuples with underscored versions.
Federico Caselli [Wed, 12 Jul 2023 20:58:24 +0000 (22:58 +0200)] 
Rename Row t and tuples with underscored versions.

Renamed :attr:`_result.Row.t` and :meth:`_result.Row.tuple` to
:attr:`_result.Row._t` and :meth:`_result.Row._tuple`; this is to suit the
policy that all methods and pre-defined attributes on :class:`.Row` should
be in the style of Python standard library ``namedtuple`` where all fixed
names have a leading underscore, to avoid name conflicts with existing
column names.   The previous method/attribute is now deprecated and will
emit a deprecation warning.

Fixes: #10093
Change-Id: Ibb0e9423b55590c9dda8ee554187abd9a9122590

2 years agotest for None plugin_subject
Mike Bayer [Fri, 14 Jul 2023 16:08:24 +0000 (12:08 -0400)] 
test for None plugin_subject

Fixed additional regression caused by :ticket:`9805` where more aggressive
propagation of the "ORM" flag on statements could lead to an internal
attribute error when embedding an ORM :class:`.Query` construct that
nonetheless contained no ORM entities within a Core SQL statement, in this
case ORM-enabled UPDATE and DELETE statements.

Fixes: #10098
Change-Id: Ieeca9c64c28049e22d558ca47a720dd8bbe1eec9

2 years agochangelog updates
Mike Bayer [Wed, 12 Jul 2023 18:57:50 +0000 (14:57 -0400)] 
changelog updates

Change-Id: I087cf07afc4a665fc129c86118370b875aaa3238

2 years agoMerge "Fix url.make_url" into main
mike bayer [Wed, 12 Jul 2023 18:53:56 +0000 (18:53 +0000)] 
Merge "Fix url.make_url" into main

2 years agoMerge "Minor docs changes" into main
mike bayer [Wed, 12 Jul 2023 18:31:09 +0000 (18:31 +0000)] 
Merge "Minor docs changes" into main

2 years agoMerge "fix typing issue in main" into main
mike bayer [Wed, 12 Jul 2023 18:27:49 +0000 (18:27 +0000)] 
Merge "fix typing issue in main" into main

2 years agoMerge "ensure CITEXT is not cast as VARCHAR" into main
mike bayer [Wed, 12 Jul 2023 18:21:05 +0000 (18:21 +0000)] 
Merge "ensure CITEXT is not cast as VARCHAR" into main

2 years agoFix url.make_url
semen603089 [Wed, 12 Jul 2023 17:56:03 +0000 (13:56 -0400)] 
Fix url.make_url

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

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

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

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [X] 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.
Fixes #10079
**Have a nice day!**

Closes: #10080
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10080
Pull-request-sha: 133c7d6c35a75f23089fd4b1c0438f1a4640a924

Change-Id: Ie3d998385743680756bc10fbb4f4227669d57648

2 years agofix typing issue in main
Mike Bayer [Wed, 12 Jul 2023 17:50:39 +0000 (13:50 -0400)] 
fix typing issue in main

this is failing on 3.8

Change-Id: If348e88f938e8a239278ef14afbc2cb36a59b35d

2 years agoensure CITEXT is not cast as VARCHAR
Mike Bayer [Wed, 12 Jul 2023 13:32:10 +0000 (09:32 -0400)] 
ensure CITEXT is not cast as VARCHAR

Fixed issue where comparisons to the :class:`_postgresql.CITEXT` datatype
would cast the right side to ``VARCHAR``, leading to the right side not
being interpreted as a ``CITEXT`` datatype, for the asyncpg, psycopg3 and
pg80000 dialects.   This led to the :class:`_postgresql.CITEXT` type being
essentially unusable for practical use; this is now fixed and the test
suite has been corrected to properly assert that expressions are rendered
correctly.

Fixes: #10096
Change-Id: I49129e50261cf09942c0c339d581ce17a26d8181

2 years agoMerge "Improved typing" into main
mike bayer [Wed, 12 Jul 2023 14:24:37 +0000 (14:24 +0000)] 
Merge "Improved typing" into main

2 years agoMerge "cascade fixes revealed by the removal of cascade_backrefs" into main
mike bayer [Wed, 12 Jul 2023 00:43:23 +0000 (00:43 +0000)] 
Merge "cascade fixes revealed by the removal of cascade_backrefs" into main

2 years agoImproved typing
Federico Caselli [Fri, 23 Jun 2023 18:09:29 +0000 (20:09 +0200)] 
Improved typing

- correctly inspect orm classes and instances
- add missing generics in run_sync on async connection and session
- minor fixes to relationship order params and shift overload

Change-Id: I9aebd3e1312bca855c8451ec0cc02a891983063f

2 years agoMinor docs changes
Federico Caselli [Sat, 1 Jul 2023 10:07:24 +0000 (12:07 +0200)] 
Minor docs changes

Change-Id: I15d8aa3d497ef1f8bb1a14f216d99e4ebc5713b1

2 years agocascade fixes revealed by the removal of cascade_backrefs
Mike Bayer [Tue, 11 Jul 2023 13:58:22 +0000 (09:58 -0400)] 
cascade fixes revealed by the removal of cascade_backrefs

Fixed issue where setting a relationship collection directly, where an
object in the new collection were already present, would not trigger a
cascade event for that object, leading to it not being added to the
:class:`_orm.Session` if it were not already present.  This is similar in
nature to :ticket:`6471` and is a more apparent issue due to the removal of
``cascade_backrefs`` in the 2.0 series.  The
:meth:`_orm.AttributeEvents.append_wo_mutation` event added as part of
:ticket:`6471` is now also emitted for existing members of a collection
that are present in a bulk set of that same collection.

Fixed issue where objects that were associated with an unloaded collection
via backref, but were not merged into the :class:`_orm.Session` due to the
removal of ``cascade_backrefs`` in the 2.0 series, would not emit a warning
that these objects were not being included in a flush, even though they
were pending members of the collection; in other such cases, a warning is
emitted when a collection being flushed contains non-attached objects which
will be essentially discarded.  The addition of the warning for
backref-pending collection members establishes greater consistency with
collections that may be present or non-present and possibly flushed or not
flushed at different times based on different relationship loading
strategies.

Fixes: #10089
Fixes: #10090
Change-Id: I95610c17745f32141475cc6b4a4a5c6fc678fd05

2 years agorevert incorrectly merged change from a4e6e13d87c
Mike Bayer [Tue, 11 Jul 2023 15:25:15 +0000 (11:25 -0400)] 
revert incorrectly merged change from a4e6e13d87c

Change-Id: I3200482b0c0088534b17715f8cc6fdf37e879074

2 years agoBump pypa/cibuildwheel from 2.13.1 to 2.14.0 (#10086)
dependabot[bot] [Mon, 10 Jul 2023 20:44:38 +0000 (22:44 +0200)] 
Bump pypa/cibuildwheel from 2.13.1 to 2.14.0 (#10086)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.13.1 to 2.14.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.13.1...v2.14.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 agoAdd rockset-sqlalchemy to external dialects (#10087)
Aarav Borthakur [Mon, 10 Jul 2023 20:40:52 +0000 (13:40 -0700)] 
Add rockset-sqlalchemy to external dialects (#10087)

2 years agoadd a note to contains_eager re: propcomparator.and_
Mike Bayer [Mon, 10 Jul 2023 13:41:45 +0000 (09:41 -0400)] 
add a note to contains_eager re: propcomparator.and_

Change-Id: I5555db3a0e94a92a15759f64b6298c4b2800d183
References: https://github.com/sqlalchemy/sqlalchemy/discussions/9898#discussioncomment-6404539

2 years agoMerge "fix ConnectArgsType tuple to be variable length" into main
mike bayer [Sat, 8 Jul 2023 19:56:16 +0000 (19:56 +0000)] 
Merge "fix ConnectArgsType tuple to be variable length" into main

2 years agofix ConnectArgsType tuple to be variable length
Mike Bayer [Mon, 3 Jul 2023 16:12:01 +0000 (12:12 -0400)] 
fix ConnectArgsType tuple to be variable length

Fixes: #10038
Change-Id: I391aae0c553c4ebcdd1d09fd9fd445f839fb9906

2 years agoif only one host and/or port in query string, never raise
Mike Bayer [Fri, 7 Jul 2023 20:50:26 +0000 (16:50 -0400)] 
if only one host and/or port in query string, never raise

silently ignore the host portion of the URL if host=xyz
is present, and document this.

Fixes: #10076
Change-Id: I370b138aec63a9a2aa6029fe9e66eb1659434a43

2 years agoensure unix path syntax works for asyncpg as well
Mike Bayer [Thu, 6 Jul 2023 22:01:25 +0000 (18:01 -0400)] 
ensure unix path syntax works for asyncpg as well

update for a2c06a2a0acf769060f11bb34c1b55cecae5f5fe

updates test suite to include direct expected data / errors in
the test data

Fixes: #10069
Change-Id: I1e689101b90b7469608b74ed37abd7c2122151a4

2 years agoFix indentation in reST directive title (#10060)
Lele Gaifax [Thu, 6 Jul 2023 20:34:57 +0000 (22:34 +0200)] 
Fix indentation in reST directive title (#10060)

2 years agomatch on single host/port only for integer port
Mike Bayer [Thu, 6 Jul 2023 14:06:14 +0000 (10:06 -0400)] 
match on single host/port only for integer port

Fixed regression caused by improvements to PostgreSQL URL parsing in
:ticket:`10004` where "host" query string arguments that had colons in
them, to support various third party proxy servers and/or dialects, would
not parse correctly as these were evaluted as ``host:port`` combinations.
Parsing has been updated to consider a colon as indicating a ``host:port``
value only if the hostname contains only alphanumeric characters with dots
or dashes only (e.g. no slashes), followed by exactly one colon followed by
an all-integer token of zero or more integers.  In all other cases, the
full string is taken as a host.

Fixes: #10069
Change-Id: I77beb27e44abc0a66aa0810de855daa4186dacfd

2 years agoVersion 2.0.19 placeholder
Mike Bayer [Wed, 5 Jul 2023 19:00:42 +0000 (15:00 -0400)] 
Version 2.0.19 placeholder

2 years ago- 2.0.18 rel_2_0_18
Mike Bayer [Wed, 5 Jul 2023 18:47:58 +0000 (14:47 -0400)] 
- 2.0.18

2 years agoMerge "add option to disable INET, CIDR result set conversion" into main
mike bayer [Wed, 5 Jul 2023 18:45:37 +0000 (18:45 +0000)] 
Merge "add option to disable INET, CIDR result set conversion" into main

2 years agoadd option to disable INET, CIDR result set conversion
Mike Bayer [Mon, 3 Jul 2023 17:28:35 +0000 (13:28 -0400)] 
add option to disable INET, CIDR result set conversion

Added new parameter ``native_inet_types=False`` to the all PostgreSQL
dialects, which indicates the all converters used by the DBAPI to
convert rows from PostgreSQL :class:`.INET` and :class:`.CIDR` columns
into Python ``ipaddress`` datatypes should be disabled, returning strings
instead.  This allows code written to work with strings for these datatypes
to be migrated to asyncpg, psycopg, or pg8000 without code changes
beyond the engine parameter.

Currently, some DBAPIs return ``ipaddress`` objects while others return
strings for one or both of these datatypes.   A future release of
SQLAlchemy will attempt to normalize support for Python's ``ipaddress``
across all DBAPIs.

Fixes: #9945
Change-Id: Id59e9982e2bfd6706fe335e4e700902abfb63663

2 years agoMerge "Type annotate postgresql/sqlite/mysql insert" into main
mike bayer [Wed, 5 Jul 2023 18:11:34 +0000 (18:11 +0000)] 
Merge "Type annotate postgresql/sqlite/mysql insert" into main

2 years agochangelog updates
Mike Bayer [Wed, 5 Jul 2023 18:03:21 +0000 (14:03 -0400)] 
changelog updates

Change-Id: I77f8a7d4c593168346b5b5251478ceaca7f77c82

2 years agocherry-pick changelog update for 1.4.50
Mike Bayer [Wed, 5 Jul 2023 17:56:42 +0000 (13:56 -0400)] 
cherry-pick changelog update for 1.4.50

2 years agocherry-pick changelog from 1.4.49
Mike Bayer [Wed, 5 Jul 2023 17:56:40 +0000 (13:56 -0400)] 
cherry-pick changelog from 1.4.49

2 years agochangelog updates
Mike Bayer [Wed, 5 Jul 2023 17:37:25 +0000 (13:37 -0400)] 
changelog updates

Change-Id: If3baf79906d062e1e046d7c31b38eeeefdc984bf

2 years agoRevert "Fix type signature on create_connect_args"
Mike Bayer [Wed, 5 Jul 2023 17:23:20 +0000 (13:23 -0400)] 
Revert "Fix type signature on create_connect_args"

this was not supposed to be committed

This reverts commit 86078b8948e83e442c1bd4a7a501767ec775ec54.

2 years agoFix type signature on create_connect_args
Alex Rothberg [Thu, 29 Jun 2023 18:54:52 +0000 (14:54 -0400)] 
Fix type signature on create_connect_args
Fixes: #10038
2 years agoMerge "add tests for #10058" into main
mike bayer [Wed, 5 Jul 2023 17:07:27 +0000 (17:07 +0000)] 
Merge "add tests for #10058" into main

2 years agoupdate mypy warnings / deprecation
Mike Bayer [Wed, 5 Jul 2023 14:01:46 +0000 (10:01 -0400)] 
update mypy warnings / deprecation

Change-Id: I655e78feabcb94f02e82c81d3902aea9704a0fd3

2 years agoadd tests for #10058
Mike Bayer [Wed, 5 Jul 2023 13:47:34 +0000 (09:47 -0400)] 
add tests for #10058

Fixes: #10058
Change-Id: I1f551c1f8cd398bd7dc946e1b1c8963b06806e66

2 years agoMerge "allow aliased() to receive any FromClause" into main
mike bayer [Wed, 5 Jul 2023 12:24:08 +0000 (12:24 +0000)] 
Merge "allow aliased() to receive any FromClause" into main

2 years agoallow aliased() to receive any FromClause
Mike Bayer [Tue, 4 Jul 2023 18:13:31 +0000 (14:13 -0400)] 
allow aliased() to receive any FromClause

Fixed some of the typing within the :func:`_orm.aliased` construct to
correctly accept a :class:`.Table` object that's been aliased with
:meth:`.Table.alias`, as well as general support for :class:`.FromClause`
objects to be passed as the "selectable" argument, since this is all
supported.

Change-Id: I6dfd5c93dc2b2f23895fbd8982633f2ed13b5a52
References: #10061

2 years agoMerge "Add mssql_columnstore to index options." into main
mike bayer [Tue, 4 Jul 2023 01:26:52 +0000 (01:26 +0000)] 
Merge "Add mssql_columnstore to index options." into main

2 years agoMerge "support sql elements via standalone op functions" into main
mike bayer [Mon, 3 Jul 2023 20:09:05 +0000 (20:09 +0000)] 
Merge "support sql elements via standalone op functions" into main

2 years agosupport sql elements via standalone op functions
Mike Bayer [Mon, 3 Jul 2023 16:04:01 +0000 (12:04 -0400)] 
support sql elements via standalone op functions

Improved typing when using standalone operator functions from
``sqlalchemy.sql.operators`` such as ``sqlalchemy.sql.operators.eq``.

Fixes: #10054
Change-Id: I7e39cb3ccddb354a3f04f749ef65b18088e136e1

2 years agoMerge "remove use of SQL expressions in "modifiers" for regexp" into main
mike bayer [Mon, 3 Jul 2023 16:06:44 +0000 (16:06 +0000)] 
Merge "remove use of SQL expressions in "modifiers" for regexp" into main

2 years agoremove weird TOC thing from assocaition proxy
Mike Bayer [Mon, 3 Jul 2023 14:53:28 +0000 (10:53 -0400)] 
remove weird TOC thing from assocaition proxy

I have no idea where this came from but it highlights all
the sections

Change-Id: Ib9f81740f84e3b3077b84aeeda2ae0f1e8b832d2

2 years agofor python 3.12, use greenlet>=3.0.0a1
Mike Bayer [Sun, 2 Jul 2023 22:27:11 +0000 (18:27 -0400)] 
for python 3.12, use greenlet>=3.0.0a1

in the 1.4 backport at I91a51dcbad2902f7c4c7cec88ebbf42c2417b512 we
see that the newly released greenlet 3.0.0a1 installs / builds for
python 3.12.

Change-Id: Ib9e1aec8168996324dbb97c9cdbe1bc34bda7485

2 years agochange gather orm example
Federico Caselli [Thu, 22 Jun 2023 20:09:23 +0000 (22:09 +0200)] 
change gather orm example

changed gather orm example to avoid passing the same session to the
function called in the gather. While this is not an issue since no
sql is executed on it, it's still confusing for some users

References: #9312
Change-Id: I7f86e9c1640649ac13fd459b761d67718d4c3dc0

2 years agoremove use of SQL expressions in "modifiers" for regexp
Mike Bayer [Fri, 30 Jun 2023 14:14:55 +0000 (10:14 -0400)] 
remove use of SQL expressions in "modifiers" for regexp

Fixed issue where the :meth:`_sql.ColumnOperators.regexp_match`
when using "flags" would not produce a "stable" cache key, that
is, the cache key would keep changing each time causing cache pollution.
The same issue existed for :meth:`_sql.ColumnOperators.regexp_replace`
with both the flags and the actual replacement expression.
The flags are now represented as fixed modifier strings rendered as
safestrings rather than bound parameters, and the replacement
expression is established within the primary portion of the "binary"
element so that it generates an appropriate cache key.

Note that as part of this change, the
:paramref:`_sql.ColumnOperators.regexp_match.flags` and
:paramref:`_sql.ColumnOperators.regexp_replace.flags` have been modified to
render as literal strings only, whereas previously they were rendered as
full SQL expressions, typically bound parameters.   These parameters should
always be passed as plain Python strings and not as SQL expression
constructs; it's not expected that SQL expression constructs were used in
practice for this parameter, so this is a backwards-incompatible change.

The change also modifies the internal structure of the expression
generated, for :meth:`_sql.ColumnOperators.regexp_replace` with or without
flags, and for :meth:`_sql.ColumnOperators.regexp_match` with flags. Third
party dialects which may have implemented regexp implementations of their
own (no such dialects could be located in a search, so impact is expected
to be low) would need to adjust the traversal of the structure to
accommodate.

Fixed issue in mostly-internal :class:`.CacheKey` construct where the
``__ne__()`` operator were not properly implemented, leading to nonsensical
results when comparing :class:`.CacheKey` instances to each other.

Fixes: #10042
Change-Id: I2e245f81d7ee7136ad04cf77be35f9745c5da5e5

2 years agoType annotate postgresql/sqlite/mysql insert
Mehdi Gmira [Wed, 28 Jun 2023 13:52:39 +0000 (09:52 -0400)] 
Type annotate postgresql/sqlite/mysql insert

### Description
The goal is to annotate postgresql specific apis that are under postgresql/dml.py file.
I've looked around to see what types are used for similar apis, hope I got it right :)

### Checklist

This pull request is:

- [x] A documentation / typographical 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: #10021
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10021
Pull-request-sha: 0562f093974520b162de31e8473a4d4d6656d529

Change-Id: I142f8929505c0263fcf45072d888df7ae81e6e85

2 years agoAllow reflecting UUID in MariaDB
krzysdz [Thu, 29 Jun 2023 22:00:55 +0000 (18:00 -0400)] 
Allow reflecting UUID in MariaDB

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

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

Added the `"uuid"` key to `ischema_names` to enable lookup of `UUID` columns in reflection. There's also a new short test (MariaDB 10.7+ only) in the mysql reflection tests to verify if this feature works correctly.

Fixes #10028

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

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] 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: #10029
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10029
Pull-request-sha: 7c2838b1dd5a34166158f5e241af72a6d3d8be85

Change-Id: Ifa1f51f472809b35374a7e2c6b85412046133452

2 years agoAdd mssql_columnstore to index options.
Federico Caselli [Wed, 28 Jun 2023 22:25:30 +0000 (00:25 +0200)] 
Add mssql_columnstore to index options.

Added support for creation and reflection of COLUMNSTORE
indexes in MSSQL dialect. Can be specified on indexes
specifying ``mssql_columnstore=True``.

Fixes: #7340
Change-Id: Ieb485b5c95b5c65b5b9f07fa7337eee3df545f95

2 years agoFix mypy tests on python 3.8
Federico Caselli [Thu, 29 Jun 2023 19:54:26 +0000 (21:54 +0200)] 
Fix mypy tests on python 3.8

Change-Id: I018b7be48511d8c749c25ef20e2ff1f92e02fc48

2 years agoFeature asyncpg dialect doesn't support mutlihost connection string
Ilia Dmitriev [Wed, 28 Jun 2023 19:20:28 +0000 (15:20 -0400)] 
Feature asyncpg dialect doesn't support mutlihost connection string

Added multi-host support for the asyncpg dialect.  General improvements and
error checking added to the PostgreSQL URL routines for the "multihost" use
case added as well.  Pull request courtesy Ilia Dmitriev.

Fixes: #10004
Closes: #10005
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10005
Pull-request-sha: 94bba62774377fd1654296c7ca4fe5114f75fcf5

Change-Id: I68f5bdfe98531dffe06fa998f8b7471af1426a33

2 years agoMerge "Improve typing tests" into main
mike bayer [Wed, 28 Jun 2023 02:55:19 +0000 (02:55 +0000)] 
Merge "Improve typing tests" into main

2 years agoImprove typing tests
Federico Caselli [Fri, 23 Jun 2023 17:58:54 +0000 (19:58 +0200)] 
Improve typing tests

Extract a fixture to run mypy on files
Move the plain files to test/typing
Move test files from stubs repository
Transform the fixture module in a package

Change-Id: I23acaecb84e7c4b9010259d44395dc1df83a9385

2 years agoMerge "accomodate schema translate keys present or not present" into main
mike bayer [Tue, 27 Jun 2023 17:33:15 +0000 (17:33 +0000)] 
Merge "accomodate schema translate keys present or not present" into main

2 years agoaccomodate schema translate keys present or not present
Mike Bayer [Tue, 27 Jun 2023 14:17:36 +0000 (10:17 -0400)] 
accomodate schema translate keys present or not present

Adjusted the :paramref:`_sa.create_engine.schema_translate_map` feature
such that **all** schema names in the statement are now tokenized,
regardless of whether or not a specific name is in the immediate schema
translate map given, and to fallback to substituting the original name when
the key is not in the actual schema translate map at execution time.  These
two changes allow for repeated use of a compiled object with schema
schema_translate_maps that include or dont include various keys on each
run, allowing cached SQL constructs to continue to function at runtime when
schema translate maps with different sets of keys are used each time. In
addition, added detection of schema_translate_map dictionaries which gain
or lose a ``None`` key across calls for the same statement, which affects
compilation of the statement and is not compatible with caching; an
exception is raised for these scenarios.

Fixes: #10025
Change-Id: I6f5e0c8e067d1702a3647b6251af483669ad854b

2 years agoFix SQL syntax for CAST with explicit collation
Gord Thompson [Sat, 24 Jun 2023 22:05:42 +0000 (16:05 -0600)] 
Fix SQL syntax for CAST with explicit collation

Fixes: #9932
Change-Id: I557e00cfc0725e2f247103dea484a7e818592f7f

2 years agoadd option to create scalar object on none attribute set
Mike Bayer [Sat, 24 Jun 2023 01:57:41 +0000 (21:57 -0400)] 
add option to create scalar object on none attribute set

Added new option to :func:`.association_proxy`
:paramref:`.association_proxy.create_on_none_assignment`; when an
association proxy which refers to a scalar relationship is assigned the
value ``None``, and the referenced object is not present, a new object is
created via the creator.  This was apparently an undefined behavior in the
1.2 series that was silently removed.

Fixes: #10013
Change-Id: I3aae484b8cf5218588b1db63e691cd86214fbbad

2 years agoVersion 2.0.18 placeholder
Mike Bayer [Fri, 23 Jun 2023 15:00:47 +0000 (11:00 -0400)] 
Version 2.0.18 placeholder

2 years ago- 2.0.17 rel_2_0_17
Mike Bayer [Fri, 23 Jun 2023 14:47:57 +0000 (10:47 -0400)] 
- 2.0.17

2 years agoadd explicit warning re: mapped_column.default
Mike Bayer [Fri, 23 Jun 2023 14:45:12 +0000 (10:45 -0400)] 
add explicit warning re: mapped_column.default

Change-Id: I3ac7133323a02cb70e20de2fd96cc31842ead4f1
References: #9936
References: #10009

2 years agoMerge "expand "is_unnatural" to include all mapper inheritance paths" into main
mike bayer [Fri, 23 Jun 2023 13:59:12 +0000 (13:59 +0000)] 
Merge "expand "is_unnatural" to include all mapper inheritance paths" into main

2 years agoexpand "is_unnatural" to include all mapper inheritance paths
Mike Bayer [Thu, 22 Jun 2023 22:11:07 +0000 (18:11 -0400)] 
expand "is_unnatural" to include all mapper inheritance paths

Fixed issue in ORM loader strategy logic which further allows for long
chains of :func:`_orm.contains_eager` loader options across complex
inheriting polymorphic / aliased / of_type() relationship chains to take
proper effect in queries.

Fixes: #10006
Change-Id: If803a7709ba8fd341fedb3b9282e0930c95fb5cd

2 years agofix typo (#9996)
Seonbeom Kim [Thu, 22 Jun 2023 19:30:07 +0000 (04:30 +0900)] 
fix typo (#9996)

onpudate -> onupdate when onupdate is None

2 years agoqualify mypy1.4 update for python 3.9, 3.10 +
Mike Bayer [Wed, 21 Jun 2023 18:59:21 +0000 (14:59 -0400)] 
qualify mypy1.4 update for python 3.9, 3.10 +

in I68084199858e9da901641d6036780437bcf5f2d6 we added a mypy1.4
check to check for new-style type messages.  mypy only
does lowercase types on python 3.9 and above, OR syntax on 3.10
and above.  qualify these both

Change-Id: Ic1ee12927ae02c1936d1c2905db28b587c7fece7

2 years agoMerge "add correct descriptor methods to dynamic/writeonly" into main
mike bayer [Wed, 21 Jun 2023 17:57:15 +0000 (17:57 +0000)] 
Merge "add correct descriptor methods to dynamic/writeonly" into main

2 years agoadd correct descriptor methods to dynamic/writeonly
Mike Bayer [Tue, 20 Jun 2023 14:11:14 +0000 (10:11 -0400)] 
add correct descriptor methods to dynamic/writeonly

Fixed typing issue which prevented :class:`_orm.WriteOnlyMapped` and
:class:`_orm.DynamicMapped` attributes from being used fully within ORM
queries.

Fixes: #9985
Change-Id: I33eef4d06fc84e85f2ea1a997a017ffce47df7d6

2 years agotrack state change within _connection_for_bind()
Mike Bayer [Mon, 19 Jun 2023 15:54:35 +0000 (11:54 -0400)] 
track state change within _connection_for_bind()

Additional hardening and documentation for the ORM :class:`_orm.Session`
"state change" system, which detects concurrent use of
:class:`_orm.Session` and :class:`_asyncio.AsyncSession` objects; an
additional check is added within the process to acquire connections from
the underlying engine, which is a critical section with regards to internal
connection management.

Change-Id: I6893c53e016218ff6cfb39709179ca4bf73a2414
Fixes: #9973
2 years agoupdates for mypy 1.4
Mike Bayer [Tue, 20 Jun 2023 19:24:38 +0000 (15:24 -0400)] 
updates for mypy 1.4

mypy 1.4 is reporting new style types list[], tuple[], etc.
as well as "x | None" for optional.

they also added one argument for format_type().

This is for 1.4 backport as well

Change-Id: I68084199858e9da901641d6036780437bcf5f2d6

2 years agoTyping: url in create_mock_engine can be a string (#9980)
Shadab Zafar [Tue, 20 Jun 2023 18:51:19 +0000 (00:21 +0530)] 
Typing: url in create_mock_engine can be a string (#9980)

* Typing: url in create_mock_engine can be a string

Similar to create_engine

* run back on the code

Change-Id: Ie92aaa121e587c93f2d9c0b8c06f194685bb070e

---------

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
2 years agofix typo in validates docs (#9983)
Federico Caselli [Tue, 20 Jun 2023 17:52:06 +0000 (19:52 +0200)] 
fix typo in validates docs (#9983)

2 years agopg8000: Support range and multirange types
Tony Locke [Mon, 19 Jun 2023 20:32:18 +0000 (16:32 -0400)] 
pg8000: Support range and multirange types

The pg8000 dialect now supports RANGE and MULTIRANGE datatypes, using the
existing RANGE API described at :ref:`postgresql_ranges`.  Range and
multirange types are supported in the pg8000 driver from version 1.29.8.
Pull request courtesy Tony Locke.

Fixes: #9965
Closes: #9966
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9966
Pull-request-sha: b48dc3ef9cbb267fe945d08ca38240c68b716f79

Change-Id: I61778fe35f9edbf93f440136e6667847bcec4b9c

2 years agoMerge "default Enum name to None and don't remove given name" into main
mike bayer [Mon, 19 Jun 2023 14:31:53 +0000 (14:31 +0000)] 
Merge "default Enum name to None and don't remove given name" into main

2 years agodefault Enum name to None and don't remove given name
Mike Bayer [Thu, 15 Jun 2023 22:34:57 +0000 (18:34 -0400)] 
default Enum name to None and don't remove given name

Fixed issue in support for the :class:`.Enum` datatype in the
:paramref:`_orm.registry.type_annotation_map` first added as part of
:ticket:`8859` where using a custom :class:`.Enum` with fixed configuration
in the map would fail to transfer the :paramref:`.Enum.name` parameter,
which among other issues would prevent PostgreSQL enums from working if the
enum values were passed as individual values.  Logic has been updated so
that "name" is transferred over, but also that the default :class:`.Enum`
which is against the plain Python `enum.Enum` class or other "empty" enum
won't set a hardcoded name of ``"enum"`` either.

Fixes: #9963
Change-Id: I36526dcb5443579fcd604b0c02bd1f02ca85a977

2 years agofix typo: `async_attrs` to `awaitable_attrs` (#9961)
Alc-Alc [Sat, 17 Jun 2023 09:59:48 +0000 (15:29 +0530)] 
fix typo: `async_attrs` to `awaitable_attrs` (#9961)

Co-authored-by: Alc <alc@localhost>
2 years agoMerge "improve support for declared_attr returning ORMDescriptor" into main
mike bayer [Fri, 16 Jun 2023 12:20:09 +0000 (12:20 +0000)] 
Merge "improve support for declared_attr returning ORMDescriptor" into main

2 years agoimprove support for declared_attr returning ORMDescriptor
Mike Bayer [Thu, 15 Jun 2023 13:18:38 +0000 (09:18 -0400)] 
improve support for declared_attr returning ORMDescriptor

Fixed issue in ORM Annotated Declarative which prevented a
:class:`_orm.declared_attr` with or without
:attr:`_orm.declared_attr.directive` from being used on a mixin which did
not return a :class:`.Mapped` datatype, and instead returned a supplemental
ORM datatype such as :class:`.AssociationProxy`.  The Declarative runtime
would erroneously try to interpret this annotation as needing to be
:class:`.Mapped` and raise an error.

Fixed typing issue where using the :class:`.AssociationProxy` return type
from a :class:`_orm.declared_attr` function was disallowed.

Fixes: #9957
Change-Id: I797c5bbdb3d1e81a04ed21c6558ec349b970476f

2 years agoMerge "warn for other mapper property objects assigned twice" into main
mike bayer [Thu, 15 Jun 2023 14:35:33 +0000 (14:35 +0000)] 
Merge "warn for other mapper property objects assigned twice" into main

2 years agowarn for other mapper property objects assigned twice
Mike Bayer [Wed, 14 Jun 2023 14:51:43 +0000 (10:51 -0400)] 
warn for other mapper property objects assigned twice

was already in place for columns via other means

A warning is emitted when an ORM :func:`_orm.relationship` and other
:class:`.MapperProperty` objects are assigned to two different class
attributes at once; only one of the attributes will be mapped.  A warning
for this condition was already in place for :class:`_schema.Column` and
:class:`_orm.mapped_column` objects.

Fixes: #3532
Change-Id: Ib8057bdf229aa92137f9b8f61b26d4008181ead6

2 years agoMerge "Fixed regression with callables as daclasses defaults" into main
mike bayer [Wed, 14 Jun 2023 12:57:08 +0000 (12:57 +0000)] 
Merge "Fixed regression with callables as daclasses defaults" into main

2 years agoFixed regression with callables as daclasses defaults
Federico Caselli [Mon, 12 Jun 2023 20:55:15 +0000 (22:55 +0200)] 
Fixed regression with callables as daclasses defaults

Fixed regression introduced in 2.0.16 by :ticket:`9879` where passing a
callable to the :paramref:`_orm.mapped_column.default` parameter of
:class:`_orm.mapped_column` while also setting ``init=False`` would
interpret this value as a Dataclass default value which would be assigned
directly to new instances of the object directly, bypassing the default
generator taking place as the as the :paramref:`_schema.Column.default`
value generator on the underlying :class:`_schema.Column`.  This condition
is now detected so that the previous behavior is maintained, however a
deprecation warning for this ambiguous use is emitted; to populate the
default generator for a :class:`_schema.Column`, the
:paramref:`_orm.mapped_column.insert_default` parameter should be used,
which disambiguates from the :paramref:`_orm.mapped_column.default`
parameter whose name is fixed as per pep-681.

Fixes: #9936
Change-Id: I7e2c1c723e4711ec470336fcb4867f41c40f9d6b

2 years agofix typo in sphinx target introduced in bd290c4329b80c85475c6a76eec2fd6574f9781f
Federico Caselli [Tue, 13 Jun 2023 19:19:51 +0000 (21:19 +0200)] 
fix typo in sphinx target introduced in bd290c4329b80c85475c6a76eec2fd6574f9781f

Change-Id: Ie085696fca3ce44ad7af611246fc8be45abbc433

2 years agoMerge "various minor docs improvements" into main
mike bayer [Tue, 13 Jun 2023 13:54:50 +0000 (13:54 +0000)] 
Merge "various minor docs improvements" into main

2 years agoMerge branch 'origin/main'
Federico Caselli [Mon, 12 Jun 2023 22:32:23 +0000 (00:32 +0200)] 
Merge branch 'origin/main'

Change-Id: I6f3e8bbce3867bc44db9e45216876615210c1dfb

2 years agoadd 3.12 ci gate to github workflow
Federico Caselli [Mon, 22 May 2023 19:54:47 +0000 (21:54 +0200)] 
add 3.12 ci gate to github workflow

Change-Id: Id05669b22761acf36953aa1c89ee06d990ff3179

2 years agovarious minor docs improvements
Federico Caselli [Mon, 12 Jun 2023 20:08:19 +0000 (22:08 +0200)] 
various minor docs improvements

Change-Id: I5e7332047c03260792bf990aafd0ef4e15f5f082

2 years agoBump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#9938)
dependabot[bot] [Mon, 12 Jun 2023 20:11:32 +0000 (22:11 +0200)] 
Bump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#9938)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.13.0 to 2.13.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.13.0...v2.13.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 agoMerge "Align `AsyncSession` method annotations with `Session` equivalents" into main
Federico Caselli [Mon, 12 Jun 2023 20:10:57 +0000 (20:10 +0000)] 
Merge "Align `AsyncSession` method annotations with `Session` equivalents" into main

2 years agoAdd `_WILDCARD_TOKEN` special case in `_chop_path`
Matthew Martin [Sun, 11 Jun 2023 14:00:22 +0000 (10:00 -0400)] 
Add `_WILDCARD_TOKEN` special case in `_chop_path`

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

Add special case to `_chop_path` for initial `_WILDCARD_TOKEN` matching `_DEFAULT_TOKEN` to allow for a top level `undefer_group` load option with other load options. Fixes #9870.

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

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] 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: #9931
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9931
Pull-request-sha: c073f0904f12909ff660beef6576f6476a725592

Change-Id: Ic1158b3b0306e9a1bba86ab0b9f07700a6352398

2 years agoAlign `AsyncSession` method annotations with `Session` equivalents
Janek Nouvertné [Sun, 11 Jun 2023 10:07:26 +0000 (06:07 -0400)] 
Align `AsyncSession` method annotations with `Session` equivalents

Fixes a few differences in the parameter signatures of `asyncio.ext.AsyncSession` that were misaligned with `orm.Session`. Fixes #9925

### Description

- Change the annotation of the `params` parameter of `.scalar`, `.scalars` and `.stream_scalars` from `_CoreSingleExecuteParams` to `_CoreAnyExecuteParams`
- Add named keyword arguments `bind_arguments` and `execution_options` to `.connection`

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

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] 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: #9929
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9929
Pull-request-sha: 481f3ad94efab14f7a63a38c195810811b7ed90f

Change-Id: I84c5a68f5d95c903dd64928a23ad0cb796df778c

2 years agoVersion 2.0.17 placeholder
Mike Bayer [Sat, 10 Jun 2023 20:04:09 +0000 (16:04 -0400)] 
Version 2.0.17 placeholder

2 years ago- 2.0.16 rel_2_0_16
Mike Bayer [Sat, 10 Jun 2023 19:42:45 +0000 (15:42 -0400)] 
- 2.0.16

2 years agochangelog improvements
Mike Bayer [Sat, 10 Jun 2023 19:40:48 +0000 (15:40 -0400)] 
changelog improvements

Change-Id: Ic55b5ffd3aa5af803041fc0918e087499a798b40

2 years agodoc: Update connection example (#9926)
Inada Naoki [Sat, 10 Jun 2023 18:34:07 +0000 (03:34 +0900)] 
doc: Update connection example (#9926)

Row object is now namedtuple-like.

2 years agoMerge "feat: add `async_creator` argument to `create_async_engine`" into main
mike bayer [Fri, 9 Jun 2023 20:08:39 +0000 (20:08 +0000)] 
Merge "feat: add `async_creator` argument to `create_async_engine`" into main