]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agochange sql to schema
Mike Bayer [Tue, 6 Apr 2021 22:49:58 +0000 (18:49 -0400)] 
change sql to schema

Change-Id: Ida93320d9b57e076786acc73a1c835cf1961675f

4 years agoMerge "Table arguments name and metadata are positional only"
mike bayer [Tue, 6 Apr 2021 22:29:39 +0000 (22:29 +0000)] 
Merge "Table arguments name and metadata are positional only"

4 years agomark #6202 as a regression
Mike Bayer [Tue, 6 Apr 2021 22:20:20 +0000 (18:20 -0400)] 
mark #6202 as a regression

Change-Id: I0a1fdf0132ab498df57004fa0d0bd85da9c393e1

4 years agoMerge "Disable and disallow Result.unique() with yield_per"
mike bayer [Tue, 6 Apr 2021 21:55:33 +0000 (21:55 +0000)] 
Merge "Disable and disallow Result.unique() with yield_per"

4 years agoTable arguments name and metadata are positional only
Federico Caselli [Mon, 5 Apr 2021 19:57:24 +0000 (21:57 +0200)] 
Table arguments name and metadata are positional only

The :class:`_sql.Table` object now raises an informative error message if
it is instantiated without passing at least the :paramref:`_sql.Table.name`
and :paramref:`_sql.Table.metadata` arguments positionally. Previously, if
these were passed as keyword arguments, the object would silently fail to
initialize correctly.

Fixes: #6135
Change-Id: I54d0c89fd549fc504289a87ea0bb37369f982b06

4 years agoDisable and disallow Result.unique() with yield_per
Mike Bayer [Tue, 6 Apr 2021 20:47:00 +0000 (16:47 -0400)] 
Disable and disallow Result.unique() with yield_per

Fixed critical regression where the :meth:`_orm.Query.yield_per` method in
the ORM would set up the internal :class:`_engine.Result` to yield chunks
at a time, however made use of the new :meth:`_engine.Result.unique` method
which uniques across the entire result. This would lead to lost rows since
the ORM is using ``id(obj)`` as the uniquing function, which leads to
repeated identifiers for new objects as already-seen objects are garbage
collected. 1.3's behavior here was to "unique" across each chunk, which
does not actually produce "uniqued" results when results are yielded in
chunks. As the :meth:`_orm.Query.yield_per` method is already explicitly
disallowed when joined eager loading is in place, which is the primary
rationale for the "uniquing" feature, the "uniquing" feature is now turned
off entirely when :meth:`_orm.Query.yield_per` is used.

This regression only applies to the legacy :class:`_orm.Query` object; when
using :term:`2.0 style` execution, "uniquing" is not automatically applied.
To prevent the issue from arising from explicit use of
:meth:`_engine.Result.unique`, an error is now raised if rows are fetched
from a "uniqued" ORM-level :class:`_engine.Result` if any
:ref:`yield per <orm_queryguide_yield_per>` API is also in use, as the
purpose of ``yield_per`` is to allow for arbitrarily large numbers of rows,
which cannot be uniqued in memory without growing the number of entries to
fit the complete result size.

Fixes: #6206
Change-Id: I3770d1f2e9be44d82c83ca992afb912dcc17af05

4 years agoAccommodate for callable fns for collection_class
Mike Bayer [Tue, 6 Apr 2021 15:12:49 +0000 (11:12 -0400)] 
Accommodate for callable fns for collection_class

Fixed issue where the Mypy plugin would fail to interpret the
"collection_class" of a relationship if it were a callable and not a class.
Also improved type matching and error reporting for collection-oriented
relationships.

Fixes: #6205
Change-Id: If3cb0defd4d7336e06a3bb3a3e8d59ea34b4c98d

4 years agoMerge "Disallow AliasedReturnsRows from execution"
mike bayer [Tue, 6 Apr 2021 14:29:44 +0000 (14:29 +0000)] 
Merge "Disallow AliasedReturnsRows from execution"

4 years agoDisallow AliasedReturnsRows from execution
Mike Bayer [Tue, 6 Apr 2021 02:14:18 +0000 (22:14 -0400)] 
Disallow AliasedReturnsRows from execution

Executing a :class:`_sql.Subquery` using :meth:`_engine.Connection.execute`
is deprecated and will emit a deprecation warning; this use case was an
oversight that should have been removed from 1.4. The operation will now
execute the underlying :class:`_sql.Select` object directly for backwards
compatibility. Similarly, the :class:`_sql.CTE` class is also not
appropriate for execution. In 1.3, attempting to execute a CTE would result
in an invalid "blank" SQL statement being executed; since this use case was
not working it now raises :class:`_exc.ObjectNotExecutableError`.
Previously, 1.4 was attempting to execute the CTE as a statement however it
was working only erratically.

The change also breaks out StatementRole from ReturnsRowsRole, as these
roles should not be in the same lineage (some statements don't return
rows, the whole class of ReturnsRows that are from clauses are
not statements).    Consolidate StatementRole and
CoerceTextStatementRole as there's no usage difference between
these.   Simplify some old tests that were trying to make
sure that "execution options" didn't transmit from a cte/subquery
out to a select; as cte/subuqery() aren't executable in any case
the options are removed.

Fixes: #6204
Change-Id: I62613b7ab418afdd22c409eae75659e3f52fb65f

4 years agoMerge "Add pgcode / sqlstate for asyncpg error message"
mike bayer [Tue, 6 Apr 2021 02:32:56 +0000 (02:32 +0000)] 
Merge "Add pgcode / sqlstate for asyncpg error message"

4 years agoMerge "Adjust for mypy incremental behaviors"
mike bayer [Tue, 6 Apr 2021 01:48:06 +0000 (01:48 +0000)] 
Merge "Adjust for mypy incremental behaviors"

4 years agoAdd pgcode / sqlstate for asyncpg error message
Mike Bayer [Mon, 5 Apr 2021 18:41:31 +0000 (14:41 -0400)] 
Add pgcode / sqlstate for asyncpg error message

Added accessors ``.sqlstate`` and synonym ``.pgcode`` to the ``.orig``
attribute of the SQLAlchemy exception class raised by the asyncpg DBAPI
adapter, that is, the intermediary exception object that wraps on top of
that raised by the asyncpg library itself, but below the level of the
SQLAlchemy dialect.

Fixes: #6199
Change-Id: Ie0f1ffaaff47c7a50dd1fbccdbe588cdc5322b70

4 years agoMerge "Detect (Entity, Entity) vs (Entity, onclause) in legacy join"
mike bayer [Tue, 6 Apr 2021 00:10:28 +0000 (00:10 +0000)] 
Merge "Detect (Entity, Entity) vs (Entity, onclause) in legacy join"

4 years agouniquify when popping literal_execute_params from param dict
Mike Bayer [Mon, 5 Apr 2021 20:32:14 +0000 (16:32 -0400)] 
uniquify when popping literal_execute_params from param dict

Fixed further issues in the same area as that of :ticket:`6173` released in
1.4.5, where a "postcompile" parameter, again most typically those used for
LIMIT/OFFSET rendering in Oracle and SQL Server, would fail to be processed
correctly if the same parameter rendered in multiple places in the
statement.

Fixes: #6202
Change-Id: I95c355aa52a7546fe579ad67f9a8402a213cb79d

4 years agoDetect (Entity, Entity) vs (Entity, onclause) in legacy join
Mike Bayer [Mon, 5 Apr 2021 21:37:56 +0000 (17:37 -0400)] 
Detect (Entity, Entity) vs (Entity, onclause) in legacy join

Fixed regression where a deprecated form of :meth:`_orm.Query.join` were
used, passing a series of entities to join from without any ON clause in a
single :meth:`_orm.Query.join` call, would fail to function correctly.

Fixes: #6203
Change-Id: I5a6ec80de972af5b2ca9054e6f24a0b8af4a3e13

4 years agoAdjust for mypy incremental behaviors
Mike Bayer [Fri, 26 Mar 2021 23:45:29 +0000 (19:45 -0400)] 
Adjust for mypy incremental behaviors

Applied a series of refactorings and fixes to accommodate for Mypy
"incremental" mode across multiple files, which previously was not taken
into account. In this mode the Mypy plugin has to accommodate Python
datatypes expressed in other files coming in with less information than
they have on a direct run.

Additionally, a new decorator :func:`_orm.declarative_mixin` is added,
which is necessary for the Mypy plugin to be able to definifitely identify
a Declarative mixin class that is otherwise not used inside a particular
Python file.

discussion:

With incremental / deserialized mypy runs, it appears
that when we look at a base class that comes from another file,
cls.info is set to a special undefined node
that matches CLASSDEF_NO_INFO, and we otherwise can't
touch it without crashing.  Additionally, sometimes cls.defs.body
is present but empty.

However, it appears that both of these cases can be sidestepped,
first by doing a lookup() for the type name where we
get a SymbolTableNode that then has the TypeInfo we wanted
when we tried touching cls.info, and then however we got the
TypeInfo, if cls.defs.body is empty we can just look in the
names to get at the symbols for that class; we just can't
access AssignmentStmts, but that's fine because we just
need the information for classes we aren't actually type checking.

This work also revealed there's no easy way to detect a mixin
class so we just create a new decorator to mark that.  will make
code look better in any case.

Fixes: #6147
Change-Id: Ia8fac8acfeec931d8f280491cffc5c6cb4a1204e

4 years agoMerge remote-tracking branch 'origin/pr/6197'
Mike Bayer [Mon, 5 Apr 2021 18:15:01 +0000 (14:15 -0400)] 
Merge remote-tracking branch 'origin/pr/6197'

Change-Id: I41bc3b932b06d3fe842366229fd0d3573da9ad35

4 years agoMerge pull request #6200 from kkirsche/patch-1
Federico Caselli [Mon, 5 Apr 2021 16:21:58 +0000 (18:21 +0200)] 
Merge pull request #6200 from kkirsche/patch-1

Fix incorrect module reference in migration docs

4 years agoFix incorrect module reference in migration docs 6200/head
Kevin Kirsche [Mon, 5 Apr 2021 12:24:00 +0000 (08:24 -0400)] 
Fix incorrect module reference in migration docs

Fix incorrect module reference (`sa_exc` instead of `exc`) in migration docs.

Found in page: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html

4 years agoBug fix for code example 6197/head
Edward Betts [Sun, 4 Apr 2021 07:40:07 +0000 (08:40 +0100)] 
Bug fix for code example

Correct a mistake in a code example.

4 years agoDocument inserted_primary_key_rows
Mike Bayer [Sun, 4 Apr 2021 04:41:28 +0000 (00:41 -0400)] 
Document inserted_primary_key_rows

This accessor was misleading in that it indicated a general
capability to return inserted primary key values for multiple
rows at once.  Clarify this is not currently the case
as the feature is only suppported by the psycopg2 dialect
at the moment.

Fixes: #6194
Change-Id: I2a9cf5f47082d948d52208d2a3bad2d7ab38710e

4 years agounfail test_uuid_array for pg8000
Mike Bayer [Sat, 3 Apr 2021 22:43:47 +0000 (18:43 -0400)] 
unfail test_uuid_array for pg8000

seems to pass as of pg8000 1.19.1

Change-Id: I1c496b6055fd5dfe0df63f92a4f9363938c32aed

4 years agoVersion 1.4.6 placeholder
Mike Bayer [Fri, 2 Apr 2021 16:21:30 +0000 (12:21 -0400)] 
Version 1.4.6 placeholder

4 years ago- 1.4.5 rel_1_4_5
Mike Bayer [Fri, 2 Apr 2021 16:00:02 +0000 (12:00 -0400)] 
- 1.4.5

4 years agochangelog updates
Mike Bayer [Fri, 2 Apr 2021 15:52:29 +0000 (11:52 -0400)] 
changelog updates

Change-Id: I56e3ca289d7fe588a5f441a8bb1758d6cd615d54

4 years agoMerge "Ensure Grouping._with_binary_element_type() maintains class"
mike bayer [Fri, 2 Apr 2021 15:48:54 +0000 (15:48 +0000)] 
Merge "Ensure Grouping._with_binary_element_type() maintains class"

4 years agoMerge "Improve noload documentation"
mike bayer [Fri, 2 Apr 2021 15:26:11 +0000 (15:26 +0000)] 
Merge "Improve noload documentation"

4 years agoImprove noload documentation
Federico Caselli [Thu, 1 Apr 2021 17:36:23 +0000 (19:36 +0200)] 
Improve noload documentation

Fixes: #6156
Change-Id: I932de0e7ada0ae9079c0a0c1c72a50d7117d02fe

4 years agoEnsure Grouping._with_binary_element_type() maintains class
Mike Bayer [Fri, 2 Apr 2021 15:06:28 +0000 (11:06 -0400)] 
Ensure Grouping._with_binary_element_type() maintains class

Fixed regression where use of the :meth:`.Operators.in_` method with a
:class:`_sql.Select` object against a non-table-bound column would produce
an ``AttributeError``, or more generally using a :class:`_sql.ScalarSelect`
that has no datatype in a binary expression would produce invalid state.

Fixes: #6181
Change-Id: I1ddea433b3603fdab8f489bff571b512a6ffc66b

4 years agoMerge "Add ``omit_aliases`` in ``Enum``."
mike bayer [Fri, 2 Apr 2021 00:57:05 +0000 (00:57 +0000)] 
Merge "Add ``omit_aliases`` in ``Enum``."

4 years agoDefault caching to opt-out for 3rd party dialects
Mike Bayer [Thu, 1 Apr 2021 21:20:31 +0000 (17:20 -0400)] 
Default caching to opt-out for 3rd party dialects

Added a new flag to the :class:`_engine.Dialect` class called
:attr:`_engine.Dialect.supports_statement_cache`. This flag now needs to be present
directly on a dialect class in order for SQLAlchemy's
:ref:`query cache <sql_caching>` to take effect for that dialect. The
rationale is based on discovered issues such as :ticket:`6173` revealing
that dialects which hardcode literal values from the compiled statement,
often the numerical parameters used for LIMIT / OFFSET, will not be
compatible with caching until these dialects are revised to use the
parameters present in the statement only. For third party dialects where
this flag is not applied, the SQL logging will show the message "dialect
does not support caching", indicating the dialect should seek to apply this
flag once they have verified that no per-statement literal values are being
rendered within the compilation phase.

Fixes: #6184
Change-Id: I6fd5b5d94200458d4cb0e14f2f556dbc25e27e22

4 years agoAdd ``omit_aliases`` in ``Enum``.
Federico Caselli [Mon, 29 Mar 2021 20:30:49 +0000 (22:30 +0200)] 
Add ``omit_aliases`` in ``Enum``.

Introduce a new parameter :paramref:`_types.Enum.omit_aliases` in
:class:`_types.Enum` type allow filtering aliases when using a pep435 Enum.
Previous versions of SQLAlchemy kept aliases in all cases, creating
database enum type with additional states, meaning that they were treated
as different values in the db. For backward compatibility this flag
defaults to ``False`` in the 1.4 series, but will be switched to ``True``
in a future version. A deprecation warning is raise if this flag is not
specified and the passed enum contains aliases.

Fixes: #6146
Change-Id: I547322ffa90d0273d91bb3bf8bfea6ec934d48b9

4 years agoMerge "Fix has table reflection on MySQL 5.0 5.1"
mike bayer [Thu, 1 Apr 2021 20:01:15 +0000 (20:01 +0000)] 
Merge "Fix has table reflection on MySQL 5.0 5.1"

4 years agoMerge "Prevent loading contextvars in python 3.6"
Federico Caselli [Thu, 1 Apr 2021 19:52:04 +0000 (19:52 +0000)] 
Merge "Prevent loading contextvars in python 3.6"

4 years agoFix has table reflection on MySQL 5.0 5.1
Federico Caselli [Thu, 1 Apr 2021 17:47:20 +0000 (19:47 +0200)] 
Fix has table reflection on MySQL 5.0 5.1

Fixed regression in the MySQL dialect where the reflection query used to
detect if a table exists would fail on very old MySQL 5.0 and 5.1 versions.

Fixes: #6151
Change-Id: I48e98542c3a1a49519a5d113e43ba6f917e8580e

4 years agoPrevent loading contextvars in python 3.6
Federico Caselli [Thu, 1 Apr 2021 18:33:53 +0000 (20:33 +0200)] 
Prevent loading contextvars in python 3.6

Fixes: #6166
Change-Id: I1355e9a8b6455ca377892214e9426c8f70441f98

4 years agoMerge "Apply quoting to render_derived() names"
mike bayer [Thu, 1 Apr 2021 18:32:23 +0000 (18:32 +0000)] 
Merge "Apply quoting to render_derived() names"

4 years agoApply quoting to render_derived() names
Mike Bayer [Thu, 1 Apr 2021 16:46:41 +0000 (12:46 -0400)] 
Apply quoting to render_derived() names

Fixed bug in new :meth:`_functions.FunctionElement.render_derived` feature
where column names rendered out explicitly in the alias SQL would not have
proper quoting applied for case sensitive names and other non-alphanumeric
names.

Fixes: #6183
Change-Id: I33e2534affc6e1f449f564750028fd027cb0f352

4 years agoCorrect for Variant + ARRAY cases in psycopg2
Mike Bayer [Thu, 1 Apr 2021 16:26:06 +0000 (12:26 -0400)] 
Correct for Variant + ARRAY cases in psycopg2

Fixed regression caused by :ticket:`6023` where the PostgreSQL cast
operator applied to elements within an :class:`_types.ARRAY` when using
psycopg2 would fail to use the correct type in the case that the datatype
were also embedded within an instance of the :class:`_types.Variant`
adapter.

Additionally, repairs support for the correct CREATE TYPE to be emitted
when using a ``Variant(ARRAY(some_schema_type))``.

Fixes: #6182
Change-Id: I1b9ba7c876980d4650715a0b0801b46bdc72860d

4 years agoMerge "Fix MSSQL / Oracle limit/offset regressions"
mike bayer [Thu, 1 Apr 2021 14:33:11 +0000 (14:33 +0000)] 
Merge "Fix MSSQL / Oracle limit/offset regressions"

4 years agoFix MSSQL / Oracle limit/offset regressions
Federico Caselli [Tue, 30 Mar 2021 21:15:04 +0000 (23:15 +0200)] 
Fix MSSQL / Oracle limit/offset regressions

Fixed a regression in MSSQL 2012+ that prevented the order clause
to be rendered when ``offset=0`` is used in a subquery.

Fixed critical regression where the Oracle compiler would not maintain the
correct parameter values in the LIMIT/OFFSET for a select due to a caching
issue.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #6163
Fixes: #6173
Change-Id: Ieb12354271d09ad935d684ee0db4fa0128837215

4 years agoCorrect for CTE correspondence w/ aliased CTE
Mike Bayer [Wed, 31 Mar 2021 23:38:10 +0000 (19:38 -0400)] 
Correct for CTE correspondence w/ aliased CTE

Fixed regression where the :func:`_orm.joinedload` loader strategy would
not successfully joinedload to a mapper that is mapper against a
:class:`.CTE` construct.

Fixes: #6172
Change-Id: I667e46d00d4209dab5a89171118a00a7c30fb542

4 years agoMerge "Add DeclarativeMeta to globals"
mike bayer [Wed, 31 Mar 2021 22:30:06 +0000 (22:30 +0000)] 
Merge "Add DeclarativeMeta to globals"

4 years agoMerge "Expand sibling tests for overlaps warning"
mike bayer [Wed, 31 Mar 2021 18:49:21 +0000 (18:49 +0000)] 
Merge "Expand sibling tests for overlaps warning"

4 years agoMerge "Repair pg8000 disconnect patch"
mike bayer [Wed, 31 Mar 2021 18:46:48 +0000 (18:46 +0000)] 
Merge "Repair pg8000 disconnect patch"

4 years agoAdd DeclarativeMeta to globals
Mike Bayer [Sun, 28 Mar 2021 15:09:40 +0000 (11:09 -0400)] 
Add DeclarativeMeta to globals

Fixed issue in mypy plugin where newly added support for
:func:`_orm.as_declarative` needed to more fully add the
``DeclarativeMeta`` class to the mypy interpreter's state so that it does
not result in a name not found error; additionally improves how global
names are setup for the plugin including the ``Mapped`` name.

Introduces directory oriented testing as well, where a full
set of files will be copied, mypy runs, then zero or more patches
are applied and mypy is run again, to fully test incremental
behaviors.

Fixes: sqlalchemy/sqlalchemy2-stubs/#14
Change-Id: Ide785c07e19ba0694e8cf6f91560094ecb182016

4 years agoMerge "Repair PGInspector"
mike bayer [Wed, 31 Mar 2021 17:57:08 +0000 (17:57 +0000)] 
Merge "Repair PGInspector"

4 years agoRepair pg8000 disconnect patch
Mike Bayer [Wed, 31 Mar 2021 13:53:35 +0000 (09:53 -0400)] 
Repair pg8000 disconnect patch

For unknown reasons a space character got into the error message
being tested in #6099.  The fix is entirely non working in 1.4.4.

Fixes: #6099
Change-Id: Ib2929be59d62eb2446fc8f040293c9228df7a531

4 years agorepair rowcount test
Mike Bayer [Wed, 31 Mar 2021 17:55:30 +0000 (13:55 -0400)] 
repair rowcount test

in 42185a1f3866bfc8ebffa2a6c724fac I pushed a simple rowcount
assertion, forgetting that we have some mssql case where rowcount
is not supported.

Change-Id: I2e86ed9da05723ac5c0929cb8bb156117d581905

4 years agoExpand sibling tests for overlaps warning
Mike Bayer [Wed, 31 Mar 2021 17:16:04 +0000 (13:16 -0400)] 
Expand sibling tests for overlaps warning

Scaled back the warning message added in :ticket:`5171` to not warn for
overlapping columns in an inheritance scenario where a particular
relationship is local to a subclass and therefore does not represent an
overlap.

Add errors documentation for the warning and also expand
``util.warn()`` to include a code parameter.

Fixes: #6171
Change-Id: Icb1f12d8d645d439ffd2bbb7371c6b00042b6ae3

4 years agoRepair PGInspector
Mike Bayer [Wed, 31 Mar 2021 15:48:22 +0000 (11:48 -0400)] 
Repair PGInspector

Fixed issue where the PostgreSQL :class:`.PGInspector`, when generated
against an :class:`_engine.Engine`, would fail for ``.get_enums()``,
``.get_view_names()``, ``.get_foreign_table_names()`` and
``.get_table_oid()`` when used against a "future" style engine and not the
connection directly.

Fixes: #6170
Change-Id: I8c3abdfb758305c2f7a96002d3644729f29c998b

4 years agodocument rowcount for ORM update/delete
Mike Bayer [Wed, 31 Mar 2021 13:39:34 +0000 (09:39 -0400)] 
document rowcount for ORM update/delete

Change-Id: I16f50cb50fc3cccc1bd7cae3a64a085b1ea68612

4 years agoasyncio API can be considered beta level
Mike Bayer [Wed, 31 Mar 2021 00:30:13 +0000 (20:30 -0400)] 
asyncio API can be considered beta level

It's clear that there are at least many dozens of developers
working with the new asyncio extension and we have not had
any major bug reports.  Other than ``Session.delete`` needing
to be an awaitable, there were no backwards-incompatible issues
and we've seen no issues with wrong behaviors.

Change-Id: I48f3f2ae89b2c48adb9d8d3c053d0ef53b4d7b5b

4 years agoVersion 1.4.5 placeholder
Mike Bayer [Wed, 31 Mar 2021 00:25:25 +0000 (20:25 -0400)] 
Version 1.4.5 placeholder

4 years ago- 1.4.4 rel_1_4_4
Mike Bayer [Wed, 31 Mar 2021 00:14:28 +0000 (20:14 -0400)] 
- 1.4.4

4 years agoMerge "Repair exception handling in CursorResult"
mike bayer [Wed, 31 Mar 2021 00:13:56 +0000 (00:13 +0000)] 
Merge "Repair exception handling in CursorResult"

4 years agolink to the asyncio ORM section for this issue
Mike Bayer [Tue, 30 Mar 2021 23:46:04 +0000 (19:46 -0400)] 
link to the asyncio ORM section for this issue

Change-Id: I1ef2230a1b1b77b55f3d835754836ca1bd023172
references: #6164

4 years agoRepair exception handling in CursorResult
Federico Caselli [Mon, 29 Mar 2021 19:58:38 +0000 (21:58 +0200)] 
Repair exception handling in CursorResult

Fixes: #6138
Change-Id: I794a3da688fd8577fb06770ef02bf827a5c55397

4 years agocherry-pick changelog update for 1.3.25
Mike Bayer [Tue, 30 Mar 2021 23:04:54 +0000 (19:04 -0400)] 
cherry-pick changelog update for 1.3.25

4 years agocherry-pick changelog from 1.3.24
Mike Bayer [Tue, 30 Mar 2021 23:04:53 +0000 (19:04 -0400)] 
cherry-pick changelog from 1.3.24

4 years agoAdjust version numbers for some changes, tags
Mike Bayer [Tue, 30 Mar 2021 22:57:25 +0000 (18:57 -0400)] 
Adjust version numbers for some changes, tags

Change-Id: I53263bd27a9012f1c41a2c491441c5fed79df673

4 years agoMerge "Refine domain nullable rules for PostgreSQL reflection"
mike bayer [Tue, 30 Mar 2021 22:43:52 +0000 (22:43 +0000)] 
Merge "Refine domain nullable rules for PostgreSQL reflection"

4 years agoRemove outdated todos from migration 20
Federico Caselli [Tue, 30 Mar 2021 20:31:20 +0000 (22:31 +0200)] 
Remove outdated todos from migration 20

Change-Id: I1b2139d8b35e8d254c4dffc9a642b9f29c9067a8

4 years agoRefine domain nullable rules for PostgreSQL reflection
Mike Bayer [Tue, 30 Mar 2021 18:48:41 +0000 (14:48 -0400)] 
Refine domain nullable rules for PostgreSQL reflection

Fixed issue in PostgreSQL reflection where a column expressing "NOT NULL"
will supersede the nullability of a corresponding domain.

Fixes #6161

Change-Id: I1a3de49afcdb952f71bd7a7cc7b264513c93eff5

4 years agoMerge "accommodate new pg8000 disconnection exception"
mike bayer [Tue, 30 Mar 2021 17:28:37 +0000 (17:28 +0000)] 
Merge "accommodate new pg8000 disconnection exception"

4 years agoindicate #6152 as in 1.4.4 with 1.3. backport
Mike Bayer [Tue, 30 Mar 2021 17:27:17 +0000 (13:27 -0400)] 
indicate #6152 as in 1.4.4 with 1.3. backport

Change-Id: I1b582fa5580c851170cc91c3ae51fd81c91d1ec9

4 years agoMerge "TypeDecorator passes "outer" flag to itself for set_parent accounting"
mike bayer [Tue, 30 Mar 2021 17:26:11 +0000 (17:26 +0000)] 
Merge "TypeDecorator passes "outer" flag to itself for set_parent accounting"

4 years agoaccommodate new pg8000 disconnection exception
hbusul [Mon, 29 Mar 2021 15:42:33 +0000 (11:42 -0400)] 
accommodate new pg8000 disconnection exception

Modified the ``is_disconnect()`` handler for the pg8000 dialect, which now
accommodates for a new ``InterfaceError`` emitted by pg8000 1.19.0. Pull
request courtesy Hamdi Burak Usul.

Fixes: #6099
Closes: #6150
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6150
Pull-request-sha: cd58836d3e19489d5203c02f7cc5f2f2d7c82a20

Change-Id: Ief942e53f6d90c48e8d77c70948fd46eb6c90dbd

4 years agoTypeDecorator passes "outer" flag to itself for set_parent accounting
Mike Bayer [Mon, 29 Mar 2021 21:57:20 +0000 (17:57 -0400)] 
TypeDecorator passes "outer" flag to itself for set_parent accounting

Fixed bug first introduced in as some combination of :ticket:`2892`,
:ticket:`2919` nnd :ticket:`3832` where the attachment events for a
:class:`_types.TypeDecorator` would be doubled up against the "impl" class,
if the "impl" were also a :class:`_types.SchemaType`. The real-world case
is any :class:`_types.TypeDecorator` against :class:`_types.Enum` or
:class:`_types.Boolean` would get a doubled
:class:`_schema.CheckConstraint` when the ``create_constraint=True`` flag
is set.

Fixes: #6152
Change-Id: I3218b7081297270c132421f6765b5c3673d10a5c

4 years agoRun trans.close() at end of block if transaction already inactive
Mike Bayer [Mon, 29 Mar 2021 20:40:16 +0000 (16:40 -0400)] 
Run trans.close() at end of block if transaction already inactive

Modified the context manager used by :class:`_engine.Transaction` so that
an "already detached" warning is not emitted by the ending of the context
manager itself, if the transaction were already manually rolled back inside
the block. This applies to regular transactions, savepoint transactions,
and legacy "marker" transactions. A warning is still emitted if the
``.rollback()`` method is called explicitly more than once.

Fixes: #6155
Change-Id: Ib9f9d803bf377ec843d4a8a09da8ebef4b441665

4 years agoAdapt for importlib_metadata changes
Mike Bayer [Tue, 30 Mar 2021 02:38:09 +0000 (22:38 -0400)] 
Adapt for importlib_metadata changes

importlib_metadata deprecates the .get() method and provides
a different method .select() as of 3.7.1.   Work around
the deprecation warning in this case.

Change-Id: I0f1849219e13a1c546f7bd24047d447823a15552

4 years agoMerge "Commentary; run criteria.params() if statement isn't cached?"
mike bayer [Sat, 27 Mar 2021 14:03:56 +0000 (14:03 +0000)] 
Merge "Commentary; run criteria.params() if statement isn't cached?"

4 years agoCommentary; run criteria.params() if statement isn't cached?
Mike Bayer [Sat, 27 Mar 2021 12:36:32 +0000 (08:36 -0400)] 
Commentary; run criteria.params() if statement isn't cached?

Considering adjustment to 56f9c7743e9083add69a10501a503f,
if statement is not cached, skip the relatively expensive
step of re-processing the criteria clause.

However, this causes the overall cache key of the statement
to come out differently which should also be avoided.

Likely we would not merge the actual change, just the
comment here.

References: #6139
Change-Id: Idb555b78d8d7950d084315e004448f64cf59bb5c

4 years agoMerge "Add ScopedSession.get()"
mike bayer [Fri, 26 Mar 2021 21:15:26 +0000 (21:15 +0000)] 
Merge "Add ScopedSession.get()"

4 years agorun new relationship criteria tests on empty session
Mike Bayer [Fri, 26 Mar 2021 19:40:34 +0000 (15:40 -0400)] 
run new relationship criteria tests on empty session

The commit in 56f9c7743e9083add69a10501a503f4 forgot to make
sure the full reload took place, either via populate_existing()
or session.close(), with failure only showing up in pypy.

Fixes: #6139
Change-Id: Id3d3a18a8d6225ef862055abf2b66ffde72107fb

4 years agoAdd ScopedSession.get()
Mike Bayer [Fri, 26 Mar 2021 18:39:22 +0000 (14:39 -0400)] 
Add ScopedSession.get()

Fixed missing method :meth:`_orm.Session.get` from the
:class:`_orm.ScopedSession` interface.

Fixes: #6144
Change-Id: I1d2425675f7f972c2479070a2e11b1d96a9aca8b

4 years agoAdapt loader_criteria params for current query
Mike Bayer [Fri, 26 Mar 2021 14:37:21 +0000 (10:37 -0400)] 
Adapt loader_criteria params for current query

Fixed critical issue in the new :meth:`_orm.PropComparator.and_` feature
where loader strategies that emit secondary SELECT statements such as
:func:`_orm.selectinload` and :func:`_orm.lazyload` would fail to
accommodate for bound parameters in the user-defined criteria in terms of
the current statement being executed, as opposed to the cached statement,
causing stale bound values to be used.

This also adds a warning for the case where an object that uses
:func:`_orm.lazyload` in conjunction with :meth:`_orm.PropComparator.and_`
is attempted to be serialized; the loader criteria cannot reliably
be serialized and deserialized and eager loading should be used for this
case.

Fixes: #6139
Change-Id: I5a638bbecb7b583db2d3c0b76469f5a25c13dd3b

4 years agoVersion 1.4.4 placeholder
Mike Bayer [Thu, 25 Mar 2021 21:41:58 +0000 (17:41 -0400)] 
Version 1.4.4 placeholder

4 years ago- 1.4.3 rel_1_4_3
Mike Bayer [Thu, 25 Mar 2021 21:32:36 +0000 (17:32 -0400)] 
- 1.4.3

4 years agotypos
Mike Bayer [Thu, 25 Mar 2021 21:31:56 +0000 (17:31 -0400)] 
typos

Change-Id: I8593e4402ae068edfc14516ee3ec0a96513c2b36

4 years agoFixed reflection of identity columns in tables
Federico Caselli [Thu, 25 Mar 2021 20:08:21 +0000 (21:08 +0100)] 
Fixed reflection of identity columns in tables
with mixed case names in PostgreSQL.

Fixes: #6129
Change-Id: I50480cec03fcb44a668c9b0f9c72950803b771d9

4 years agoMerge "support as_declarative, as_declarative_base"
mike bayer [Thu, 25 Mar 2021 19:58:38 +0000 (19:58 +0000)] 
Merge "support as_declarative, as_declarative_base"

4 years agosupport as_declarative, as_declarative_base
Mike Bayer [Tue, 23 Mar 2021 22:49:28 +0000 (18:49 -0400)] 
support as_declarative, as_declarative_base

Added support for the Mypy extension to correctly interpret a declarative
base class that's generated using the :func:`_orm.as_declarative` function
as well as the :meth:`_orm.registry.as_declarative_base` method.

Change-Id: I227f4abebe157a7df3f8772893bbea6669cc8555

4 years agoMerge "Allow dropping a schema with a sequence shared by more than one table."
mike bayer [Thu, 25 Mar 2021 15:28:32 +0000 (15:28 +0000)] 
Merge "Allow dropping a schema with a sequence shared by more than one table."

4 years agodon't rely on pk-only group_by
Mike Bayer [Thu, 25 Mar 2021 14:37:12 +0000 (10:37 -0400)] 
don't rely on pk-only group_by

Fixed the test test_aliased_stmt_includes_unnamed_fn
recently added in c1c999c01d to include the additional
column in the GROUP BY statement, allowing this statement
to succeed on SQL Server which seems to not support "group by pk only"
syntax.

Change-Id: I42184d77c9017ebdb76ac5a9ae1f8128561243ec

4 years agoAccept **kw in annotated._clone() method
Mike Bayer [Thu, 25 Mar 2021 12:40:16 +0000 (08:40 -0400)] 
Accept **kw in annotated._clone() method

Fixed bug where combinations of the new "relationship with criteria"
feature could fail in conjunction with features that make use of the new
"lambda SQL" feature, including loader strategies such as selectinload and
lazyload, for more complicated scenarios such as polymorphic loading.

Fixes: #6131
Change-Id: I915dead6596866ae5fd1a7f593a90bce4b61d1af

4 years agoMerge "Use class-local metadata for declarative base"
mike bayer [Thu, 25 Mar 2021 11:39:13 +0000 (11:39 +0000)] 
Merge "Use class-local metadata for declarative base"

4 years agoUse class-local metadata for declarative base
Mike Bayer [Wed, 24 Mar 2021 21:43:06 +0000 (17:43 -0400)] 
Use class-local metadata for declarative base

Fixed regression where the ``.metadata`` attribute on a per class level
would not be honored, breaking the use case of per-class-hierarchy
:class:`.schema.MetaData` for abstract declarative classes and mixins.

Fixes: #6128
Change-Id: I5c15436b5c5171105dc1a0192fa744daf79a344d

4 years agoMerge "Repair pysqlcipher and use sqlcipher3"
mike bayer [Thu, 25 Mar 2021 00:25:46 +0000 (00:25 +0000)] 
Merge "Repair pysqlcipher and use sqlcipher3"

4 years agoMerge "Restore ResultProxy name to sqlalchemy.engine"
mike bayer [Wed, 24 Mar 2021 23:07:51 +0000 (23:07 +0000)] 
Merge "Restore ResultProxy name to sqlalchemy.engine"

4 years agoRepair pysqlcipher and use sqlcipher3
Mike Bayer [Wed, 24 Mar 2021 15:33:04 +0000 (11:33 -0400)] 
Repair pysqlcipher and use sqlcipher3

The ``pysqlcipher`` dialect now imports the ``sqlcipher3`` module
for Python 3 by default.    Regressions have been repaired such that
the connection routine was not working.

To better support the post-connection steps of the pysqlcipher
dialect, a new hook Dialect.on_connect_url() is added, which
supersedes Dialect.on_connect() and is passed the URL object.
The dialect now pulls the passphrase and other cipher args
from the URL directly without including them in the
"connect" args.  This will allow any user-defined extensibility
to connecting to work as it would for other dialects.

The commit also builds upon the extended routines in
sqlite/provisioning.py to better support running tests against
multiple simultaneous SQLite database files.  Additionally enables
backend for test_sqlite which was skipping everything
for aiosqlite too, fortunately everything there is passing.

Fixes: #5848
Change-Id: I43f53ebc62298a84a4abe149e1eb699a027b7915

4 years agoMerge "Support __visit_name__ on PropComparator to work in cloning"
mike bayer [Wed, 24 Mar 2021 19:30:06 +0000 (19:30 +0000)] 
Merge "Support __visit_name__ on PropComparator to work in cloning"

4 years agoSupport __visit_name__ on PropComparator to work in cloning
Mike Bayer [Wed, 24 Mar 2021 16:15:53 +0000 (12:15 -0400)] 
Support __visit_name__ on PropComparator to work in cloning

Repaired support so that the :meth:`_sql.Select.params` method can work
correctly with a :class:`_sql.Select` object that includes joins across ORM
relationship structures, which is a new feature in 1.4.

Fixes: #6124
Change-Id: Ia92fc33c3acbe66910e9e3bf00af9100de19b2b8

4 years agoMerge "Add support for aiosqlite"
mike bayer [Wed, 24 Mar 2021 16:52:07 +0000 (16:52 +0000)] 
Merge "Add support for aiosqlite"

4 years agoopen up window functions (ha ha) for mysql / mariadb
Mike Bayer [Wed, 24 Mar 2021 16:00:16 +0000 (12:00 -0400)] 
open up window functions (ha ha) for mysql / mariadb

MySQL 8 and MariaDB 10.2 support window functions so this
should be turned on.

Change-Id: Ic1fdd328f1f0def7dfc8451385c16ea81902074c

4 years agoAdd support for aiosqlite
Federico Caselli [Sat, 6 Feb 2021 14:17:20 +0000 (15:17 +0100)] 
Add support for aiosqlite

Added support for the aiosqlite database driver for use with the
SQLAlchemy asyncio extension.

Fixes: #5920
Change-Id: Id11a320516a44e886a6f518d2866a0f992413e55

4 years agoRestore ResultProxy name to sqlalchemy.engine
Mike Bayer [Tue, 23 Mar 2021 21:51:34 +0000 (17:51 -0400)] 
Restore ResultProxy name to sqlalchemy.engine

Fixes: #6118
Fixes: #6119
Change-Id: I7aad2be6572ad6d0bf982f4d6dc63a71485d73fa

4 years agoMerge "Use compat.exec_()"
mike bayer [Tue, 23 Mar 2021 18:48:56 +0000 (18:48 +0000)] 
Merge "Use compat.exec_()"

4 years agoMerge "Remove internal use of string attr in loader option"
mike bayer [Tue, 23 Mar 2021 18:28:33 +0000 (18:28 +0000)] 
Merge "Remove internal use of string attr in loader option"

4 years agoUse compat.exec_()
Martin Häcker [Tue, 23 Mar 2021 15:46:18 +0000 (11:46 -0400)] 
Use compat.exec_()

Fixed a bug where python 2.7.5 (default on CentOS 7) wasn't able to import
sqlalchemy, because on this version of Python ``exec "statement"`` and
``exec("statement")`` do not behave the same way.  The compatibility
``exec_()`` function was used instead.

Fixes: #6069
Closes: #6112
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6112
Pull-request-sha: 4e951f9278eb462d1432a92b7bad93b973e4e2a5

Change-Id: I34e00250e874368e83c3e992be80e989a3c4f054