]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoFixed deprecated imports in orm/extensions docs 6341/head
NickKush [Wed, 21 Apr 2021 21:14:28 +0000 (00:14 +0300)] 
Fixed deprecated imports in orm/extensions docs

4 years agoLimit dc field logic to only fields that are definitely dc
Mike Bayer [Wed, 21 Apr 2021 14:39:09 +0000 (10:39 -0400)] 
Limit dc field logic to only fields that are definitely dc

Fixed regression where recent changes to support Python dataclasses had the
inadvertent effect that an ORM mapped class could not successfully override
the ``__new__()`` method.

In this case the "__new__" method comes out as staticmethod in
cls.__dict__ vs. a function in the metaclass dict_, so comparing
using identity fails.   I was hoping not to have too much
"dataclass" hardcoded, the logic here if it were generalized
to other attribute declaration systems there
would still have a flag that indicates an attribute is part of
the "special declaration system".

Fixes: #6331
Change-Id: Ia28a44fb57c668fa2fc5cd1ff38fd511f2c747e6

4 years agoVersion 1.4.11 placeholder
Mike Bayer [Wed, 21 Apr 2021 01:39:52 +0000 (21:39 -0400)] 
Version 1.4.11 placeholder

4 years ago- 1.4.10 rel_1_4_10
Mike Bayer [Wed, 21 Apr 2021 01:36:42 +0000 (21:36 -0400)] 
- 1.4.10

4 years agofix changelog entry
Mike Bayer [Wed, 21 Apr 2021 01:34:23 +0000 (21:34 -0400)] 
fix changelog entry

Change-Id: I2d4eb4b5d4fa351a476fc4afe944fb449d451b94

4 years agoPropagate compiler kw for visit_values to parameters
Mike Bayer [Tue, 20 Apr 2021 19:09:51 +0000 (15:09 -0400)] 
Propagate compiler kw for visit_values to parameters

Fixed issue in SQL compiler where the bound parameters set up for a
:class:`.Values` construct wouldn't be positionally tracked correctly if
inside of a :class:`_sql.CTE`, affecting database drivers that support
VALUES + ctes and use positional parameters such as SQL Server in
particular as well as asyncpg.   The fix also repairs support for
compiler flags such as ``literal_binds``.

Fixes: #6327
Change-Id: I2d549228691d0bfc10dadd0955b1549d7584db51

4 years agoMerge "Allow immediateload to use_get for recursive call"
mike bayer [Tue, 20 Apr 2021 18:58:34 +0000 (18:58 +0000)] 
Merge "Allow immediateload to use_get for recursive call"

4 years agoMerge "Add DateTime(timezone=True) support to mssql"
mike bayer [Tue, 20 Apr 2021 18:13:25 +0000 (18:13 +0000)] 
Merge "Add DateTime(timezone=True) support to mssql"

4 years agoMerge "Re-infer statements that got more specific on subsequent pass"
mike bayer [Tue, 20 Apr 2021 18:12:59 +0000 (18:12 +0000)] 
Merge "Re-infer statements that got more specific on subsequent pass"

4 years agoAllow immediateload to use_get for recursive call
Mike Bayer [Tue, 20 Apr 2021 18:09:51 +0000 (14:09 -0400)] 
Allow immediateload to use_get for recursive call

Altered some of the behavior repaired in :ticket:`6232` where the
``immediateload`` loader strategy no longer goes into recursive loops; the
modification is that an eager load (joinedload, selectinload, or
subqueryload) from A->bs->B which then states ``immediateload`` for a
simple manytoone B->a->A that's in the identity map will populate the B->A,
so that this attribute is back-populated when the collection of A/A.bs are
loaded. This allows the objects to be functional when detached.

Fixes: #6301
Change-Id: I8505d851802c38ad8ad4e2fab9030f7c17089e9d

4 years agoAdd DateTime(timezone=True) support to mssql
Gord Thompson [Sun, 18 Apr 2021 18:15:48 +0000 (12:15 -0600)] 
Add DateTime(timezone=True) support to mssql

The :paramref:`_types.DateTime.timezone` parameter when set to ``True``
will now make use of the ``DATETIMEOFFSET`` column type with SQL Server
when used to emit DDL, rather than ``DATETIME`` where the flag was silently
ignored.

Fixes: #6306
Change-Id: I4def8337046e8c190d424fa4a259ab24d5f9039e

4 years agoRe-infer statements that got more specific on subsequent pass
Mike Bayer [Mon, 19 Apr 2021 22:03:12 +0000 (18:03 -0400)] 
Re-infer statements that got more specific on subsequent pass

Fixed issue where mypy plugin would not correctly interpret an explicit
:class:`_orm.Mapped` annotation in conjunction with a
:func:`_orm.relationship` that refers to a class by string name; the
correct annotation would be downgraded to a less specific one leading to
typing errors.

The thing figured out here is that after we've already scanned
a class in the semanal stage and created DeclClassApplied,
when we are called again with that same DeclClassApplied, for this
specific kind of case we actually now have *better* types than
we did before, where the left side that looked like
List?[Address?] now seems to say
builtins.list[official.module.Address] - so let's take the
right side expression again, this time embedded in our
Mapped._empty_constructor() expression, and run the infer
all over again just like mypy would.   Just not setting the
"wrong" type here fixed the test cases but by re-applying the
whole infer we get the correct Mapped[] on the left side too.

Fixes: #6255
Change-Id: Iafe7254374f685a8458c7a1db82aafc2ed6d0232

4 years agoMerge "Derive `next_value.type` from `Sequence.data_type` if available"
mike bayer [Tue, 20 Apr 2021 17:04:57 +0000 (17:04 +0000)] 
Merge "Derive `next_value.type` from `Sequence.data_type` if available"

4 years agoNarrow refresh populate_existing to just refresh_state
Mike Bayer [Tue, 20 Apr 2021 15:33:02 +0000 (11:33 -0400)] 
Narrow refresh populate_existing to just refresh_state

Fixed additional regression caused by the "eagerloaders on refresh" feature
added in :ticket:`1763` where the refresh operation historically would set
``populate_existing``, which given the new feature now overwrites pending
changes on eagerly loaded objects when autoflush is false. The
populate_existing flag has been turned off for this case and a more
specific method used to ensure the correct attributes refreshed.

Fixes: #6326
Change-Id: I40315e4164eae28972c5839c04580d292bc6cb24

4 years agoadd some cross-linking for orderby/groupby docs + label examples
Mike Bayer [Mon, 19 Apr 2021 15:45:09 +0000 (11:45 -0400)] 
add some cross-linking for orderby/groupby docs + label examples

Change-Id: I34d4958ded8ec95e439ee47fdcb600f357cf7ae3
References: #6324

4 years agoMerge "Bypass declared_attr w/ a custom wrapper for lambda criteria"
mike bayer [Mon, 19 Apr 2021 01:33:43 +0000 (01:33 +0000)] 
Merge "Bypass declared_attr w/ a custom wrapper for lambda criteria"

4 years agoMerge "Fixed ``scalar_one`` usage after ``unique``."
mike bayer [Mon, 19 Apr 2021 00:47:29 +0000 (00:47 +0000)] 
Merge "Fixed ``scalar_one`` usage after ``unique``."

4 years agoBypass declared_attr w/ a custom wrapper for lambda criteria
Mike Bayer [Mon, 19 Apr 2021 00:30:14 +0000 (20:30 -0400)] 
Bypass declared_attr w/ a custom wrapper for lambda criteria

Fixed bug in new :func:`_orm.with_loader_criteria` feature where using a
mixin class with :func:`_orm.declared_attr` on an attribute that were
accessed inside the custom lambda would emit a warning regarding using an
unmapped declared attr, when the lambda callable were first initialized.
This warning is now prevented using special instrumentation for this
lambda initialization step.

Fixes: #6320
Change-Id: I18ce0c662131f2e683b84caa38c01b2182eb210b

4 years agoDerive `next_value.type` from `Sequence.data_type` if available
Bryan Forbes [Thu, 15 Apr 2021 17:35:52 +0000 (12:35 -0500)] 
Derive `next_value.type` from `Sequence.data_type` if available

Fixes #6287

Change-Id: I7d428ed86cd72cd910bfff9058a52c7fcb7c64ac

4 years agoImproved datetime documentation for sqlite
Federico Caselli [Sun, 18 Apr 2021 08:41:10 +0000 (10:41 +0200)] 
Improved datetime documentation for sqlite

closes #6313

Change-Id: Ib8e988915afc65c95ae6d4c22b7802a1226a2913

4 years agoMerge "Fixed ``instrument_declarative`` registry call."
mike bayer [Sat, 17 Apr 2021 17:31:29 +0000 (17:31 +0000)] 
Merge "Fixed ``instrument_declarative`` registry call."

4 years agoMerge "Don't stringify unnamed column elements when proxying"
mike bayer [Sat, 17 Apr 2021 17:25:00 +0000 (17:25 +0000)] 
Merge "Don't stringify unnamed column elements when proxying"

4 years agoFixed ``scalar_one`` usage after ``unique``.
Federico Caselli [Sat, 17 Apr 2021 09:56:51 +0000 (11:56 +0200)] 
Fixed ``scalar_one`` usage after ``unique``.

Fixed an issue that prevented using ``scalar_one`` or
``scalar_one_or_none()`` after a call to ``unique``.

Additionally includes some clarifications in result.py
and also removes pep-484 annotations for now as these
are duplicate on top of sqlalchemy2-stubs.

Fixes: #6299
Change-Id: Ia04f3d078c7a4f0d8488745e43d2fd63b60de9a0

4 years agoFixed ``instrument_declarative`` registry call.
Federico Caselli [Fri, 16 Apr 2021 20:25:56 +0000 (22:25 +0200)] 
Fixed ``instrument_declarative`` registry call.

Fixed :func:`_declarative.instrument_declarative` that called
a non existing registry method.

Fixes: #6291
Change-Id: I6fc8db84f72240cc82e7f6f3a784c424f5ccfc96

4 years agoVersion 1.4.10 placeholder
Mike Bayer [Sat, 17 Apr 2021 05:24:25 +0000 (01:24 -0400)] 
Version 1.4.10 placeholder

4 years ago- 1.4.9 rel_1_4_9
Mike Bayer [Sat, 17 Apr 2021 05:19:32 +0000 (01:19 -0400)] 
- 1.4.9

4 years agoMerge "pass asfrom correctly in compilers"
mike bayer [Sat, 17 Apr 2021 05:18:47 +0000 (05:18 +0000)] 
Merge "pass asfrom correctly in compilers"

4 years agoMerge "Uniquify FROMs when traversing through select"
mike bayer [Sat, 17 Apr 2021 04:45:28 +0000 (04:45 +0000)] 
Merge "Uniquify FROMs when traversing through select"

4 years agofix category
Mike Bayer [Sat, 17 Apr 2021 04:44:09 +0000 (00:44 -0400)] 
fix category

Change-Id: I6233ec667a4cca546e40e34224cc51998b5687d8

4 years agoDon't stringify unnamed column elements when proxying
Mike Bayer [Fri, 16 Apr 2021 15:06:56 +0000 (11:06 -0400)] 
Don't stringify unnamed column elements when proxying

Repaired and solidified issues regarding custom functions and other
arbitrary expression constructs which within SQLAlchemy's column labeling
mechanics would seek to use ``str(obj)`` to get a string representation to
use as an anonymous column name in the ``.c`` collection of a subquery.
This is a very legacy behavior that performs poorly and leads to lots of
issues, so has been revised to no longer perform any compilation by
establishing specific methods on :class:`.FunctionElement` to handle this
case, as SQL functions are the only use case that it came into play. An
effect of this behavior is that an unlabeled column expression with no
derivable name will be given an arbitrary label starting with the prefix
``"_no_label"`` in the ``.c`` collection of a subquery; these were
previously being represented either as the generic stringification of that
expression, or as an internal symbol.

This change seeks to make the concept of "anon name" more private
and renames anon_label and anon_key_label to _anon_name_label
and _anon_key_label.   There's no end-user utility to these accessors
and we need to be able to reorganize these as well.

Fixes: #6256
Change-Id: Ie63c86b20ca45873affea78500388da94cf8bf94

4 years agopass asfrom correctly in compilers
Mike Bayer [Sat, 17 Apr 2021 04:30:29 +0000 (00:30 -0400)] 
pass asfrom correctly in compilers

Fixed an argument error in the default and PostgreSQL compilers that
would interfere with an UPDATE..FROM or DELETE..FROM..USING statement
that was then SELECTed from as a CTE.

The incorrect pattern was also fixed in the mysql and sybase dialects.
MySQL supports CTEs but not "returning".

Fixes: #6303
Change-Id: Ic94805611a5ec443749fb6b1fd8a1326b0d83ef7

4 years agoUniquify FROMs when traversing through select
Mike Bayer [Sat, 17 Apr 2021 03:58:48 +0000 (23:58 -0400)] 
Uniquify FROMs when traversing through select

Fixed a critical performance issue where the traversal of a
:func:`_sql.select` construct would traverse a repetitive product of the
represented FROM clauses as they were each referred towards by columns in
the columns clause; for a series of nested subqueries with lots of columns
this could cause a large delay and significant memory growth. This
traversal is used by a wide variety of SQL and ORM functions, including by
the ORM :class:`_orm.Session` when it's configured to have
"table-per-bind", which while this is not a common use case, it seems to be
what Flask-SQLAlchemy is hardcoded as using, so the issue impacts
Flask-SQLAlchemy users. The traversal has been repaired to uniqify on FROM
clauses which was effectively what would happen implicitly with the pre-1.4
architecture.

Fixes: #6304
Change-Id: I43497e943db4065deab0bfc830fbb68c17b80a53

4 years agoFit literal compile of empty in on a tuple
Federico Caselli [Fri, 16 Apr 2021 20:07:34 +0000 (22:07 +0200)] 
Fit literal compile of empty in on a tuple

Fixed regression where an empty in statement on a tuple would result
in an error when compiled with the option ``literal_binds=True``.

Fixes: #6290
Change-Id: Ic0dff8f4a874cccdb201b6d9dcd3c2e7b7884cbb

4 years agosynonym fixes and enhancements
Mike Bayer [Fri, 16 Apr 2021 12:56:17 +0000 (08:56 -0400)] 
synonym fixes and enhancements

Fixed regression where an attribute that is mapped to a
:func:`_orm.synonym` could not be used in column loader options such as
:func:`_orm.load_only`.

Established support for :func:`_orm.synonym` in conjunction with hybrid
property, associationproxy, including that synonyms can be established
linking to these constructs which work fully. This is a behavior that was
semi-explicitly disallowed previously, however since it did not fail in
every scenario, explicit support for assoc proxy and hybrids has been
added.

Fixes: #6272
Fixes: #6267
Change-Id: Ie75bb3b535feeb6ccf3f6a391f21b69f241e625e

4 years agoVersion 1.4.9 placeholder
Mike Bayer [Thu, 15 Apr 2021 15:00:29 +0000 (11:00 -0400)] 
Version 1.4.9 placeholder

4 years ago- 1.4.8 rel_1_4_8
Mike Bayer [Thu, 15 Apr 2021 14:19:32 +0000 (10:19 -0400)] 
- 1.4.8

4 years agoMerge "test fixes from non-gerrit builds"
mike bayer [Thu, 15 Apr 2021 13:36:40 +0000 (13:36 +0000)] 
Merge "test fixes from non-gerrit builds"

4 years agoMerge "Fix with_expression() cache leak; don't adapt singletons"
mike bayer [Thu, 15 Apr 2021 12:35:07 +0000 (12:35 +0000)] 
Merge "Fix with_expression() cache leak; don't adapt singletons"

4 years agotest fixes from non-gerrit builds
Mike Bayer [Thu, 15 Apr 2021 12:28:34 +0000 (08:28 -0400)] 
test fixes from non-gerrit builds

- Fix savepoint test in test_memusage which hasn't been
running, jenkins now has this enabled for more backends

- fix SQL Server failure in test_assorted_eager

- don't mention "from_self()" in the error message for
Query

Fixes: #6277
Change-Id: I0b351032604bd19604143f86f5f055eefd4d0c23

4 years agoMerge "Fix as_declarative mypy test"
mike bayer [Thu, 15 Apr 2021 00:11:12 +0000 (00:11 +0000)] 
Merge "Fix as_declarative mypy test"

4 years agoFix with_expression() cache leak; don't adapt singletons
Mike Bayer [Wed, 14 Apr 2021 22:53:25 +0000 (18:53 -0400)] 
Fix with_expression() cache leak; don't adapt singletons

Fixed a cache leak involving the :func:`_orm.with_expression` loader
option, where the given SQL expression would not be correctly considered as
part of the cache key.

Additionally, fixed regression involving the corresponding
:func:`_orm.query_expression` feature. While the bug technically exists in
1.3 as well, it was not exposed until 1.4. The "default expr" value of
``null()`` would be rendered when not needed, and additionally was also not
adapted correctly when the ORM rewrites statements such as when using
joined eager loading. The fix ensures "singleton" expressions like ``NULL``
and ``true`` aren't "adapted" to refer to columns in ORM statements, and
additionally ensures that a :func:`_orm.query_expression` with no default
expression doesn't render in the statement if a
:func:`_orm.with_expression` isn't used.

Fixes: #6259
Change-Id: I5a70bc12dadad125bbc4324b64048c8d4a18916c

4 years agoFix as_declarative mypy test
Bryan Forbes [Wed, 14 Apr 2021 22:51:40 +0000 (17:51 -0500)] 
Fix as_declarative mypy test

Change-Id: I7f131c336cfe8987a1bcebf4a4068fd227f01226

4 years agodon't base compilation off the int value of offset/limit part II
Mike Bayer [Wed, 14 Apr 2021 20:14:36 +0000 (16:14 -0400)] 
don't base compilation off the int value of offset/limit part II

Fixed an additional regression in the same area as that of :ticket:`6184`,
where using a value of 0 for OFFSET in conjunction with LIMIT with SQL
Server would create a statement using "TOP", as was the behavior in 1.3,
however due to caching would then fail to respond accordingly to other
values of OFFSET. If the "0" wasn't first, then it would be fine. For the
fix, the "TOP" syntax is now only emitted if the OFFSET value is omitted
entirely, that is, :meth:`_sql.Select.offset` is not used. Note that this
change now requires that if the "with_ties" or "percent" modifiers are
used, the statement can't specify an OFFSET of zero, it now needs to be
omitted entirely.

Fixes: #6265
Change-Id: If30596b8dcd9f2ce4221cd87c5407fa81f5f9a90

4 years agoremove comment (post-production)
Mike Bayer [Wed, 14 Apr 2021 17:22:05 +0000 (13:22 -0400)] 
remove comment (post-production)

remove comment as stated in I47959bc826e3d9d2396ccfa290eb084841b02e77

Change-Id: Ic7978494314000cc4f57555802f22c1970bccc31

4 years agoMerge "Support DEFAULT VALUES and VALUES(DEFAULT) individually"
mike bayer [Wed, 14 Apr 2021 17:21:36 +0000 (17:21 +0000)] 
Merge "Support DEFAULT VALUES and VALUES(DEFAULT) individually"

4 years agoSupport DEFAULT VALUES and VALUES(DEFAULT) individually
Mike Bayer [Tue, 13 Apr 2021 14:52:00 +0000 (10:52 -0400)] 
Support DEFAULT VALUES and VALUES(DEFAULT) individually

Fixed regression where the introduction of the INSERT syntax "INSERT...
VALUES (DEFAULT)" was not supported on some backends that do however
support "INSERT..DEFAULT VALUES", including SQLite. The two syntaxes are
now each individually supported or non-supported for each dialect, for
example MySQL supports "VALUES (DEFAULT)" but not "DEFAULT VALUES".
Support for Oracle is still not enabled as there are unresolved issues
in using RETURNING at the same time.

Fixes: #6254
Change-Id: I47959bc826e3d9d2396ccfa290eb084841b02e77

4 years agoExplicitly test for Connection in dialect.has_table()
Mike Bayer [Wed, 14 Apr 2021 16:12:08 +0000 (12:12 -0400)] 
Explicitly test for Connection in dialect.has_table()

The :meth:`_engine.Dialect.has_table` method now raises an informative
exception if a non-Connection is passed to it, as this incorrect behavior
seems to be common.  This method is not intended for external use outside
of a dialect.  Please use the :meth:`.Inspector.has_table` method
or for cross-compatibility with older SQLAlchemy versions, the
:meth:`_engine.Engine.has_table` method.

Fixes: #5780
Fixes: #6062
Fixes: #6260
Change-Id: I9b2439675167019b68d682edee3dcdcfce836987

4 years agoFix OrderingList handling
Bryan Forbes [Mon, 12 Apr 2021 21:24:37 +0000 (16:24 -0500)] 
Fix OrderingList handling

Revised the fix for ``OrderingList`` from version 1.4.7 which was testing
against the incorrect API.

Fixes: #6205
Change-Id: I1d3f8b6534b70ae000294c2a67f08117cb77ee99

4 years agoMerge "Update mypy plugin to conform to strict mode"
mike bayer [Tue, 13 Apr 2021 19:38:32 +0000 (19:38 +0000)] 
Merge "Update mypy plugin to conform to strict mode"

4 years agoDisable raiseload in immediateload strategy
Mike Bayer [Tue, 13 Apr 2021 03:48:02 +0000 (23:48 -0400)] 
Disable raiseload in immediateload strategy

Fixed issue in the new feature of :meth:`_orm.Session.refresh` introduced
by :ticket:`1763` where eagerly loaded relationships are also refreshed,
where the ``lazy="raise"`` and ``lazy="raise_on_sql"`` loader strategies
would interfere with the :func:`_orm.immediateload` loader strategy, thus
breaking the feature for relationships that were loaded with
:func:`_orm.selectinload`, :func:`_orm.subqueryload` as well.

Also update some docs re: refresh, populate existing, etc.

Fixes: #6252
Change-Id: I5ac1430d33f1ce868426c22c7635f41f738580ce

4 years agoUpdate mypy plugin to conform to strict mode
Bryan Forbes [Mon, 12 Apr 2021 21:24:37 +0000 (16:24 -0500)] 
Update mypy plugin to conform to strict mode

Change-Id: I09a3df5af2f2d4ee34d8d72c3dedc4f236df8eb1

4 years agoMerge "Fix typo that prevented setting the ``bind`` attribute of an :class:`_asyncio...
mike bayer [Mon, 12 Apr 2021 19:38:50 +0000 (19:38 +0000)] 
Merge "Fix typo that prevented setting the ``bind`` attribute of an :class:`_asyncio.AsyncSession` to the correct value."

4 years agoMerge "Update mypy plugin to only use public plugin API"
mike bayer [Mon, 12 Apr 2021 19:38:13 +0000 (19:38 +0000)] 
Merge "Update mypy plugin to only use public plugin API"

4 years agoMerge "Ensure bindparam key escaping applied in all cases"
mike bayer [Mon, 12 Apr 2021 19:32:03 +0000 (19:32 +0000)] 
Merge "Ensure bindparam key escaping applied in all cases"

4 years agoMerge "Fix supports_schemas entry in changelog_14.rst"
mike bayer [Mon, 12 Apr 2021 19:31:20 +0000 (19:31 +0000)] 
Merge "Fix supports_schemas entry in changelog_14.rst"

4 years agoEnsure bindparam key escaping applied in all cases
Mike Bayer [Mon, 12 Apr 2021 18:33:50 +0000 (14:33 -0400)] 
Ensure bindparam key escaping applied in all cases

Fixed regression where the :class:`_sql.BindParameter` object would not
properly render for an IN expression (i.e. using the "post compile" feature
in 1.4) if the object were copied from either an internal cloning
operation, or from a pickle operation, and the parameter name contained
spaces or other special characters.

Fixes: #6249
Change-Id: Icd0d4096c8fa4eb1a1d4c20f8a96d8b1ae439f0a

4 years agoFixed typo in docstring 6246/head
Mark Bell [Mon, 12 Apr 2021 01:47:24 +0000 (02:47 +0100)] 
Fixed typo in docstring

4 years agoReturn Row for CursorResult.inserted_primary_key
Mike Bayer [Sun, 11 Apr 2021 21:15:55 +0000 (17:15 -0400)] 
Return Row for CursorResult.inserted_primary_key

The tuple returned by :attr:`.CursorResult.inserted_primary_key` is now a
:class:`_result.Row` object with a named tuple interface on top of the
existing tuple interface.

Fixes: #3314
Change-Id: I85677ef60d8329648f368bf497f634758f4e087b

4 years agoFix supports_schemas entry in changelog_14.rst
Gord Thompson [Sun, 11 Apr 2021 17:39:41 +0000 (11:39 -0600)] 
Fix supports_schemas entry in changelog_14.rst

The default for supports_schemas is ``True`` so
third-party dialects would set it to ``False``
if they want to *disable* the schema-level tests.

Change-Id: I63aea1ed14fc1f08ec7d5c8860097414ac607322

4 years agoDocument AsyncSession.refresh() w/ refresh-expire cascade quirk
Mike Bayer [Sun, 11 Apr 2021 15:30:01 +0000 (11:30 -0400)] 
Document AsyncSession.refresh() w/ refresh-expire cascade quirk

Change-Id: I90e884d12e5843609fa9078aaba4d471e80ba7cd
References: #6243

4 years agoClarify select_from(A).join(B.a)
Mike Bayer [Sun, 11 Apr 2021 15:10:20 +0000 (11:10 -0400)] 
Clarify select_from(A).join(B.a)

Fixes: #2722
Change-Id: I025715023fa74b1f9ade4ecc8ed8712f42de727a

4 years agoupdate .Unicode documentation
Mike Bayer [Sat, 10 Apr 2021 15:51:47 +0000 (11:51 -0400)] 
update .Unicode documentation

to reflect the modernization that was already done in
String.

Fixes: #6238
Change-Id: I92c667b45f040c6dad431c53d89d01fdcc2a2a2a

4 years agoFix typo that prevented setting the ``bind``
Federico Caselli [Sat, 10 Apr 2021 13:24:21 +0000 (15:24 +0200)] 
Fix typo that prevented setting the ``bind``
attribute of an :class:`_asyncio.AsyncSession` to the correct value.

Fixes: #6220
Change-Id: I91021351b8076e4aa4139af4b2cf359b3c0404af

4 years agoFix trivial typo in README.unittests 6237/head
Stephen Rosen [Fri, 9 Apr 2021 23:32:34 +0000 (23:32 +0000)] 
Fix trivial typo in README.unittests

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 agoUpdate mypy plugin to only use public plugin API
Bryan Forbes [Fri, 9 Apr 2021 19:27:16 +0000 (14:27 -0500)] 
Update mypy plugin to only use public plugin API

Change-Id: Id7f4e4a39e17c1b6ec3c754e2fc5c6ba4b437c38

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