]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoFix error in documentation of DDLElement
Federico Caselli [Fri, 9 Apr 2021 22:31:51 +0000 (00:31 +0200)] 
Fix error in documentation of DDLElement

Change-Id: I9d850458c274d245057ea676d6730d4bd93c261f

4 years agoVersion 1.4.8 placeholder
Mike Bayer [Fri, 9 Apr 2021 17:09:46 +0000 (13:09 -0400)] 
Version 1.4.8 placeholder

4 years ago- 1.4.7 rel_1_4_7
Mike Bayer [Fri, 9 Apr 2021 17:07:59 +0000 (13:07 -0400)] 
- 1.4.7

4 years agoadd changelog for supports_schema
Mike Bayer [Fri, 9 Apr 2021 17:06:49 +0000 (13:06 -0400)] 
add changelog for supports_schema

Change-Id: I9fb9947c45e34369ebb8f55c3c52a2d6f4e879cf

4 years agoMerge "Dont return outer transaction for _subtrans flag"
mike bayer [Fri, 9 Apr 2021 16:35:53 +0000 (16:35 +0000)] 
Merge "Dont return outer transaction for _subtrans flag"

4 years agoclose session for loading test
Mike Bayer [Fri, 9 Apr 2021 16:25:20 +0000 (12:25 -0400)] 
close session for loading test

Fixes pypy

Change-Id: Iadfb8bc74d47a23e50ab69e9d784652355f5e622

4 years agoMerge "Apply recursive check to immediateloader and generalize"
mike bayer [Fri, 9 Apr 2021 16:03:43 +0000 (16:03 +0000)] 
Merge "Apply recursive check to immediateloader and generalize"

4 years agoDont return outer transaction for _subtrans flag
Mike Bayer [Fri, 9 Apr 2021 15:09:16 +0000 (11:09 -0400)] 
Dont return outer transaction for _subtrans flag

Fixed critical regression where the :class:`_orm.Session` could fail to
"autobegin" a new transaction when a flush occurred without an existing
transaction in place, implicitly placing the :class:`_orm.Session` into
legacy autocommit mode which commit the transaction. The
:class:`_orm.Session` now has a check that will prevent this condition from
occurring, in addition to repairing the flush issue.

Additionally, scaled back part of the change made as part of :ticket:`5226`
which can run autoflush during an unexpire operation, to not actually
do this in the case of a :class:`_orm.Session` using legacy
:paramref:`_orm.Session.autocommit` mode, as this incurs a commit within
a refresh operation.

Fixes: #6233
Change-Id: Ia980e62a090e39e3e2a7fb77c95832ae784cc9a5

4 years agoApply recursive check to immediateloader and generalize
Mike Bayer [Fri, 9 Apr 2021 14:46:21 +0000 (10:46 -0400)] 
Apply recursive check to immediateloader and generalize

Fixed critical regression caused by the new feature added as part of
:ticket:`1763`, eager loaders are invoked on unexpire operations. The new
feature makes use of the "immediateload" eager loader strategy as a
substitute for a collection loading strategy, which unlike the other
"post-load" strategies was not accommodating for recursive invocations
between mutually-dependent relationships, leading to recursion overflow
errors.

Fixes: #6232
Change-Id: Ifb2286281f40d1a04c24741261d4438659b6e3dd

4 years agoMake schema support explicit
Gord Thompson [Thu, 8 Apr 2021 23:22:34 +0000 (17:22 -0600)] 
Make schema support explicit

Add ``supports_schema = True`` to DefaultDialect and modify
requirements.py to use that attribute so third-party dialects
can explicitly indicate that they do *not* support schemas by
specifying ``supports_schema = False`` in their Dialect class.

Change-Id: Idffee82f6668a15ac7148f2a407a17de785d1fb7

4 years agodocument scalar_subquery() with column_property()
Mike Bayer [Fri, 9 Apr 2021 13:25:04 +0000 (09:25 -0400)] 
document scalar_subquery() with column_property()

Other doc cleanups and fixes as well, including more
explicitness that declarative attribute assignment only
works when a declarative base is involved; other forms
need to call add_property() directly.

Fixes: #6225
Change-Id: I123c3fb35cfa788b96bac7ab640f6de857d003d6

4 years agoMerge "Fix LegacyRow/Row index access"
mike bayer [Thu, 8 Apr 2021 21:22:47 +0000 (21:22 +0000)] 
Merge "Fix LegacyRow/Row index access"

4 years agoFix LegacyRow/Row index access
Mike Bayer [Wed, 7 Apr 2021 17:57:39 +0000 (13:57 -0400)] 
Fix LegacyRow/Row index access

Fixed up the behavior of the :class:`_result.Row` object when dictionary
access is used upon it, meaning converting to a dict via ``dict(row)`` or
accessing members using strings or other objects i.e. ``row["some_key"]``
works as it would with a dictionary, rather than raising ``TypeError`` as
would be the case with a tuple, whether or not the C extensions are in
place. This was originally supposed to emit a 2.0 deprecation warning for
the "non-future" case using :class:`_result.LegacyRow`, and was to raise
``TypeError`` for the "future" :class:`_result.Row` class. However, the C
version of :class:`_result.Row` was failing to raise this ``TypeError``,
and to complicate matters, the :meth:`_orm.Session.execute` method now
returns :class:`_result.Row` in all cases to maintain consistency with the
ORM result case, so users who didn't have C extensions installed would
see different behavior in this one case for existing pre-1.4 style
code.

Therefore, in order to soften the overall upgrade scheme as most users have
not been exposed to the more strict behavior of :class:`_result.Row` up
through 1.4.6, :class:`_result.LegacyRow` and :class:`_result.Row` both
provide for string-key access as well as support for ``dict(row)``, in all
cases emitting the 2.0 deprecation warning when ``SQLALCHEMY_WARN_20`` is
enabled. The :class:`_result.Row` object still uses tuple-like behavior for
``__contains__``, which is probably the only noticeable behavioral change
compared to :class:`_result.LegacyRow`, other than the removal of
dictionary-style methods ``values()`` and ``items()``.

Also remove filters for result set warnings.

callcounts updated for 2.7/ 3.9, am pushing jenkins to use python 3.9
now

Fixes: #6218
Change-Id: Ia69b974f3dbc46943c57423f57ec82323c8ae63b

4 years agoMerge "Support `TypeDecorator` subclasses in `Column()` declarations"
mike bayer [Thu, 8 Apr 2021 17:02:21 +0000 (17:02 +0000)] 
Merge "Support `TypeDecorator` subclasses in `Column()` declarations"

4 years agoAdd migration note about Query.statement
Mike Bayer [Thu, 8 Apr 2021 16:28:58 +0000 (12:28 -0400)] 
Add migration note about Query.statement

This accessor returns a 2.0 style Select() object now
which won't have the same state as it did in 1.3.  This
can impact things that assume this state.

Fixes: #6231
Change-Id: Ib5cf8e6c67214d864d4ff7f6177c79f15f834cd2

4 years agoSupport `TypeDecorator` subclasses in `Column()` declarations
Bryan Forbes [Thu, 8 Apr 2021 16:27:17 +0000 (12:27 -0400)] 
Support `TypeDecorator` subclasses in `Column()` declarations

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

### Description
Currently, the plugin resolves `TypeDecorator` subclasses in `Column()` declarations to `Mapping[_T]` instead of the correct type in the class declaration.

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

-->

This pull request is:

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

**Have a nice day!**

Closes: #6223
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6223
Pull-request-sha: 5136bc4b6333e868cc47f1b2dcc58716a40cadca

Change-Id: Idc865bf7320f8ea3054c28dea095b693fe112753

4 years agoMerge "Update run_callable depr warn to suggest .begin()"
mike bayer [Thu, 8 Apr 2021 16:05:30 +0000 (16:05 +0000)] 
Merge "Update run_callable depr warn to suggest .begin()"

4 years agoMerge "Infer types in BindParameter when expanding=True"
mike bayer [Thu, 8 Apr 2021 16:04:44 +0000 (16:04 +0000)] 
Merge "Infer types in BindParameter when expanding=True"

4 years agoUpdate run_callable depr warn to suggest .begin()
Gord Thompson [Thu, 8 Apr 2021 15:24:28 +0000 (09:24 -0600)] 
Update run_callable depr warn to suggest .begin()

Change-Id: Ie5dd908710520fc94169393f826f80a2249ee77f

4 years agoInfer types in BindParameter when expanding=True
Mike Bayer [Thu, 8 Apr 2021 01:43:17 +0000 (21:43 -0400)] 
Infer types in BindParameter when expanding=True

Enhanced the "expanding" feature used for :meth:`_sql.ColumnOperators.in_`
operations to infer the type of expression from the right hand list of
elements, if the left hand side does not have any explicit type set up.
This allows the expression to support stringification among other things.
In 1.3, "expanding" was not automatically used for
:meth:`_sql.ColumnOperators.in_` expressions, so in that sense this change
fixes a behavioral regression.

Fixes: #6222
Change-Id: Icdfda1e2c226a21896cafd6d8f251547794451c2

4 years agoFAQ for render_postcompile
Mike Bayer [Thu, 8 Apr 2021 14:14:44 +0000 (10:14 -0400)] 
FAQ for render_postcompile

Change-Id: If0231623491d7901046c76af3461f33ba504ff53
References: #6230

4 years agoMerge "convert subqueryload paths for multilevel"
mike bayer [Thu, 8 Apr 2021 02:02:04 +0000 (02:02 +0000)] 
Merge "convert subqueryload paths for multilevel"

4 years agoconvert subqueryload paths for multilevel
Mike Bayer [Wed, 7 Apr 2021 23:22:52 +0000 (19:22 -0400)] 
convert subqueryload paths for multilevel

Fixed regression where the :func:`_orm.subqueryload` loader strategy would
fail to correctly accommodate sub-options, such as a :func:`_orm.defer`
option on a column, if the "path" of the subqueryload were more than one
level deep.

Fixes: #6221
Change-Id: I2addef0be6aaa022fa1b2f20060c4f0769c3bdfb

4 years agoMerge "support multivalues insert on strsqlcompiler"
mike bayer [Wed, 7 Apr 2021 22:35:23 +0000 (22:35 +0000)] 
Merge "support multivalues insert on strsqlcompiler"

4 years agosupport multivalues insert on strsqlcompiler
Mike Bayer [Wed, 7 Apr 2021 21:51:34 +0000 (17:51 -0400)] 
support multivalues insert on strsqlcompiler

Fixed the "stringify" compiler to support a basic stringification
of a "multirow" INSERT statement, i.e. one with multiple tuples
following the VALUES keyword.

Change-Id: I1fe38d204d9965275d3a72157d5a72a53bec4b11

4 years agoMerge "Expand reg for schema translate map for most special characters"
mike bayer [Wed, 7 Apr 2021 16:07:51 +0000 (16:07 +0000)] 
Merge "Expand reg for schema translate map for most special characters"

4 years agoMerge "Add test support for merge_frozen_result"
mike bayer [Wed, 7 Apr 2021 16:07:08 +0000 (16:07 +0000)] 
Merge "Add test support for merge_frozen_result"

4 years agoMerge "Check for hybrid's attribute name and support no name"
mike bayer [Wed, 7 Apr 2021 16:06:20 +0000 (16:06 +0000)] 
Merge "Check for hybrid's attribute name and support no name"

4 years agomariadb+pymsql -> mariadb+pymysql
Mike Bayer [Wed, 7 Apr 2021 15:03:06 +0000 (11:03 -0400)] 
mariadb+pymsql -> mariadb+pymysql

Fixes: #6217
Change-Id: Icd8275c49f30ea77d00f76209fb71fb2b8fa9528

4 years agoExpand reg for schema translate map for most special characters
Mike Bayer [Wed, 7 Apr 2021 14:56:12 +0000 (10:56 -0400)] 
Expand reg for schema translate map for most special characters

Fixed regression where usage of a token in the
:paramref:`_engine.Connection.execution_options.schema_translate_map`
dictionary which contained special characters such as braces would fail to
be substituted properly. Use of square bracket characters ``[]`` is now
explicitly disallowed as these are used as a delimiter character in the
current implementation.

Fixes: #6216
Change-Id: I7ccfc2292b17340054cedf485ed1adf3119b96c8

4 years agoAdd test support for merge_frozen_result
Mike Bayer [Wed, 7 Apr 2021 14:40:14 +0000 (10:40 -0400)] 
Add test support for merge_frozen_result

Fixed regression where the :func:`_orm.merge_frozen_result` function relied
upon by the dogpile.caching example was not included in tests and began
failing due to incorrect internal arguments.

Fixes: #6211
Change-Id: I0b53d0f569c817994ad4827a3ddb1626fd2d082f

4 years agoCheck for hybrid's attribute name and support no name
Mike Bayer [Wed, 7 Apr 2021 14:26:31 +0000 (10:26 -0400)] 
Check for hybrid's attribute name and support no name

Fixed regression where the ORM compilation scheme would assume the function
name of a hybrid property would be the same as the attribute name in such a
way that an ``AttributeError`` would be raised, when it would attempt to
determine the correct name for each element in a result tuple. A similar
issue exists in 1.3 but only impacts the names of tuple rows. The fix here
adds a check that the hybrid's function name is actually present in the
``__dict__`` of the class or its superclasses before assigning this name;
otherwise, the hybrid is considered to be "unnamed" and ORM result tuples
will use the naming scheme of the underlying expression.

Fixes: #6215
Change-Id: I584c0c05efec957f4dcaccf5df371399a57dffe9

4 years agoVersion 1.4.7 placeholder
Mike Bayer [Tue, 6 Apr 2021 23:03:50 +0000 (19:03 -0400)] 
Version 1.4.7 placeholder

4 years ago- 1.4.6 rel_1_4_6
Mike Bayer [Tue, 6 Apr 2021 22:59:01 +0000 (18:59 -0400)] 
- 1.4.6

4 years agofix link
Mike Bayer [Tue, 6 Apr 2021 22:58:21 +0000 (18:58 -0400)] 
fix link

Change-Id: If5d9bf472c434fc2df6d822075fa34fd45c84ecc

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"