]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 years agoonce again note pydantic is never really going to work
Mike Bayer [Mon, 5 Jun 2023 16:26:43 +0000 (12:26 -0400)] 
once again note pydantic is never really going to work

In #9894 we see that pydantic's dataclass feature is doing an
end run around SQLAlchemy's collection mechanics that can't
be fixed without special steps, which we would surmise
is what SQLModel is doing here:

https://github.com/tiangolo/sqlmodel/blob/43a689d369f52b72aac60efd71111aba7d84714d/sqlmodel/main.py#L507

We don't do that, so note that we really are not supporting pydantic
directly; use SQLModel which was designed to resolve these issues.

Change-Id: I3e35e108546022c83d6c0ae73e32432cdc75d325

2 years agoMerge "Support dataclass default with init=False" into main
mike bayer [Mon, 5 Jun 2023 15:24:36 +0000 (15:24 +0000)] 
Merge "Support dataclass default with init=False" into main

2 years agoadd 058c230cea83811c3bebdd8259988c5c501f4f7e to ignore revs
Mike Bayer [Sun, 4 Jun 2023 14:40:52 +0000 (10:40 -0400)] 
add 058c230cea83811c3bebdd8259988c5c501f4f7e to ignore revs

Change-Id: I74eb858f8264f2b8bb8d64c280f2035cd2177690

2 years agoMerge "Update black to v23.3.0 and flake8 to v6" into main
mike bayer [Sun, 4 Jun 2023 14:35:14 +0000 (14:35 +0000)] 
Merge "Update black to v23.3.0 and flake8 to v6" into main

2 years agoSupport dataclass default with init=False
Federico Caselli [Sat, 3 Jun 2023 10:40:00 +0000 (12:40 +0200)] 
Support dataclass default with init=False

Fixed an issue where generating dataclasses fields that specified a
default`` value and set ``init=False`` would not work.
The dataclasses behavior in this case is to set the default
value on the class, that's not compatible with the descriptors used
by SQLAlchemy. To support this case the default is transformed to
a ``default_factory`` when generating the dataclass.

Fixes: #9879
Change-Id: I5151d388232eacd506a100ba18ce26970bf83cf3

2 years agoMerge "base _O around object, not Any" into main
mike bayer [Fri, 2 Jun 2023 17:57:51 +0000 (17:57 +0000)] 
Merge "base _O around object, not Any" into main

2 years agoAdd psycopg binary to extras (#9865)
Vlastimil Zíma [Wed, 31 May 2023 19:54:19 +0000 (21:54 +0200)] 
Add psycopg binary to extras (#9865)

2 years agorun format_docs_code.py on changes to self_referential.rst
Mike Bayer [Wed, 31 May 2023 13:00:31 +0000 (09:00 -0400)] 
run format_docs_code.py on changes to self_referential.rst

Change-Id: I801b9324fa4e390da0cb6081d5a754cd06314a50

2 years agoremove outdated docs section from psycopg dialect
Federico Caselli [Tue, 30 May 2023 20:23:14 +0000 (22:23 +0200)] 
remove outdated docs section from psycopg dialect

Fixes: #9858
Change-Id: I2348e5508714fb7cf9a509eaa57b9e011c72965b

2 years agoUpdate black to v23.3.0 and flake8 to v6
Federico Caselli [Tue, 30 May 2023 19:40:21 +0000 (21:40 +0200)] 
Update black to v23.3.0 and flake8 to v6

This change could be added to .git-blame-ignore-revs

Change-Id: I7ba10052b26bc3c178d23fb50a1123d0aae965ca

2 years agoupdate adjacency list docs / example for 2.0
Mike Bayer [Tue, 30 May 2023 18:27:32 +0000 (14:27 -0400)] 
update adjacency list docs / example for 2.0

References: #9859

2 years agoBump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#9851)
dependabot[bot] [Mon, 29 May 2023 18:50:37 +0000 (20:50 +0200)] 
Bump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#9851)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.12.3 to 2.13.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.12.3...v2.13.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 agoUpdate associationproxy.rst (#9848)
Peter Schutt [Mon, 29 May 2023 18:46:51 +0000 (04:46 +1000)] 
Update associationproxy.rst (#9848)

* Update associationproxy.rst

Missing import of `List` causes "Could not interpret annotation..." error.

* Update doc/build/orm/extensions/associationproxy.rst

---------

Co-authored-by: Federico Caselli <CaselIT@users.noreply.github.com>
2 years agobase _O around object, not Any
Mike Bayer [Mon, 29 May 2023 16:25:42 +0000 (12:25 -0400)] 
base _O around object, not Any

There were only a few trivial errors related to this
TypeVar being linked to object which were correctable at the
source.   It's not clear if there were more errors with older
versions of mypy and/or the codebase when this was first developed.

Change-Id: Ic07ba08e600574b6277ba8540504355e9d7b676c
References: #9835

2 years agoMerge "Improve PostgreSQL custom operators" into main
mike bayer [Sun, 28 May 2023 13:29:14 +0000 (13:29 +0000)] 
Merge "Improve PostgreSQL custom operators" into main

2 years agoMerge "tighten up overwritten attribute detection and use a deprecation" into main
mike bayer [Sun, 28 May 2023 13:27:05 +0000 (13:27 +0000)] 
Merge "tighten up overwritten attribute detection and use a deprecation" into main

2 years agoImprove PostgreSQL custom operators
Federico Caselli [Fri, 26 May 2023 22:36:04 +0000 (00:36 +0200)] 
Improve PostgreSQL custom operators

Unified the custom PostgreSQL operator definitions, since they are
shared among multiple different data types.

Use proper precedence on PostgreSQL specific operators, such as ``@>``.
Previously the precedence was wrong, leasing to wrong parenthesis when
rending against and ``ANY`` or ``ALL`` construct.

Fixes: #9041
Fixes: #9836
Change-Id: I1c1d8b4c2d58d53c51c2e6d4934ac1ed83bda5d3

2 years agoMerge "Improve PG reflection compat." into main
mike bayer [Sat, 27 May 2023 13:07:22 +0000 (13:07 +0000)] 
Merge "Improve PG reflection compat." into main

2 years agotighten up overwritten attribute detection and use a deprecation
Mike Bayer [Fri, 26 May 2023 14:51:02 +0000 (10:51 -0400)] 
tighten up overwritten attribute detection and use a deprecation

A deprecation warning is emitted whenever a property is added to a
:class:`_orm.Mapper` where an ORM mapped property were already configured,
or an attribute is already present on the class. Previously, there was a
non-deprecation warning for this case that did not emit consistently. The
logic for this warning has been improved so that it detects end-user
replacement of attribute while not having false positives for internal
Declarative and other cases where replacement of descriptors with new ones
is expected.

Fixes: #9841
Change-Id: I21ef25571466eeca3fedbec71612f7553fdbf2bf

2 years agoQueuePool is now default for SQLite
Seth [Fri, 26 May 2023 19:28:34 +0000 (15:28 -0400)] 
QueuePool is now default for SQLite

Closes: #9734
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9734
Pull-request-sha: f956a5ee0451f8580dbe4e9b28985e7456c6c8a1

Change-Id: I664ba214c02664515655521129f84ab2905201d5

2 years agoDocumentation fixes (#9747)
F.D.Castel [Fri, 26 May 2023 19:27:17 +0000 (16:27 -0300)] 
Documentation fixes (#9747)

* Fix typos.

* Adjust FAQ entries about SQLite connection pooling in SQLALchemy 2.0.

* Rephrase.

* Changes suggested by @zzzeek.

2 years agochange conn.execute to connection.execute (#9842)
Tim Ryan [Fri, 26 May 2023 19:26:00 +0000 (15:26 -0400)] 
change conn.execute to connection.execute (#9842)

makes code executable

2 years agoUpdate check constraint docs for MySQL support (#9803)
Leah Einhorn [Fri, 26 May 2023 19:25:07 +0000 (15:25 -0400)] 
Update check constraint docs for MySQL support (#9803)

This is now supported as of version 8.0.16
https://dev.mysql.com/doc/refman/8.0/en/create-table-check-constraints.html

2 years agoImprove PG reflection compat.
Federico Caselli [Thu, 25 May 2023 22:17:40 +0000 (00:17 +0200)] 
Improve PG reflection compat.

Cast ``NAME`` columns to ``TEXT`` when using ``ARRAY_AGG`` in PostgreSQL
reflection. This seems to improve compatibility with some PostgreSQL
derivatives that may not support aggregations on the ``NAME`` type.

Fixes: #9838
Change-Id: I88e12f7b6aad6cf123961d169f90e29760e953a8

2 years agoMerge "add reflection arguments, engine/conn bind to DeferredReflection.prepare"...
mike bayer [Wed, 24 May 2023 13:17:24 +0000 (13:17 +0000)] 
Merge "add reflection arguments, engine/conn bind to DeferredReflection.prepare" into main

2 years agoMerge "attempt to clarify sentinel mismatch message" into main
mike bayer [Wed, 24 May 2023 13:14:52 +0000 (13:14 +0000)] 
Merge "attempt to clarify sentinel mismatch message" into main

2 years agoadd reflection arguments, engine/conn bind to DeferredReflection.prepare
Mike Bayer [Wed, 24 May 2023 02:21:30 +0000 (22:21 -0400)] 
add reflection arguments, engine/conn bind to DeferredReflection.prepare

Improved :meth:`.DeferredReflection.prepare` to accept arbitrary ``**kw``
arguments that are passed to :meth:`_schema.MetaData.reflect`, allowing use
cases such as reflection of views as well as dialect-specific arguments to
be passed. Additionally, modernized the
:paramref:`.DeferredReflection.prepare.bind` argument so that either an
:class:`.Engine` or :class:`.Connection` are accepted as the "bind"
argument.

Fixes: #9828
Change-Id: Ie93cd1147611a92f07d05df8a39052f61ee692f2

2 years agoFix formatting of cache logging output
Gord Thompson [Tue, 23 May 2023 13:50:34 +0000 (07:50 -0600)] 
Fix formatting of cache logging output

Change-Id: I8434c026b568e429fb04044a4a1c7d12acc1750e

2 years agoattempt to clarify sentinel mismatch message
Mike Bayer [Mon, 22 May 2023 23:09:31 +0000 (19:09 -0400)] 
attempt to clarify sentinel mismatch message

Fixes: #9822
Change-Id: Idd5d62e14e3018da939a985a306591d6898a397f

2 years agorestore and test correct defaults for validates() keyword args
Mike Bayer [Mon, 22 May 2023 17:12:58 +0000 (13:12 -0400)] 
restore and test correct defaults for validates() keyword args

Fixed regression in the 2.0 series where the default value of
:paramref:`_orm.validates.include_backrefs` got changed to ``False`` for
the :func:`_orm.validates` function. This default is now restored to
``True``.

Fixes: #9820
Change-Id: I9b7257b7c6e94c12fc894c7b78e5c1cb92acad67

2 years agouse python highlight for model example in large collections
Mike Bayer [Sat, 20 May 2023 15:53:44 +0000 (11:53 -0400)] 
use python highlight for model example in large collections

apparently the pycon+sql highlight doesn't work with
class definitions for some reason?   seems like something
to be aware of...

Fixes: #9810
Change-Id: I5cfca5e0fb9d797ff4068526d05e181b4ff71ebf

2 years agoVersion 2.0.16 placeholder
Mike Bayer [Sat, 20 May 2023 01:00:30 +0000 (21:00 -0400)] 
Version 2.0.16 placeholder

2 years ago- 2.0.15 rel_2_0_15
Mike Bayer [Sat, 20 May 2023 00:16:18 +0000 (20:16 -0400)] 
- 2.0.15

2 years agotypos
Mike Bayer [Sat, 20 May 2023 00:15:03 +0000 (20:15 -0400)] 
typos

Change-Id: I9df3f466e790a3f321ed4a32cce5488e9cdf68be

2 years agoMerge "establish Uuid as emulated, pg.UUID as nativeforemulated" into main
mike bayer [Fri, 19 May 2023 23:52:09 +0000 (23:52 +0000)] 
Merge "establish Uuid as emulated, pg.UUID as nativeforemulated" into main

2 years agoestablish Uuid as emulated, pg.UUID as nativeforemulated
Mike Bayer [Fri, 19 May 2023 19:56:31 +0000 (15:56 -0400)] 
establish Uuid as emulated, pg.UUID as nativeforemulated

Repaired the base :class:`.Uuid` datatype for the PostgreSQL dialect to
make proper use of the PG-specific ``UUID`` internal datatype when
"native_uuid" is selected, so that PG driver behaviors are included. This
issue became apparent due to the insertmanyvalues improvement made as part
of :ticket:`9618`, where in a similar manner as that of :ticket:` 9739`
where the asyncpg driver is very sensitive to datatype casts being present
or not, the PostgreSQL driver-specific native ``UUID`` datatype must be
invoked when this generic type is used.

also consolidate imv tests for largebinary, uuid into
suite/test_insert.py

Fixes: #9808
Change-Id: Ibadfaff86ddf7db37145b4d003ef4802bd6e8f26

2 years agoMerge "use an ORM compile state for all statements with any ORM entities anywhere...
mike bayer [Fri, 19 May 2023 19:58:25 +0000 (19:58 +0000)] 
Merge "use an ORM compile state for all statements with any ORM entities anywhere" into main

2 years agouse an ORM compile state for all statements with any ORM entities anywhere
Mike Bayer [Fri, 19 May 2023 13:35:30 +0000 (09:35 -0400)] 
use an ORM compile state for all statements with any ORM entities anywhere

As more projects are using new-style "2.0" ORM querying, it's becoming
apparent that the conditional nature of "autoflush", being based on whether
or not the given statement refers to ORM entities, is becoming more of a
key behavior. Up until now, the "ORM" flag for a statement has been loosely
based around whether or not the statement returns rows that correspond to
ORM entities or columns; the original purpose of the "ORM" flag was to
enable ORM-entity fetching rules which apply post-processing to Core result
sets as well as ORM loader strategies to the statement.  For statements
that don't build on rows that contain ORM entities, the "ORM" flag was
considered to be mostly unnecessary.

It still may be the case that "autoflush" would be better taking effect for
*all* usage of :meth:`_orm.Session.execute` and related methods, even for
purely Core SQL constructs. However, this still could impact legacy cases
where this is not expected and may be more of a 2.1 thing. For now however,
the rules for the "ORM-flag" have been opened up so that a statement that
includes ORM entities or attributes anywhere within, including in the WHERE
/ ORDER BY / GROUP BY clause alone, within scalar subqueries, etc. will
enable this flag.  This will cause "autoflush" to occur for such statements
and also be visible via the :attr:`_orm.ORMExecuteState.is_orm_statement`
event-level attribute.

Fixes: #9805
Change-Id: Idcabefc8fedd14edcf603b90e26e5982c849a1fc

2 years agoclarify exec_driver_sql
Mike Bayer [Fri, 19 May 2023 13:50:09 +0000 (09:50 -0400)] 
clarify exec_driver_sql

this docstring wasn't really saying what this method was for.

Change-Id: I2d83ed2690c93d215faadaf7c6edcb02c6c57a6f

2 years agoVersion 2.0.15 placeholder
Mike Bayer [Thu, 18 May 2023 18:17:10 +0000 (14:17 -0400)] 
Version 2.0.15 placeholder

2 years ago- 2.0.14 rel_2_0_14
Mike Bayer [Thu, 18 May 2023 18:06:26 +0000 (14:06 -0400)] 
- 2.0.14

2 years agoMerge "Move try_cast() from mssql to base" into main
mike bayer [Thu, 18 May 2023 17:28:41 +0000 (17:28 +0000)] 
Merge "Move try_cast() from mssql to base" into main

2 years agotypo
Mike Bayer [Thu, 18 May 2023 16:45:42 +0000 (12:45 -0400)] 
typo

Change-Id: Ie10e4e5674110f254d805aad0a07d4e7c0ce7f18

2 years agoMove try_cast() from mssql to base
Nick Crews [Thu, 18 May 2023 12:01:18 +0000 (08:01 -0400)] 
Move try_cast() from mssql to base

Generalized the MSSQL :func:`_sql.try_cast` function into the
``sqlalchemy.`` import namespace so that it may be implemented by third
party dialects as well. Within SQLAlchemy, the :func:`_sql.try_cast`
function remains a SQL Server-only construct that will raise
:class:`.CompileError` if used with backends that don't support it.

:func:`_sql.try_cast` implements a CAST where un-castable conversions are
returned as NULL, instead of raising an error. Theoretically, the construct
could be implemented by third party dialects for Google BigQuery, DuckDB,
and Snowflake, and possibly others.

Pull request courtesy Nick Crews.

Fixes: #9752
Closes: #9753
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9753
Pull-request-sha: 2e81b8d2c9314ca2cc5807fc807c35fefbe6ad2c

Change-Id: Ib57999b5947a2e34d5d305e294ff99dc08b01111

2 years agoMerge "remove "aliased class pool" caching approach" into main
mike bayer [Wed, 17 May 2023 15:15:42 +0000 (15:15 +0000)] 
Merge "remove "aliased class pool" caching approach" into main

2 years agoMerge "omit pypy from sizeof tests" into main
mike bayer [Wed, 17 May 2023 13:15:25 +0000 (13:15 +0000)] 
Merge "omit pypy from sizeof tests" into main

2 years agofix link issue, add ref for pytest-xdist pin
Federico Caselli [Mon, 15 May 2023 19:00:57 +0000 (21:00 +0200)] 
fix link issue, add ref for pytest-xdist pin

Change-Id: If565b2b6b968457f221eb84f0270f617618d3319

2 years agoblock pytest-xdist 3.3.0
Mike Bayer [Mon, 15 May 2023 18:59:18 +0000 (14:59 -0400)] 
block pytest-xdist 3.3.0

Change-Id: I9c68ef747ad4c87b73751158c5b7966c28816ec8
References: https://github.com/pytest-dev/pytest-xdist/issues/907

2 years agoAvoid unnecessary nested exceptions
Federico Caselli [Mon, 15 May 2023 18:50:21 +0000 (20:50 +0200)] 
Avoid unnecessary nested exceptions

Change-Id: Ibca9dc93f541992105cd915e02a3d3e9a0dbd67e

2 years agoomit pypy from sizeof tests
Mike Bayer [Mon, 15 May 2023 15:37:48 +0000 (11:37 -0400)] 
omit pypy from sizeof tests

Fixed test that relied on the ``sys.getsizeof()`` function to not run on
pypy, where this function appears to have different behavior than it does
on cpython.

Fixes: #9789
Change-Id: I07b52197c3537c0a3fb7bec0f2caa587dc04cc86

2 years agolimit joinedload exclusion rules to immediate mapped columns
Mike Bayer [Sat, 13 May 2023 16:32:31 +0000 (12:32 -0400)] 
limit joinedload exclusion rules to immediate mapped columns

Fixed issue where using additional relationship criteria with the
:func:`_orm.joinedload` loader option, where the additional criteria itself
contained correlated subqueries that referred to the joined entities and
therefore also required "adaption" to aliased entities, would be excluded
from this adaption, producing the wrong ON clause for the joinedload.

Fixes: #9779
Change-Id: Idcfec3e760057fbf6a09c10ad67a0bb4bf70f03a

2 years agoremove "aliased class pool" caching approach
Mike Bayer [Sat, 13 May 2023 03:42:09 +0000 (23:42 -0400)] 
remove "aliased class pool" caching approach

Modified the ``JoinedLoader`` implementation to use a simpler approach in
one particular area where it previously used a cached structure that would
be shared among threads. The rationale is to avoid a potential race
condition which is suspected of being the cause of a particular crash
that's been reported multiple times. The cached structure in question is
still ultimately "cached" via the compiled SQL cache, so a performance
degradation is not anticipated.

The change also modifies the tests for None in context.secondary
to ensure no None values are in this list, as this is suspected
as being the immediate cause of the issue in #9777.  The cached
AliasedClass thing is suspected as being the origination of the
cause, as under high concurrency many threads might all access
that AliasedClass immediately, which seems a reasonable place
that the "adapter returning None" symptom might be originating.

As of yet we don't have a self-contained reproducer for the
issue, some initial attempts with threads are not showing any
issue.

Fixes: #9777
Change-Id: I967588f280796c413e629b55b8d97d40c1164248

2 years agoqualify session.execute() resulting in autoflush
Mike Bayer [Sat, 13 May 2023 02:30:40 +0000 (22:30 -0400)] 
qualify session.execute() resulting in autoflush

maybe this was planned differently at some point but
session.execute() only autoflushes for ORM contexts.

Change-Id: Ia10af232248e321875f79d5bde71f64d3dc25177
References: #9776

2 years agoinclude create_type in pg.ENUM.adapt; test all attrs
Mike Bayer [Fri, 12 May 2023 18:34:00 +0000 (14:34 -0400)] 
include create_type in pg.ENUM.adapt; test all attrs

Fixed apparently very old issue where the
:paramref:`_postgresql.ENUM.create_type` parameter, when set to its
non-default of ``False``, would not be propagated when the
:class:`_schema.Column` which it's a part of were copied, as is common when
using ORM Declarative mixins.

Fixes: #9773
Change-Id: I79a7c6f052ec39b42400d92bf591c791feca573b

2 years agosubstitute include_table param rather than adding
Mike Bayer [Fri, 12 May 2023 15:20:52 +0000 (11:20 -0400)] 
substitute include_table param rather than adding

Fixed issue in :func:`_sql.values` construct where an internal compilation
error would occur if the construct were used inside of a scalar subquery.

Fixes: #9772
Change-Id: I4b0f756977abafbd2aabaaa0064baa875249ebe1

2 years agoMerge "return empty MappedColumn() at early pep-593 step" into main
mike bayer [Thu, 11 May 2023 17:20:21 +0000 (17:20 +0000)] 
Merge "return empty MappedColumn() at early pep-593 step" into main

2 years agoskip ORM loading setups for non-toplevel DML
Mike Bayer [Thu, 11 May 2023 14:06:10 +0000 (10:06 -0400)] 
skip ORM loading setups for non-toplevel DML

Fixed regression where use of :func:`_dml.update` or :func:`_dml_delete`
within a :class:`_sql.CTE` construct, then used in a :func:`_sql.select`,
would raise a :class:`.CompileError` as a result of ORM related rules for
performing ORM-level update/delete statements.

Fixes: #9767
Change-Id: I4eae9af86752b2e5fd64f7998f8a68754c349e4c

2 years agoreturn empty MappedColumn() at early pep-593 step
Mike Bayer [Thu, 11 May 2023 02:03:18 +0000 (22:03 -0400)] 
return empty MappedColumn() at early pep-593 step

Fixed issue in new ORM Annotated Declarative where using a
:class:`_schema.ForeignKey` (or other column-level constraint) inside of
:func:`_orm.mapped_column` which is then copied out to models via pep-593
``Annotated`` would apply duplicates of each constraint to the
:class:`_schema.Column` as produced in the target :class:`_schema.Table`,
leading to incorrect CREATE TABLE DDL as well as migration directives under
Alembic.

Fixes: #9766
Change-Id: I8a3b2716bf393d1d2b5894f9f72b45fa59df1e08

2 years agoVersion 2.0.14 placeholder
Mike Bayer [Wed, 10 May 2023 22:30:29 +0000 (18:30 -0400)] 
Version 2.0.14 placeholder

2 years ago- 2.0.13 rel_2_0_13
Mike Bayer [Wed, 10 May 2023 22:23:10 +0000 (18:23 -0400)] 
- 2.0.13

2 years agoadd missing docs
Mike Bayer [Wed, 10 May 2023 20:44:02 +0000 (16:44 -0400)] 
add missing docs

ColumnExpressionArgument, as well as Oracle datatypes
mentioned in the changelog

Change-Id: I9496de9a1092af21f84492ff9d91a0cefb1a8a5b

2 years agoMerge "add full parameter types for ORM with_for_update" into main
mike bayer [Wed, 10 May 2023 20:15:15 +0000 (20:15 +0000)] 
Merge "add full parameter types for ORM with_for_update" into main

2 years agoadd full parameter types for ORM with_for_update
Mike Bayer [Wed, 10 May 2023 15:08:07 +0000 (11:08 -0400)] 
add full parameter types for ORM with_for_update

Fixed typing for the :paramref:`_orm.Session.get.with_for_update` parameter
of :meth:`_orm.Session.get` and :meth:`_orm.Session.refresh` (as well as
corresponding methods on :class:`_asyncio.AsyncSession`) to accept boolean
``True`` and all other argument forms accepted by the parameter at runtime.

Fixes: #9762
Change-Id: Ied4d37a269906b3d9be5ab7d31a2fa863360cced

2 years agoMerge "fix test suite warnings" into main
mike bayer [Wed, 10 May 2023 15:11:06 +0000 (15:11 +0000)] 
Merge "fix test suite warnings" into main

2 years agonote future row change for session.execute()
Mike Bayer [Wed, 10 May 2023 14:08:47 +0000 (10:08 -0400)] 
note future row change for session.execute()

Fixes: #9761
Change-Id: I555e822b092d047badab86b3a365380121968592

2 years agofix test suite warnings
Mike Bayer [Sun, 30 Apr 2023 22:27:24 +0000 (18:27 -0400)] 
fix test suite warnings

fix a handful of warnings that were emitting but not raising,
usually because they were inside an "expect_warnings" block.

modify "expect_warnings" to always use "raise_on_any_unexpected"
behavior; remove this parameter.

Fixed issue in semi-private ``await_only()`` and ``await_fallback()``
concurrency functions where the given awaitable would remain un-awaited if
the function threw a ``GreenletError``, which could cause "was not awaited"
warnings later on if the program continued. In this case, the given
awaitable is now cancelled before the exception is thrown.

Change-Id: I33668c5e8c670454a3d879e559096fb873b57244

2 years agoMerge "guard against duplicate mutable event listeners" into main
mike bayer [Tue, 9 May 2023 21:54:03 +0000 (21:54 +0000)] 
Merge "guard against duplicate mutable event listeners" into main

2 years agoguard against duplicate mutable event listeners
Mike Bayer [Tue, 9 May 2023 15:19:43 +0000 (11:19 -0400)] 
guard against duplicate mutable event listeners

Fixed issue in :class:`_mutable.Mutable` where event registration for ORM
mapped attributes would be called repeatedly for mapped inheritance
subclasses, leading to duplicate events being invoked in inheritance
hierarchies.

Fixes: #9676
Change-Id: I91289141d7a5f5c86a9033596735ed6eba7071b0

2 years agoMerge "Ensure float are not implemented as numeric" into main
mike bayer [Tue, 9 May 2023 17:55:16 +0000 (17:55 +0000)] 
Merge "Ensure float are not implemented as numeric" into main

2 years agoallow column named twice warning to take effect
Mike Bayer [Tue, 9 May 2023 15:33:30 +0000 (11:33 -0400)] 
allow column named twice warning to take effect

Fixed issue in :func:`_orm.mapped_column` construct where the correct
warning for "column X named directly multiple times" would not be emitted
when ORM mapped attributes referred to the same :class:`_schema.Column`, if
the :func:`_orm.mapped_column` construct were involved, raising an internal
assertion instead.

Fixes: #9630
Change-Id: I5d9dfaaa225aefb487c9cd981ba3ad78507bb577

2 years agoMerge "implement FromLinter for UPDATE, DELETE statements" into main
mike bayer [Tue, 9 May 2023 14:56:55 +0000 (14:56 +0000)] 
Merge "implement FromLinter for UPDATE, DELETE statements" into main

2 years agoupdate errors page for greenlet error
Mike Bayer [Tue, 9 May 2023 14:54:10 +0000 (10:54 -0400)] 
update errors page for greenlet error

the language here is adjusted to accommodate for newer
patterns with lazy loading and asyncio, most prominently
``AsyncAtrs``.

Change-Id: I9b2b9329158193f803c55c7e36dae16377e6c8e1

2 years agoMerge "Improve oracle index reflection" into main
mike bayer [Tue, 9 May 2023 14:39:18 +0000 (14:39 +0000)] 
Merge "Improve oracle index reflection" into main

2 years agoMerge "add bind casts for BYTEA on asyncpg" into main
mike bayer [Tue, 9 May 2023 14:31:19 +0000 (14:31 +0000)] 
Merge "add bind casts for BYTEA on asyncpg" into main

2 years agoEnsure float are not implemented as numeric
Federico Caselli [Wed, 26 Apr 2023 19:40:38 +0000 (21:40 +0200)] 
Ensure float are not implemented as numeric

Fixed the base class for dialect-specific float/double types; Oracle
:class:`_oracle.BINARY_DOUBLE` now subclasses :class:`_sqltypes.Double`,
and internal types for :class:`_sqltypes.Float` for asyncpg and pg8000 now
correctly subclass :class:`_sqltypes.Float`.

Added suite tests to ensure that floating point types, such as
class:`_types.Float` and :class:`_types.Double` are not resolved as
class:`_types.Numeric` in the dialect, since it may not compatible in
all cases, such as when casting a value.

Change-Id: I20b814e8e029d57921d9728a55f2570f74c35c87

2 years agoMerge "add AsyncAttrs" into main
mike bayer [Tue, 9 May 2023 14:10:24 +0000 (14:10 +0000)] 
Merge "add AsyncAttrs" into main

2 years agoimplement FromLinter for UPDATE, DELETE statements
Mike Bayer [Fri, 28 Apr 2023 16:07:09 +0000 (12:07 -0400)] 
implement FromLinter for UPDATE, DELETE statements

Implemented the "cartesian product warning" for UPDATE and DELETE
statements, those which include multiple tables that are not correlated
together in some way.

Fixed issue where :func:`_dml.update` construct that included multiple
tables and no VALUES clause would raise with an internal error. Current
behavior for :class:`_dml.Update` with no values is to generate a SQL
UPDATE statement with an empty "set" clause, so this has been made
consistent for this specific sub-case.

Fixes: #9721
Change-Id: I556639811cc930d2e37532965d2ae751882af921

2 years agoFix usage of `Annotated` in `DeclarativeBase` docstring (#9751)
Viicos [Mon, 8 May 2023 20:19:47 +0000 (22:19 +0200)] 
Fix usage of `Annotated` in `DeclarativeBase` docstring (#9751)

2 years agoadd AsyncAttrs
Mike Bayer [Fri, 5 May 2023 15:50:29 +0000 (11:50 -0400)] 
add AsyncAttrs

Added a new helper mixin :class:`_asyncio.AsyncAttrs` that seeks to improve
the use of lazy-loader and other expired or deferred ORM attributes with
asyncio, providing a simple attribute accessor that provides an ``await``
interface to any ORM attribute, whether or not it needs to emit SQL.

Change-Id: I1427b288dc28319c854372643066c491b9ee8dc0
References: #9731

2 years agofix test on old sqlite
Federico Caselli [Fri, 5 May 2023 21:22:46 +0000 (23:22 +0200)] 
fix test on old sqlite

Change-Id: Ic7dbb7df6a10077eb28a721e151b2194ab3b1634

2 years agoadd explicit step to set populate_existing for bulk insert
Mike Bayer [Fri, 5 May 2023 13:16:10 +0000 (09:16 -0400)] 
add explicit step to set populate_existing for bulk insert

Fixed issue in new :ref:`orm_queryguide_upsert_returning` feature where the
``populate_existing`` execution option was not being propagated to the
loading option, preventing existing attributes from being refreshed
in-place.

Fixes: #9746
Change-Id: I3efcab644e2b5874c6b265d5313f353c051db629

2 years agoMerge "Add public alias of type _ColumnExpressionArgument" into main
mike bayer [Thu, 4 May 2023 12:56:59 +0000 (12:56 +0000)] 
Merge "Add public alias of type _ColumnExpressionArgument" into main

2 years agoMerge "adjust fwd_ref logic" into main
mike bayer [Thu, 4 May 2023 12:54:18 +0000 (12:54 +0000)] 
Merge "adjust fwd_ref logic" into main

2 years agoMerge "improve natural_path usage in two places" into main
mike bayer [Thu, 4 May 2023 12:53:40 +0000 (12:53 +0000)] 
Merge "improve natural_path usage in two places" into main

2 years agoadd bind casts for BYTEA on asyncpg
Mike Bayer [Thu, 4 May 2023 02:33:28 +0000 (22:33 -0400)] 
add bind casts for BYTEA on asyncpg

Fixed another regression due to the "insertmanyvalues" change in 2.0.10 as
part of :ticket:`9618`, in a similar way as regression :ticket:`9701`, where
:class:`.LargeBinary` datatypes also need additional casts on when using the
asyncpg driver specifically in order to work with the new bulk INSERT
format.

Fixes: #9739
Change-Id: I57370d269ea757f263c1f3a16c324ceae76fd4e8

2 years agoVersion 2.0.13 placeholder
Mike Bayer [Sun, 30 Apr 2023 21:42:23 +0000 (17:42 -0400)] 
Version 2.0.13 placeholder

2 years ago- 2.0.12 rel_2_0_12
Mike Bayer [Sun, 30 Apr 2023 21:34:36 +0000 (17:34 -0400)] 
- 2.0.12

2 years agocherry-pick changelog update for 1.4.49
Mike Bayer [Sun, 30 Apr 2023 21:33:17 +0000 (17:33 -0400)] 
cherry-pick changelog update for 1.4.49

2 years agocherry-pick changelog from 1.4.48
Mike Bayer [Sun, 30 Apr 2023 21:33:17 +0000 (17:33 -0400)] 
cherry-pick changelog from 1.4.48

2 years agoadjust verbiage
Mike Bayer [Sun, 30 Apr 2023 21:22:44 +0000 (17:22 -0400)] 
adjust verbiage

Change-Id: Icc8f201d63e4cc2e7df2f42acb28a6dc84a58342

2 years agoMerge "do not allow non-cache-key entity objects in annotations" into main
mike bayer [Sun, 30 Apr 2023 21:17:37 +0000 (21:17 +0000)] 
Merge "do not allow non-cache-key entity objects in annotations" into main

2 years agoMerge "Add scalar example in association proxy examples" into main
mike bayer [Sun, 30 Apr 2023 19:06:13 +0000 (19:06 +0000)] 
Merge "Add scalar example in association proxy examples" into main

2 years agodo not allow non-cache-key entity objects in annotations
Mike Bayer [Sun, 30 Apr 2023 17:56:33 +0000 (13:56 -0400)] 
do not allow non-cache-key entity objects in annotations

Fixed critical caching issue where combination of :func:`_orm.aliased()`
:func:`_sql.case` and :func:`_hybrid.hybrid_property` expressions would
cause a cache key mismatch, leading to cache keys that held onto the actual
:func:`_orm.aliased` object while also not matching each other, filling up
the cache.

Fixes: #9728
Change-Id: I700645b5629a81a0104cf923db72a7421fa43ff4

2 years agoSupport control char reflection in mysql mariadb
Federico Caselli [Sat, 29 Apr 2023 10:07:32 +0000 (12:07 +0200)] 
Support control char reflection in mysql mariadb

Fixed issues regarding reflection of comments for :class:`_schema.Table`
and :class:`_schema.Column` objects, where the comments contained control
characters such as newlines. Additional testing support for these
characters as well as extended Unicode characters in table and column
comments (the latter of which aren't supported by MySQL/MariaDB) added to
testing overall.

Fixes: #9722
Change-Id: Id18bf758fdb6231eb705c61eeaf74bb9fa472601

2 years agoimprove natural_path usage in two places
Mike Bayer [Thu, 27 Apr 2023 20:48:25 +0000 (16:48 -0400)] 
improve natural_path usage in two places

Fixed loader strategy pathing issues where eager loaders such as
:func:`_orm.joinedload` / :func:`_orm.selectinload` would fail to traverse
fully for many-levels deep following a load that had a
:func:`_orm.with_polymorphic` or similar construct as an interim member.

Here we can take advantage of 2.0's refactoring of strategy_options
to identify the "chop_path" concept can be simplified to work
with "natural" paths alone.

In addition, identified existing
logic in PropRegistry that works fine, but needed the "is_unnatural"
attribute to be more accurate for a given path, so we set that
up front to True if the ancestor is_unnatural.

Fixes: #9715
Change-Id: Ie6b3f55b6a23d0d32628afd22437094263745114

2 years agoAdd scalar example in association proxy examples
Federico Caselli [Fri, 28 Apr 2023 20:26:41 +0000 (22:26 +0200)] 
Add scalar example in association proxy examples

Fixes: #9699
Change-Id: I73f800b9b3676cbf0ac04534c0ca4e40f23bf0ec

2 years agoImprove oracle index reflection
Federico Caselli [Tue, 25 Apr 2023 11:47:04 +0000 (13:47 +0200)] 
Improve oracle index reflection

Added reflection support in the Oracle dialect to expression based indexes
and the ordering direction of index expressions.

Fixes: #9597
Change-Id: I40e163496789774e9930f46823d2208c35eab6f8

2 years agoadjust fwd_ref logic
Mike Bayer [Fri, 28 Apr 2023 03:00:18 +0000 (23:00 -0400)] 
adjust fwd_ref logic

Fixed issue where ORM Annotated Declarative would not resolve forward
references correctly in all cases; in particular, when using
``from __future__ import annotations`` in combination with Pydantic
dataclasses.

Change-Id: If643c9a4ac7e217d4cb3a7d09b96cfd49432c44e
References: #9717

2 years agofix callcounts for postgresql
Mike Bayer [Fri, 28 Apr 2023 01:40:57 +0000 (21:40 -0400)] 
fix callcounts for postgresql

due to recent perf changes the PG callcounts also need
adjustment

Change-Id: I4375cccb1ce9e3cf1964ab48da748dbbc1ead37c

2 years agoAdd public alias of type _ColumnExpressionArgument
Federico Caselli [Mon, 24 Apr 2023 09:24:32 +0000 (11:24 +0200)] 
Add public alias of type _ColumnExpressionArgument

Added type ``ColumnExpressionArgument`` as a public alias of an internal
type. This type is useful since it's what' accepted by the sqlalchemy in
many api calls, such as :meth:`_sql.Select.where`, :meth:`_sql.and` and
many other.

Fixes: #9656
Change-Id: I79a38a0c1417d0ed1b6efff00497dba5e2be4f79