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

16 months agoMerge "Fixes: #10933 typing in ColumnExpressionArgument" into main
Federico Caselli [Mon, 11 Mar 2024 22:10:55 +0000 (22:10 +0000)] 
Merge "Fixes: #10933 typing in ColumnExpressionArgument" into main

16 months agoMerge "Allow using AsyncEngine in compile" into main
Michael Bayer [Mon, 11 Mar 2024 22:04:45 +0000 (22:04 +0000)] 
Merge "Allow using AsyncEngine in compile" into main

16 months agoFixing typos (#11105)
Andreas Deininger [Mon, 11 Mar 2024 21:40:14 +0000 (22:40 +0100)] 
Fixing typos (#11105)

16 months agoFixes: #11083 (#11095)
Daniel Robert [Mon, 11 Mar 2024 21:34:20 +0000 (14:34 -0700)] 
Fixes: #11083 (#11095)
16 months agoadd a docs cross-reference between adding columns & relationships to existing table...
Jens Troeger [Mon, 11 Mar 2024 21:11:45 +0000 (17:11 -0400)] 
add a docs cross-reference between adding columns & relationships to existing table mappings

For context see discussion https://github.com/sqlalchemy/sqlalchemy/discussions/11124. This change adds the requested cross-reference to the documentation.

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

Change-Id: Ic683354fa05560d869d47ceda820d88e758e2973

16 months agochore: remove repetitive words (#11134)
acceptacross [Mon, 11 Mar 2024 21:01:42 +0000 (05:01 +0800)] 
chore: remove repetitive words (#11134)

Signed-off-by: acceptacross <csqcqs@gmail.com>
16 months agofix imports in "Self-Referential Many-to-Many Relationship" code example (#11120)
Denis Laxalde [Mon, 11 Mar 2024 20:59:51 +0000 (21:59 +0100)] 
fix imports in "Self-Referential Many-to-Many Relationship" code example (#11120)

Some were unused, some were missing.

16 months agofix usage of kwargs to execute in docs
Federico Caselli [Mon, 11 Mar 2024 20:58:46 +0000 (21:58 +0100)] 
fix usage of kwargs to execute in docs

Change-Id: I033cba49ba6c12113643b88e48c5917f2b70a307

16 months agoAllow using AsyncEngine in compile
Eugene Toder [Mon, 11 Mar 2024 11:42:47 +0000 (07:42 -0400)] 
Allow using AsyncEngine in compile

This works, so only need to update the type annotation.

This pull request is:

- [x] A documentation / typographical / small typing error fix
- Good to go, no issue or tests are needed

Closes: #11103
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11103
Pull-request-sha: ba9e61a3902d5666a5176aedd50afe8ae7762bff

Change-Id: I3d08b930a8cae0539bf9b436d5e806d8912cdee0

16 months agoFixed typing issues with sync code runners
Francisco R. Del Roio [Sun, 25 Feb 2024 19:37:27 +0000 (14:37 -0500)] 
Fixed typing issues with sync code runners

Fixed typing issue allowing asyncio ``run_sync()`` methods to correctly
type the parameters according to the callable that was passed, making use
of :pep:`612` ``ParamSpec`` variables.  Pull request courtesy Francisco R.
Del Roio.

Closes: #11055
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11055
Pull-request-sha: 712b4382b16e4c07c09ac40a570c4bfb76c28161

Change-Id: I94ec8bbb0688d6c6e1610f8f769abab550179c14

16 months agoadd extra pep695 conversion step
Mike Bayer [Sat, 9 Mar 2024 17:47:01 +0000 (12:47 -0500)] 
add extra pep695 conversion step

Added support for the :pep:`695` ``TypeAliasType`` construct as well as the
python 3.12 native ``type`` keyword to work with ORM Annotated Declarative
form when using these constructs to link to a :pep:`593` ``Annotated``
container, allowing the resolution of the ``Annotated`` to proceed when
these constructs are used in a :class:`_orm.Mapped` typing container.

Fixes: #11130
Change-Id: I9a386943966de2107f15f08dfe6ed2aa84f7e86c

16 months agodocument caveat for #11054
Mike Bayer [Sat, 9 Mar 2024 18:41:05 +0000 (13:41 -0500)] 
document caveat for #11054

Fixes: #11054
Change-Id: I1a5a9586d024d84dacf37742d710baf7b8f7570f

16 months agouse a fixed date that's not near DST switchover
Mike Bayer [Sat, 9 Mar 2024 15:05:03 +0000 (10:05 -0500)] 
use a fixed date that's not near DST switchover

CI has been failing here due to the DST switchover regarding
live dates.

Change-Id: I98b2dbe646180f41f948bec20193fdf3f63501b8

17 months agoMerge "accommodate False conditions for unique / index merge" into main
Michael Bayer [Tue, 5 Mar 2024 14:30:49 +0000 (14:30 +0000)] 
Merge "accommodate False conditions for unique / index merge" into main

17 months agoInline _get_bind_args method.
oleg [Tue, 5 Mar 2024 13:18:36 +0000 (08:18 -0500)] 
Inline _get_bind_args method.

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

### Description
_get_bind_args is strange method in query module. It is called only in one place. It takes self(but don't use it) and two args with Any type. I think it must be static method with typehints if it will has more use cases in the future. But now removing is more simple solution.

### Checklist

This pull request is:

- [x] A short code fix

**Have a nice day!**

Closes: #11098
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/11098
Pull-request-sha: dc997911a68e455419080a782778c56eceaa76f5

Change-Id: I53b960b3f2864a2db24ffa0058ab0569a721b11a

17 months agoFixes: #10933 typing in ColumnExpressionArgument
Tomasz Nowacki [Mon, 4 Mar 2024 14:52:02 +0000 (09:52 -0500)] 
Fixes: #10933 typing in ColumnExpressionArgument
### Description
Fixes: #10933 typing in ColumnExpressionArgument
### 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: #10959
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10959
Pull-request-sha: 6fed2cf1d1ba78e9101a3608bd0cf70f2abb3232

Change-Id: I43420add824881e7cc0ec93e3c8b9a04d33e30df

17 months agoaccommodate False conditions for unique / index merge
Mike Bayer [Mon, 4 Mar 2024 14:12:34 +0000 (09:12 -0500)] 
accommodate False conditions for unique / index merge

Fixed issue in ORM annotated declarative where using
:func:`_orm.mapped_column()` with an :paramref:`_orm.mapped_column.index`
or :paramref:`_orm.mapped_column.unique` setting of False would be
overridden by an incoming ``Annotated`` element that featured that
parameter set to ``True``, even though the immediate
:func:`_orm.mapped_column()` element is more specific and should take
precedence.  The logic to reconcile the booleans has been enhanced to
accommodate a local value of ``False`` as still taking precedence over an
incoming ``True`` value from the annotated element.

Fixes: #11091
Change-Id: I15cda4a0a07a289015c0a09bbe3ca2849956604e

17 months agocherry-pick changelog update for 2.0.29 11094/head
Mike Bayer [Mon, 4 Mar 2024 13:41:51 +0000 (08:41 -0500)] 
cherry-pick changelog update for 2.0.29

17 months agocherry-pick changelog from 2.0.28
Mike Bayer [Mon, 4 Mar 2024 13:41:51 +0000 (08:41 -0500)] 
cherry-pick changelog from 2.0.28

17 months agocherry-pick changelog update for 1.4.53
Mike Bayer [Mon, 4 Mar 2024 13:30:05 +0000 (08:30 -0500)] 
cherry-pick changelog update for 1.4.53

17 months agocherry-pick changelog from 1.4.52
Mike Bayer [Mon, 4 Mar 2024 13:30:04 +0000 (08:30 -0500)] 
cherry-pick changelog from 1.4.52

17 months agoMerge "Add support for preserve_rowcount execution_option" into main
Michael Bayer [Mon, 4 Mar 2024 06:08:55 +0000 (06:08 +0000)] 
Merge "Add support for preserve_rowcount execution_option" into main

17 months agoMerge "adjust bound parameters within cache key only, dont deep copy" into main
Michael Bayer [Mon, 4 Mar 2024 06:08:04 +0000 (06:08 +0000)] 
Merge "adjust bound parameters within cache key only, dont deep copy" into main

17 months agosupport pytest 8.1
Mike Bayer [Mon, 4 Mar 2024 04:03:14 +0000 (23:03 -0500)] 
support pytest 8.1

This is a bump in the tox.ini file.   it's possible we
don't need to change anything else as we had help from the pytest
people a few years back to make sure our API use was fairly modern.

Alembic is having problems that appear to be separate.

Change-Id: If0348dc4915522d31d3ab970df31244bbc8b8ca4

17 months agoadjust bound parameters within cache key only, dont deep copy
Mike Bayer [Sat, 2 Mar 2024 05:28:26 +0000 (00:28 -0500)] 
adjust bound parameters within cache key only, dont deep copy

Adjusted the fix made in :ticket:`10570`, released in 2.0.23, where new
logic was added to reconcile possibly changing bound parameter values
across cache key generations used within the :func:`_orm.with_expression`
construct.  The new logic changes the approach by which the new bound
parameter values are associated with the statement, avoiding the need to
deep-copy the statement which can result in a significant performance
penalty for very deep / complex SQL constructs.  The new approach no longer
requires this deep-copy step.

Fixes: #11085
Change-Id: Ia51eb4e949c8f37af135399925a9916b9ed4ad2f

17 months agoAdd support for preserve_rowcount execution_option
Federico Caselli [Wed, 7 Feb 2024 21:11:25 +0000 (22:11 +0100)] 
Add support for preserve_rowcount execution_option

Added new core execution option
paramref:`_engine.Connection.execution_options.preserve_rowcount`
to unconditionally save the ``rowcount`` attribute from the cursor in the
class:`_engine.Result` returned from an execution, regardless of the
statement being executed.
When this option is provided the correct value is also set when
an INSERT makes use of the "insertmanyvalues" mode, that may use
more than one actualy cursor execution.

Fixes: #10974
Change-Id: Icecef6b7539be9f0a1a02b9539864f5f163dcfbc

17 months agoadd 1.4 changelog for #10365
Mike Bayer [Thu, 29 Feb 2024 16:07:22 +0000 (11:07 -0500)] 
add 1.4 changelog for #10365

Change-Id: I3359274337f214132f35d9c4b722c97685b63d72

17 months agofix typos in docs
Federico Caselli [Mon, 26 Feb 2024 21:16:38 +0000 (22:16 +0100)] 
fix typos in docs

Change-Id: Iaba3c5979af626055acb0068cc8aac0c7334b0e0

17 months agofix issue in asincio doc example
Federico Caselli [Mon, 26 Feb 2024 20:11:20 +0000 (21:11 +0100)] 
fix issue in asincio doc example

Change-Id: Idd55c07a57381450ab5c9db99854b6a1668f0382

17 months agoAdded YugabyteDB dialect to the documentation (#11047)
Sfurti-yb [Thu, 22 Feb 2024 19:37:24 +0000 (01:07 +0530)] 
Added YugabyteDB dialect to the documentation (#11047)

* Added YugabyteDB dialect to the documentation

* Update doc/build/dialects/index.rst

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
---------

Co-authored-by: Federico Caselli <cfederico87@gmail.com>