]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
14 months agosetup JoinedDispatch to support pickling
Mike Bayer [Tue, 7 May 2024 22:03:51 +0000 (18:03 -0400)] 
setup JoinedDispatch to support pickling

Fixed issue where a :class:`.MetaData` collection would not be
serializable, if an :class:`.Enum` or :class:`.Boolean` datatype were
present which had been adapted. This specific scenario in turn could occur
when using the :class:`.Enum` or :class:`.Boolean` within ORM Annotated
Declarative form where type objects frequently get copied.

Fixes: #11365
Change-Id: Iaaa64baad79c41075d37cf53dade744d79e600a3

14 months agoAdd name parameter to with_polymorphic.
Federico Caselli [Mon, 6 May 2024 21:10:46 +0000 (23:10 +0200)] 
Add name parameter to with_polymorphic.

Added missing parameter :paramref:`_orm.with_polymorphic.name` that
allows specifying the name of returned :class:`_orm.AliasedClass`.

Fixes: #11361
Change-Id: I1eae550452526d85da1377207c5fa5e93ac673c3

15 months agocherry-pick changelog update for 2.0.31
Mike Bayer [Sun, 5 May 2024 18:04:18 +0000 (14:04 -0400)] 
cherry-pick changelog update for 2.0.31

15 months agocherry-pick changelog from 2.0.30
Mike Bayer [Sun, 5 May 2024 18:04:18 +0000 (14:04 -0400)] 
cherry-pick changelog from 2.0.30

15 months agotypo fixes
Mike Bayer [Sun, 5 May 2024 17:15:57 +0000 (13:15 -0400)] 
typo fixes

Change-Id: I8f3a1d755d03e6c11fa1f783f111977b7ddc22fb

15 months agoMerge "Updated typing for self_group()" into main
Michael Bayer [Sun, 5 May 2024 15:43:08 +0000 (15:43 +0000)] 
Merge "Updated typing for self_group()" into main

15 months agoMerge "Add overload for ColumnCollection.get(col, default)" into main
Michael Bayer [Sun, 5 May 2024 15:32:04 +0000 (15:32 +0000)] 
Merge "Add overload for ColumnCollection.get(col, default)" into main

15 months agorevise approach for bundle deduping
Mike Bayer [Sat, 4 May 2024 14:38:48 +0000 (10:38 -0400)] 
revise approach for bundle deduping

Revise the approach from 7d6d7ef73 to make a special case for
Bundle-targeted columns entirely, and don't involve the
_label_convention() callable.   Add tests for select() with
tablename labeling convention.

Fixes: #11347
Change-Id: I1d15523de5709d45b2b69bc17724831ac3425791

15 months agoAdd overload for ColumnCollection.get(col, default)
Mark Elliot [Mon, 29 Apr 2024 21:50:10 +0000 (17:50 -0400)] 
Add overload for ColumnCollection.get(col, default)

### Description
Fixes #11328 by adding an overload to ColumnCollection when a non-None default is provided.

### Checklist
This pull request is:

- [ ] A documentation / typographical / small typing 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.

Closes: #11329
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11329
Pull-request-sha: 32db849e0df1db357df79df3a0dc2263a755d04e

Change-Id: I8bef91c423fb7048ec8d4a7c99f70f0b1588c37a

15 months agoUpdated typing for self_group()
Federico Caselli [Sat, 4 May 2024 09:23:52 +0000 (11:23 +0200)] 
Updated typing for self_group()

Fixes: #10939
Closes: #11037
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11037
Pull-request-sha: 3ebf4db506ffef629f938f4f36fc76d6671b98e1

Change-Id: I22218286b0dac7bafaaf6955557e25f99a6aefe1

15 months agoMerge "disable col deduping inside of Bundle" into main
Federico Caselli [Sat, 4 May 2024 08:10:51 +0000 (08:10 +0000)] 
Merge "disable col deduping inside of Bundle" into main

15 months agoBump pypa/cibuildwheel from 2.16.5 to 2.17.0 (#11148)
dependabot[bot] [Sat, 4 May 2024 08:09:30 +0000 (10:09 +0200)] 
Bump pypa/cibuildwheel from 2.16.5 to 2.17.0 (#11148)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.16.5 to 2.17.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.16.5...v2.17.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>
15 months agoUpdate index.rst to include MariaDB (#11337)
Robert Silén [Sat, 4 May 2024 08:06:32 +0000 (11:06 +0300)] 
Update index.rst to include MariaDB (#11337)

Changing title of link to "dialects/mysql" to read "MySQL and MariaDB" to match the actual title of the page. (before link says just MySQL)

15 months agoMerge "improve pep-695 inference including Enum support" into main
Federico Caselli [Sat, 4 May 2024 07:31:06 +0000 (07:31 +0000)] 
Merge "improve pep-695 inference including Enum support" into main

15 months agocorrectly apply _set_binops_check_strict to AssociationProxy
Mike Bayer [Thu, 2 May 2024 23:05:08 +0000 (19:05 -0400)] 
correctly apply _set_binops_check_strict to AssociationProxy

Revised the set "binary" operators for the association proxy ``set()``
interface to correctly raise ``TypeError`` for invalid use of the ``|``,
``&``, ``^``, and ``-`` operators, as well as the in-place mutation
versions of these methods, to match the behavior of standard Python
``set()`` as well as SQLAlchemy ORM's "intstrumented" set implementation.

Fixes: #11349
Change-Id: I02442f8885107d115b7ecfa1ca716835a55d4db3

15 months agoMerge "ensure result_map objects collection is non-empty" into main
Michael Bayer [Thu, 2 May 2024 22:54:52 +0000 (22:54 +0000)] 
Merge "ensure result_map objects collection is non-empty" into main

15 months agoimprove pep-695 inference including Enum support
Alc-Alc [Thu, 25 Apr 2024 19:42:34 +0000 (15:42 -0400)] 
improve pep-695 inference including Enum support

Fixed issue in ORM Annotated Declarative where typing issue where literals
defined using :pep:`695` type aliases would not work with inference of
:class:`.Enum` datatypes. Pull request courtesy of Alc-Alc.

Fixes: #11305
Closes: #11313
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11313
Pull-request-sha: 090f0d865c4129cffffbce6a6ce3db9b91602460

Change-Id: Iac63302ad74fd7018a34a50c80ec3aeb87dc94a4

15 months agoMerge "Improve typing to the count function." into main
Michael Bayer [Thu, 2 May 2024 22:34:46 +0000 (22:34 +0000)] 
Merge "Improve typing to the count function." into main

15 months agodisable col deduping inside of Bundle
Mike Bayer [Thu, 2 May 2024 15:45:31 +0000 (11:45 -0400)] 
disable col deduping inside of Bundle

Fixed issue where attribute key names in :class:`_orm.Bundle` would not be
correct when using ORM enabled :class:`_sql.select` vs.
:class:`_orm.Query`, when the statement contained duplicate column names.

Fixed issue in typing for :class:`_orm.Bundle` where creating a nested
:class:`_orm.Bundle` structure were not allowed.

Fixes: #11347
Change-Id: I24b37c99f83068c668736caaaa06e69a6801ff50

15 months agoMerge "Ignore all dunders when checking attributes in `sqlalchemy.util.langhelpers...
Michael Bayer [Wed, 1 May 2024 15:51:29 +0000 (15:51 +0000)] 
Merge "Ignore all dunders when checking attributes in `sqlalchemy.util.langhelpers.TypingOnly`" into main

15 months agoensure result_map objects collection is non-empty
Mike Bayer [Tue, 30 Apr 2024 19:41:04 +0000 (15:41 -0400)] 
ensure result_map objects collection is non-empty

Fixed issue in cursor handling which affected handling of duplicate
:class:`_sql.Column` or similar objcts in the columns clause of
:func:`_sql.select`, both in combination with arbitary :func:`_sql.text()`
clauses in the SELECT list, as well as when attempting to retrieve
:meth:`_engine.Result.mappings` for the object, which would lead to an
internal error.

Fixes: #11306
Change-Id: I418073b2fdba86b2121b6d00eaa40b1805b69bb8

15 months agoMerge "only consider column / relationship attrs for subclass IN" into main
Michael Bayer [Tue, 30 Apr 2024 16:15:46 +0000 (16:15 +0000)] 
Merge "only consider column / relationship attrs for subclass IN" into main

15 months agoMerge "Fix issue in bulk_save_objects" into main
Michael Bayer [Tue, 30 Apr 2024 16:14:44 +0000 (16:14 +0000)] 
Merge "Fix issue in bulk_save_objects" into main

15 months agoIgnore all dunders when checking attributes in `sqlalchemy.util.langhelpers.TypingOnly`
Edgar Ramírez-Mondragón [Tue, 30 Apr 2024 01:53:07 +0000 (21:53 -0400)] 
Ignore all dunders when checking attributes in `sqlalchemy.util.langhelpers.TypingOnly`

Fixed an internal class that was testing for unexpected attributes to work
correctly under upcoming Python 3.13.   Pull request courtesy Edgar
Ramírez-Mondragón.

Fixes: #11334
Closes: #11335
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11335
Pull-request-sha: babd703e6e34b93722a54c3adf13aa792d3a03b3

Change-Id: Ia2e7392c9403e25266c7d30b987b577f49d008c0

15 months agoset unique=False on indexes
Mike Bayer [Tue, 30 Apr 2024 13:28:07 +0000 (09:28 -0400)] 
set unique=False on indexes

References: https://github.com/sqlalchemy/sqlalchemy/discussions/11339
Change-Id: Ia4adc2d5911926fdd1896cc561d511bdd647732d

15 months agoFix issue in bulk_save_objects
Federico Caselli [Sun, 28 Apr 2024 10:01:05 +0000 (12:01 +0200)] 
Fix issue in bulk_save_objects

Fixes issue in :meth:`_orm.Session.bulk_save_objects()` where it would write a
wrong identity key when using ``return_defaults=True``.
The wrong identity key could lead to an index error when entities are then pickled.

Fixes: #11332
Change-Id: I8d095392ad03e8d3408e477476cd5de8a5bca2c0

15 months agoMerge "improve fetchmany performance when using deque" into main
Michael Bayer [Mon, 29 Apr 2024 14:08:57 +0000 (14:08 +0000)] 
Merge "improve fetchmany performance when using deque" into main

15 months agoonly consider column / relationship attrs for subclass IN
Mike Bayer [Sun, 28 Apr 2024 17:39:08 +0000 (13:39 -0400)] 
only consider column / relationship attrs for subclass IN

Fixed issue in  :func:`_orm.selectin_polymorhpic` loader option where
attributes defined with :func:`_orm.composite` on a superclass would cause
an internal exception on load.

Define the prop for :class:`.PropRegistry` as a
:class:`.StrategizedProperty`; we dont make path registries for
descriptor props like synonyms, composites, etc.

Fixes: #11291
Change-Id: I6f16844d2483dc86ab402b0b8b1f09561498aa1f

15 months agoMerge "ensure intermediary mappers emit subclass IN" into main
Michael Bayer [Sun, 28 Apr 2024 14:35:06 +0000 (14:35 +0000)] 
Merge "ensure intermediary mappers emit subclass IN" into main

15 months agoensure intermediary mappers emit subclass IN
Mike Bayer [Sat, 27 Apr 2024 04:31:07 +0000 (00:31 -0400)] 
ensure intermediary mappers emit subclass IN

Fixed issue in :func:`_orm.selectin_polymorhpic` loader option where the
SELECT emitted would only accommodate for the child-most class among the
result rows that were returned, leading intermediary-class attributes to be
unloaded if there were no concrete instances of that intermediary-class
present in the result.   This issue only presented itself for multi-level
inheritance hierarchies.

Fixes: #11327
Change-Id: Iec88cc517613d031221a1c035c4cfb46db0154be

15 months agoimprove fetchmany performance when using deque
Federico Caselli [Sat, 27 Apr 2024 11:06:03 +0000 (13:06 +0200)] 
improve fetchmany performance when using deque

Change-Id: Id30e770eb44eafd3e939c4076b639e8e6962c54b

15 months agoFixing ci errors
Federico Caselli [Sat, 27 Apr 2024 08:48:47 +0000 (10:48 +0200)] 
Fixing ci errors

Change-Id: Ia1e3a8748a36dd3fa013707eae5ee4f97013d71b

15 months agoMerge "consider propagate_to_loaders at application time" into main
Michael Bayer [Sat, 27 Apr 2024 04:33:39 +0000 (04:33 +0000)] 
Merge "consider propagate_to_loaders at application time" into main

15 months agoMerge "Add missing overload to __add__" into main
Federico Caselli [Fri, 26 Apr 2024 20:35:07 +0000 (20:35 +0000)] 
Merge "Add missing overload to __add__" into main

15 months agoFix typo in sqlalchemy.event.api (#11325)
Felix Zenk [Fri, 26 Apr 2024 19:25:19 +0000 (21:25 +0200)] 
Fix typo in sqlalchemy.event.api (#11325)

15 months agoAdd missing overload to __add__
Yossi Rozantsev [Wed, 24 Apr 2024 20:15:30 +0000 (16:15 -0400)] 
Add missing overload to __add__

Add a missing `@overload` to the `__add__` operator.

### Description
The `__add__` function is missing an overload that handles the rest of the cases, similar to the one that `__sub__` has a few lines later in the same file.

This fix is taken from https://github.com/microsoft/pyright/issues/7743

### Checklist
This pull request is:

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

**Have a nice day!**

Closes: #11307
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11307
Pull-request-sha: 961d87403a5f985fbd17e07bae490e8e97475158

Change-Id: I27784f79e8d4f8b7f09b17060186916c78cba0a3

15 months agoImprove typing to the count function.
Federico Caselli [Wed, 24 Apr 2024 19:47:01 +0000 (21:47 +0200)] 
Improve typing to the count function.

Improve typing to allow `'*'` and 1 in the count function.

Fixes: #11316
Change-Id: Iaafdb779b6baa70504154099f0b9554c612a9ffa

15 months agoMerge "Fix typing to support mypy 1.10" into main
Federico Caselli [Thu, 25 Apr 2024 19:42:49 +0000 (19:42 +0000)] 
Merge "Fix typing to support mypy 1.10" into main

15 months agoAdd Databricks to external dialect list
Gord Thompson [Thu, 25 Apr 2024 15:14:53 +0000 (09:14 -0600)] 
Add Databricks to external dialect list

Change-Id: I155e274c6baaeb044f7fda76ba74a63ab9e8e4e3

15 months agoAdd Databend and Greenplum dialects (#11248)
Pat Buxton [Wed, 24 Apr 2024 20:48:02 +0000 (21:48 +0100)] 
Add Databend and Greenplum dialects (#11248)

15 months agoChanged some `declared_attr` code examples in the docs to return `mapped_column`...
gmanny [Wed, 24 Apr 2024 20:41:34 +0000 (22:41 +0200)] 
Changed some `declared_attr` code examples in the docs to return `mapped_column` to indicate that it's possible. (#11302)

15 months agoFix typing to support mypy 1.10
Federico Caselli [Wed, 24 Apr 2024 20:30:21 +0000 (22:30 +0200)] 
Fix typing to support mypy 1.10

Change-Id: I77c0a04331a99c7be77c174721431a5601475dc3

15 months agoconsider propagate_to_loaders at application time
Mike Bayer [Thu, 18 Apr 2024 22:17:21 +0000 (18:17 -0400)] 
consider propagate_to_loaders at application time

Fixed regression from 1.4 where using :func:`_orm.defaultload` in
conjunction with a non-propagating loader like :func:`_orm.contains_eager`
would nonetheless propagate the :func:`_orm.contains_eager` to a lazy load
operation, causing incorrect queries as this option is only intended to
come from an original load.

Fixes: #11292
Change-Id: I79928afa108970b523f2166c3190f7952eca73ed

15 months agoImprove docs formatting on automap, fix missing import
Federico Caselli [Wed, 17 Apr 2024 20:17:25 +0000 (22:17 +0200)] 
Improve docs formatting on automap, fix missing import

Fixes: #11273
Change-Id: I872dcc0c2cf5093034e1590533b2e0d26602df7f
References: #11267

15 months agoFix missing pythonpath in test that use subprocess
Federico Caselli [Mon, 15 Apr 2024 19:52:38 +0000 (21:52 +0200)] 
Fix missing pythonpath in test that use subprocess

Ensure the ``PYTHONPATH`` variable is properly initialized when
using ``subprocess.run`` in the tests.

Fixes: #11268
Change-Id: Ie2db656364931b3be9033dcaaf7a7c56b383ecca

15 months agoMerge "typing: annotate Exists.select() to return Select[bool]" into main
Michael Bayer [Fri, 12 Apr 2024 15:49:18 +0000 (15:49 +0000)] 
Merge "typing: annotate Exists.select() to return Select[bool]" into main

15 months agoMerge "Document how to configure the cursor_factory on psycopg" into main
Michael Bayer [Fri, 12 Apr 2024 15:48:29 +0000 (15:48 +0000)] 
Merge "Document how to configure the cursor_factory on psycopg" into main

15 months agoDocument how to configure the cursor_factory on psycopg
Federico Caselli [Thu, 11 Apr 2024 19:24:54 +0000 (21:24 +0200)] 
Document how to configure the cursor_factory on psycopg

Change-Id: I117a0600c31dde721c99891caaa43937458e78d9
Refereinces: #8978

15 months agoMerge "Fix typing issue in `MetaData.reflect()` with asyncio." into main
Federico Caselli [Wed, 10 Apr 2024 20:42:08 +0000 (20:42 +0000)] 
Merge "Fix typing issue in `MetaData.reflect()` with asyncio." into main

15 months agoMerge "Improve compiled extension perf tests" into main
Federico Caselli [Wed, 10 Apr 2024 19:06:50 +0000 (19:06 +0000)] 
Merge "Improve compiled extension perf tests" into main

15 months agoMerge "Highlite composide mode that's more type checker friently" into main
Federico Caselli [Wed, 10 Apr 2024 19:03:42 +0000 (19:03 +0000)] 
Merge "Highlite composide mode that's more type checker friently" into main

15 months agoFix typing issue in `MetaData.reflect()` with asyncio.
Francisco Del Roio [Fri, 5 Apr 2024 16:05:51 +0000 (12:05 -0400)] 
Fix typing issue in `MetaData.reflect()` with asyncio.

Fixed typing regression caused by PR :ticket:`11055` in version 2.0.29 that
attempted to add ``ParamSpec`` to the asyncio ``run_sync()`` methods, where
using :meth:`_asyncio.AsyncConnection.run_sync` with
meth:`_schema.MetaData.reflect` would fail on mypy due to a bug.
See https://github.com/python/mypy/issues/17093 for details.
Pull request courtesy of Francisco R. Del Roio

Fixes: #11200
Closes: #11201
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11201
Pull-request-sha: 49e10e0d2a7bbadf471212033e25b7616b99c092

Change-Id: Ie2ebaebd1bc1ee1b865b78561cb6cb8937e85eca

15 months agoimprove distinct() docs
Mike Bayer [Wed, 10 Apr 2024 14:28:28 +0000 (10:28 -0400)] 
improve distinct() docs

differentiate more clearly between distinct() and select().distinct().

Change-Id: Id5eae749393e5898ae501b2462ec4c2c54262e2f

15 months agoUpdate links from initd.org to psycopg.org (#11244)
Stefan Wojcik [Mon, 8 Apr 2024 19:23:19 +0000 (15:23 -0400)] 
Update links from initd.org to psycopg.org (#11244)

16 months agoHighlite composide mode that's more type checker friently
Federico Caselli [Thu, 4 Apr 2024 18:56:39 +0000 (20:56 +0200)] 
Highlite composide mode that's more type checker friently

Change-Id: I9c7d79f31ab5e7a7f63aca4ba42c93f346acdefe
References: #11232

16 months agotyping: annotate Exists.select() to return Select[bool]
wouter bolsterlee [Thu, 4 Apr 2024 18:15:07 +0000 (14:15 -0400)] 
typing: annotate Exists.select() to return Select[bool]

Fixes: #11231
A query of the form:

``` sql
SELECT EXISTS (
    SELECT 1
    FROM ...
    WHERE ...
)
```

… returns a boolean.

Closes: #11233
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11233
Pull-request-sha: 1bec1cac731eb42e097948f84ae3d0ef133f8a9a

Change-Id: I407a3bd9ed21a180c6c3ff02250aa0a9fbe502d7

16 months agoset up is_from_statement and others for FromStatement
Mike Bayer [Mon, 1 Apr 2024 21:54:22 +0000 (17:54 -0400)] 
set up is_from_statement and others for FromStatement

Added new attribute :attr:`_orm.ORMExecuteState.is_from_statement`, to
detect statements of the form ``select().from_statement()``, and also
enhanced ``FromStatement`` to set :attr:`_orm.ORMExecuteState.is_select`,
:attr:`_orm.ORMExecuteState.is_insert`,
:attr:`_orm.ORMExecuteState.is_update`, and
:attr:`_orm.ORMExecuteState.is_delete` according to the element that is
sent to the :meth:`_sql.Select.from_statement` method itself.

Fixes: #11220
Change-Id: I3bf9e7e22fa2955d772b3b6ad636ed93a60916ae

16 months agonew flake8-builtins adds a code we dont want
Mike Bayer [Mon, 1 Apr 2024 23:28:01 +0000 (19:28 -0400)] 
new flake8-builtins adds a code we dont want

A005 "he module is shadowing a Python builtin module "

Change-Id: I9c7464e8f0c32df76d4c455e502b8bc7f94aa038

16 months agouse a full ConnectionCharacteristic for logging_token
Mike Bayer [Thu, 28 Mar 2024 13:59:44 +0000 (09:59 -0400)] 
use a full ConnectionCharacteristic for logging_token

Fixed issue in the
:paramref:`_engine.Connection.execution_options.logging_token` option,
where changing the value of ``logging_token`` on a connection that has
already logged messages would not be updated to reflect the new logging
token.  This in particular prevented the use of
:meth:`_orm.Session.connection` to change the option on the connection,
since the BEGIN logging message would already have been emitted.

Fixes: #11210
Change-Id: I0ddade3778215259a6eacde3a67e09d30bc3257b

16 months agoImprove compiled extension perf tests
Federico Caselli [Thu, 23 Nov 2023 20:58:40 +0000 (21:58 +0100)] 
Improve compiled extension perf tests

Transform compiled extension to package
Add cache test using the python only impl for now

Change-Id: I5bdc824214ed6567159861c31b771ebf4725b932

16 months agoupdate callcounts
Mike Bayer [Wed, 27 Mar 2024 15:25:27 +0000 (11:25 -0400)] 
update callcounts

this adds new callcounts for py312 and also hopefully fixes
some that are failing on main due to the cython change

Change-Id: Ia4222e61451eac9b3fb24c625bb7d30a2019e7c6

16 months agoSwitch to cython pure python mode
Federico Caselli [Sat, 23 Sep 2023 21:39:42 +0000 (23:39 +0200)] 
Switch to cython pure python mode

Replaces the pyx files with py files that can be both compiled
by cython or imported as is by python.
This avoids the need of duplicating the code to have a python
only fallback.
The cython files are also reorganized to be in the module they use
instead of all being in the cyextension package, that has been
removed.

The performance is pretty much equal between main and this change.
A detailed comparison is at this link
https://docs.google.com/spreadsheets/d/1jkmGpnCyEcPyy6aRK9alElGjxlNHu44Wxjr4VrD99so/edit?usp=sharing

Change-Id: Iaed232ea5dfb41534cc9f58f6ea2f912a93263af

16 months agocherry-pick changelog update for 2.0.30
Mike Bayer [Sat, 23 Mar 2024 21:53:46 +0000 (17:53 -0400)] 
cherry-pick changelog update for 2.0.30

16 months agocherry-pick changelog from 2.0.29
Mike Bayer [Sat, 23 Mar 2024 21:53:45 +0000 (17:53 -0400)] 
cherry-pick changelog from 2.0.29

16 months agochangelog fixes
Mike Bayer [Sat, 23 Mar 2024 14:55:55 +0000 (10:55 -0400)] 
changelog fixes

Change-Id: I1e1b752660d2186647c15f2b19e8eece720f29cb

16 months agoMerge "Add pg DOMAIN type reflection" into main
Michael Bayer [Sat, 23 Mar 2024 05:20:51 +0000 (05:20 +0000)] 
Merge "Add pg DOMAIN type reflection" into main

16 months agoMerge "subqueryload invokes compile() on _OverrideBinds - do robust replace of bp...
Michael Bayer [Fri, 22 Mar 2024 14:16:36 +0000 (14:16 +0000)] 
Merge "subqueryload invokes compile() on _OverrideBinds - do robust replace of bp" into main

16 months agoMerge "use a private return class for the "catch all" relationship" into main
Michael Bayer [Fri, 22 Mar 2024 13:30:47 +0000 (13:30 +0000)] 
Merge "use a private return class for the "catch all" relationship" into main

16 months agoAdd pg DOMAIN type reflection
Thomas Stephenson [Wed, 21 Feb 2024 20:17:01 +0000 (15:17 -0500)] 
Add pg DOMAIN type reflection

The PostgreSQL dialect now returns :class:`_postgresql.DOMAIN` instances
when reflecting a column that has a domain as type.
Previously the domain data type was returned instead.
As part of this change, the domain reflection was improved to also
return the collation of the text types.

Fixes: #10693
Closes: #10729
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10729
Pull-request-sha: adac164d191138265ecd64a28be91254a53a9c25

Change-Id: I8730840de2e7e9649067191430eefa086bcf5e7b

16 months agoMerge "assign variant mapping on adapt()" into main
Michael Bayer [Fri, 22 Mar 2024 13:23:18 +0000 (13:23 +0000)] 
Merge "assign variant mapping on adapt()" into main

16 months agoMerge "A scalar subquery that returns bool is now correctly typed" into main
Michael Bayer [Fri, 22 Mar 2024 13:22:43 +0000 (13:22 +0000)] 
Merge "A scalar subquery that returns bool is now correctly typed" into main

16 months agosubqueryload invokes compile() on _OverrideBinds - do robust replace of bp
Mike Bayer [Tue, 19 Mar 2024 17:35:35 +0000 (13:35 -0400)] 
subqueryload invokes compile() on _OverrideBinds - do robust replace of bp

Fixed regression from version 2.0.28 caused by the fix for :ticket:`11085`
where the newer method of adjusting post-cache bound parameter values would
interefere with the implementation for the :func:`_orm.subqueryload` loader
option, which has some more legacy patterns in use internally, when
the additional loader criteria feature were used with this loader option.

Fixes: #11173
Change-Id: I88982fbcc809d516eb7c46a00fb807aab9c3a98e

16 months agoensure ARRAY.__init__ documents before Comparator
Mike Bayer [Thu, 21 Mar 2024 06:13:22 +0000 (02:13 -0400)] 
ensure ARRAY.__init__ documents before Comparator

also add note for zero_indexes to generic and PG ARRAY
types

References: https://github.com/sqlalchemy/sqlalchemy/discussions/11100
Change-Id: I2087da695787a930f325cfb2fa4156d19c8e8f31

16 months agoA scalar subquery that returns bool is now correctly typed
Federico Caselli [Wed, 20 Mar 2024 21:18:35 +0000 (22:18 +0100)] 
A scalar subquery that returns bool is now correctly typed

Fixes: #10937
Change-Id: Iba4986be14fefd4210b727ddb7ae7e9291ab7f7f

16 months agouse a private return class for the "catch all" relationship
Mike Bayer [Thu, 9 Nov 2023 15:27:19 +0000 (10:27 -0500)] 
use a private return class for the "catch all" relationship

Fixed Declarative issue where typing a relationship using
:class:`_orm.Relationship` rather than :class:`_orm.Mapped` would
inadvertently pull in the "dynamic" relationship loader strategy for that
attribute.

Fixes: #10611
Change-Id: Ie4421050b583827fdf96c27ae9d7fe7ca596e77e

16 months agoassign variant mapping on adapt()
Mike Bayer [Wed, 20 Mar 2024 14:23:41 +0000 (10:23 -0400)] 
assign variant mapping on adapt()

Fixed regression from the 1.4 series where the refactor of the
:meth:`_types.TypeEngine.with_variant` method introduced at
:ref:`change_6980` failed to accommodate for the ``.copy()`` method, which
will lose the variant mappings that are set up. This becomes an issue for
the very specific case of a "schema" type, which includes types such as
:class:`.Enum` and :class:`.ARRAY`, when they are then used in the context
of an ORM Declarative mapping with mixins where copying of types comes into
play.  The variant mapping is now copied as well.

Fixes: #11176
Change-Id: Icf1a2752f60fce863c87ead8b0fe298b0f3d3766

16 months agowork around boldface concerns
Mike Bayer [Tue, 19 Mar 2024 14:51:01 +0000 (10:51 -0400)] 
work around boldface concerns

Change-Id: I99ed117bb0f1bdc1a8750bd13db5a69d5c398ae0

16 months agoMerge "do not convert uuid to string in postgresql and mssql" into main
Michael Bayer [Tue, 19 Mar 2024 14:43:51 +0000 (14:43 +0000)] 
Merge "do not convert uuid to string in postgresql and mssql" into main

16 months agoMerge "document improvement for load_only" into main
Michael Bayer [Tue, 19 Mar 2024 14:42:28 +0000 (14:42 +0000)] 
Merge "document improvement for load_only" into main

16 months agoadd notes clarifying the role of "$user" in pg search_path
Mike Bayer [Tue, 19 Mar 2024 12:35:00 +0000 (08:35 -0400)] 
add notes clarifying the role of "$user" in pg search_path

references: https://github.com/sqlalchemy/alembic/discussions/1447
Change-Id: I2ef55813699f84ac7fbca6de7522f0d3d78e6029

16 months agodo not convert uuid to string in postgresql and mssql
Federico Caselli [Mon, 18 Mar 2024 21:01:00 +0000 (22:01 +0100)] 
do not convert uuid to string in postgresql and mssql

Change-Id: Ic3c87d8c654926f7ef28ba9ec6dd21c50a1171cf

16 months agofix typo from d8174392dce20004d9158a90949b4ff11b830247
Federico Caselli [Mon, 18 Mar 2024 20:52:41 +0000 (21:52 +0100)] 
fix typo from d8174392dce20004d9158a90949b4ff11b830247

Change-Id: If76715abf6de8fc85580080a73aa5faa138aa968

16 months agodocument improvement for load_only
Federico Caselli [Mon, 18 Mar 2024 20:50:35 +0000 (21:50 +0100)] 
document improvement for load_only

mention that load_only can be used to control what
populate existing refreses.

Change-Id: I9bd6fbe8674005d9f32f9d1bc263bf860b53c3ec

16 months agoMerge "Add impyla to external dialect list" into main
Federico Caselli [Mon, 18 Mar 2024 20:31:46 +0000 (20:31 +0000)] 
Merge "Add impyla to external dialect list" into main

16 months agoMerge "remove sentinel_value_resolvers and use pre-bind values" into main
Michael Bayer [Mon, 18 Mar 2024 18:17:07 +0000 (18:17 +0000)] 
Merge "remove sentinel_value_resolvers and use pre-bind values" into main

16 months agoadd missing cache_ok directive to MyEpochType
Mike Bayer [Mon, 18 Mar 2024 14:22:06 +0000 (10:22 -0400)] 
add missing cache_ok directive to MyEpochType

Change-Id: Ic4da52b02a4ba36d87d73974fe428b91d9d7915c

16 months agoremove sentinel_value_resolvers and use pre-bind values
Mike Bayer [Fri, 15 Mar 2024 14:51:02 +0000 (10:51 -0400)] 
remove sentinel_value_resolvers and use pre-bind values

Made a change to the adjustment made in version 2.0.10 for :ticket:`9618`,
which added the behavior of reconciling RETURNING rows from a bulk INSERT
to the parameters that were passed to it.  This behavior included a
comparison of already-DB-converted bound parameter values against returned
row values that was not always "symmetrical" for SQL column types such as
UUIDs, depending on specifics of how different DBAPIs receive such values
versus how they return them, necessitating the need for additional
"sentinel value resolver" methods on these column types.  Unfortunately
this broke third party column types such as UUID/GUID types in libraries
like SQLModel which did not implement this special method, raising an error
"Can't match sentinel values in result set to parameter sets".  Rather than
attempt to further explain and document this implementation detail of the
"insertmanyvalues" feature including a public version of the new
method, the approach is intead revised to no longer need this extra
conversion step, and the logic that does the comparison now works on the
pre-converted bound parameter value compared to the post-result-processed
value, which should always be of a matching datatype.  In the unusual case
that a custom SQL column type that also happens to be used in a "sentinel"
column for bulk INSERT is not receiving and returning the same value type,
the "Can't match" error will be raised, however the mitigation is
straightforward in that the same Python datatype should be passed as that
returned.

Fixes: #11160
Change-Id: Ica62571e923ad9545eb90502e6732b11875b164a

16 months agoAdd impyla to external dialect list
Gord Thompson [Mon, 18 Mar 2024 13:26:17 +0000 (07:26 -0600)] 
Add impyla to external dialect list

Change-Id: I5a85db43a11c2c993597d0fa737377ee460b7629

16 months agoMerge "mysql: Add new reserved words from MySQL 8.3." into main
Federico Caselli [Fri, 15 Mar 2024 21:02:04 +0000 (21:02 +0000)] 
Merge "mysql: Add new reserved words from MySQL 8.3." into main

16 months agofix mypy on python<3.10
Federico Caselli [Fri, 15 Mar 2024 19:42:16 +0000 (20:42 +0100)] 
fix mypy on python<3.10

Change-Id: Ice16ff3685f89c64607ef37a906e17c53a5324fd

16 months agomysql: Add new reserved words from MySQL 8.3.
Sean Bright [Fri, 15 Mar 2024 17:57:28 +0000 (13:57 -0400)] 
mysql: Add new reserved words from MySQL 8.3.

Adds the following new keywords from MySQL 8.3:

* `intersect`
* `parallel`
* `qualify`

Sourced from https://dev.mysql.com/doc/refman/8.3/en/keywords.html

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

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

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

-->

This pull request is:

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

Change-Id: I4441389a4ebec02cdb8372051b6fab1280bcf198

16 months agoaccommodate schema_translate_map in _deliver_insertmanyvalues_batches
Mike Bayer [Wed, 13 Mar 2024 22:23:07 +0000 (18:23 -0400)] 
accommodate schema_translate_map in _deliver_insertmanyvalues_batches

Fixed issue in :ref:`engine_insertmanyvalues` feature where using a primary
key column with an "inline execute" default generator such as an explicit
:class:`.Sequence` with an explcit schema name, while at the same time
using the
:paramref:`_engine.Connection.execution_options.schema_translate_map`
feature would fail to render the sequence or the parameters properly,
leading to errors.

Fixes: #11157
Change-Id: I35666af46d40996aff35d3d39f48c150d838e6e4

16 months agoMerge "Make instrumented attribute covariant as well" into main
Michael Bayer [Wed, 13 Mar 2024 16:02:28 +0000 (16:02 +0000)] 
Merge "Make instrumented attribute covariant as well" into main

16 months agoMerge "add doctests to asyncio tutorial" into main
Michael Bayer [Wed, 13 Mar 2024 16:00:58 +0000 (16:00 +0000)] 
Merge "add doctests to asyncio tutorial" into main

16 months agoMake instrumented attribute covariant as well
Ethan Langevin [Mon, 11 Mar 2024 11:41:58 +0000 (07:41 -0400)] 
Make instrumented attribute covariant as well

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

Allows mapped relationships to use covariant types which makes it possible to define methods that operate on relationships in a typesafe way

### Description

See: https://github.com/sqlalchemy/sqlalchemy/issues/11112 for a more in depth explanation.

Just changed the type parameter in `InstrumentedAttribute` from `_T` to `_T_co`.

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

-->

This pull request is:

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

Change-Id: Iff715c24f1556d5604dcd33661a0ee7232b9404b

16 months agoimprove docs for sqlite memory db
Federico Caselli [Tue, 12 Mar 2024 22:05:50 +0000 (23:05 +0100)] 
improve docs for sqlite memory db

Change-Id: Icdbc13bdad3fb5ae69e79605bb7e6cb82d538c80
References: #10968

16 months agoupdate section be qualified for PGBouncer
Mike Bayer [Mon, 11 Mar 2024 23:59:06 +0000 (19:59 -0400)] 
update section be qualified for PGBouncer

the NullPool advice is for PGBouncer only

Change-Id: Ib79cae8965435b78fbde6e2d4de5e35fcd2a2f21

16 months agoadd doctests to asyncio tutorial
Federico Caselli [Mon, 26 Feb 2024 21:16:18 +0000 (22:16 +0100)] 
add doctests to asyncio tutorial

Change-Id: I28c94a7bc1e7ae572af0d206b8e63a110dc6fd7a

16 months agoMerge "Update docs references to .execute() with string literal" into main
Federico Caselli [Mon, 11 Mar 2024 22:35:49 +0000 (22:35 +0000)] 
Merge "Update docs references to .execute() with string literal" into main

16 months agoMention getitem on automap classes property
Federico Caselli [Mon, 11 Mar 2024 22:11:28 +0000 (23:11 +0100)] 
Mention getitem on automap classes property

Fixes #11097

Change-Id: I05198c8288e11fb0c645e9a7d46652fa979b56f7