]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 years agobackport relevant mypy 0.990 fixes from main
Mike Bayer [Fri, 11 Nov 2022 21:04:06 +0000 (16:04 -0500)] 
backport relevant mypy 0.990 fixes from main

Changes from ebb54e80a5a52d0cce4cba1abc21c707a42c2c73
which are relevant here.

Adjusted the test suite which tests the Mypy plugin to accommodate for
changes in Mypy 0.990 regarding how it handles message output, which affect
how sys.path is interpreted when determining if notes and errors should be
printed for particular files. The change broke the test suite as the files
within the test directory itself no longer produced messaging when run
under the mypy API.

Change-Id: I1728fd3bd21a4d499db0a4939ee27c67b2c34123

2 years agorepair --disable-asyncio parameter
Mike Bayer [Fri, 11 Nov 2022 14:46:06 +0000 (09:46 -0500)] 
repair --disable-asyncio parameter

Fixed issue where the ``--disable-asyncio`` parameter to the test suite
would fail to not actually run greenlet tests and would also not prevent
the suite from using a "wrapping" greenlet for the whole suite. This
parameter now ensures that no greenlet or asyncio use will occur within the
entire run when set.

Fixes: #8793
Change-Id: I87b510846b2cc24413cd54e7b7136e91aad3c309
(cherry picked from commit 7f7e961f46aeff5895bd34fec9e2e208862d7a6b)

2 years agoblock all maridb-connector testing
Mike Bayer [Fri, 11 Nov 2022 16:21:55 +0000 (11:21 -0500)] 
block all maridb-connector testing

while we wait for this project to fix its install,
ensure CI isn't running it.

Change-Id: Iffc2efa38078a07c6ffc3417246b5b898ecbd53d

2 years agodisable timing intensive on py27
Mike Bayer [Sat, 5 Nov 2022 20:07:49 +0000 (16:07 -0400)] 
disable timing intensive on py27

this includes disabling a very not important test for
automap that's failing on github

Change-Id: Ib91be649ecb07e620060a38a206317dcd6a81899

2 years agogc.collect() in order to ensure GeneratorExit raised on pypy
Mike Bayer [Sat, 5 Nov 2022 14:26:36 +0000 (10:26 -0400)] 
gc.collect() in order to ensure GeneratorExit raised on pypy

Fixes: #8762
Change-Id: Ibf656748ae6a54282ba58e91215e0f7a279b171a
(cherry picked from commit 9febc1a53e4dbb363b1ead65bbe47e0c4f948bae)

2 years agoVersion 1.4.44 placeholder
Mike Bayer [Fri, 4 Nov 2022 21:08:40 +0000 (17:08 -0400)] 
Version 1.4.44 placeholder

2 years ago- 1.4.43 rel_1_4_43
Mike Bayer [Fri, 4 Nov 2022 21:04:01 +0000 (17:04 -0400)] 
- 1.4.43

2 years agotypo
Mike Bayer [Fri, 4 Nov 2022 21:00:29 +0000 (17:00 -0400)] 
typo

Change-Id: I41cb128767c0cba48255cca0904ae1bff1b357ac
(cherry picked from commit 6410e372cb344084ee13942bd5b9eb78b24fc50c)

2 years agofix doc symbols
Mike Bayer [Fri, 4 Nov 2022 20:44:29 +0000 (16:44 -0400)] 
fix doc symbols

for 1.4, these are ambiguous due to the presence of
future names

Change-Id: I3694e75da73fe20c19445007c8823030789fc6c0

2 years agochangelog updates
Mike Bayer [Fri, 4 Nov 2022 20:16:48 +0000 (16:16 -0400)] 
changelog updates

as this release cycle was fairly frenetic, a lot of these
changelogs were very poorly worded (by me).

Change-Id: Idb796cf3e25975fb2f75bacf26f1cb57ef0e4cad
(cherry picked from commit 751469240a1f2908d16ca2b087b5dac55dbdcb47)

2 years agoresolve synonyms in dictionary form of Session.get()
Mike Bayer [Fri, 4 Nov 2022 16:48:43 +0000 (12:48 -0400)] 
resolve synonyms in dictionary form of Session.get()

Improved "dictionary mode" for :meth:`_orm.Session.get` so that synonym
names which refer to primary key attribute names may be indicated in the
named dictionary.

Fixes: #8753
Change-Id: I56112564a5c23b51b26e01c64087cbf4399cd951
(cherry picked from commit 7b6259c0f3ae411976f8febfe41f2c5fc3490b13)

2 years agoMerge "soft close cursor for Query direct iterator interrupted" into rel_1_4
mike bayer [Thu, 3 Nov 2022 22:40:38 +0000 (22:40 +0000)] 
Merge "soft close cursor for Query direct iterator interrupted" into rel_1_4

2 years agosoft close cursor for Query direct iterator interrupted
Mike Bayer [Tue, 1 Nov 2022 19:09:25 +0000 (15:09 -0400)] 
soft close cursor for Query direct iterator interrupted

Fixed issue where the underlying DBAPI cursor would not be closed when
using :class:`_orm.Query` and direct iteration, if a user-defined exception
case were raised within the iteration process, interrupting the iterator
which otherwise is not possible to re-use in this context. When using
:meth:`_orm.Query.yield_per` to create server-side cursors, this would lead
to the usual MySQL-related issues with server side cursors out of sync.

To resolve, a catch for ``GeneratorExit`` is applied within the default
iterator, which applies only in those cases where the interpreter is
calling ``.close()`` on the iterator in any case.

A similar scenario can occur when using :term:`2.x` executions with direct
use of :class:`.Result`, in that case the end-user code has access to the
:class:`.Result` itself and should call :meth:`.Result.close` directly.
Version 2.0 will feature context-manager calling patterns to address this
use case.  However within the 1.4 scope, ensured that ``.close()`` methods
are available on all :class:`.Result` implementations including
:class:`.ScalarResult`, :class:`.MappingResult`.

Fixes: #8710
Change-Id: I3166328bfd3900957eb33cbf1061d0495c9df670

2 years agoMerge "use simple decimal query to detect decimal char" into rel_1_4
mike bayer [Wed, 2 Nov 2022 16:57:07 +0000 (16:57 +0000)] 
Merge "use simple decimal query to detect decimal char" into rel_1_4

2 years agofix event name
Mike Bayer [Wed, 2 Nov 2022 12:39:39 +0000 (08:39 -0400)] 
fix event name

Change-Id: I26af2326034be07f0ebc91dfbf31d00c40acf585
References: #8717
(cherry picked from commit 7249fa4a51f20c6c62ba94241900600023662bdb)

2 years agoscale back warnings for 1.4's bulk methods
Mike Bayer [Wed, 2 Nov 2022 02:57:16 +0000 (22:57 -0400)] 
scale back warnings for 1.4's bulk methods

since these methods have been improved for 2.0, the general
idea is not going away, so remove the warnings indicating
that these features are being removed.

Change-Id: I2c436c2e7f9aeacc9e71c82af4016190314f04ca

2 years agouse simple decimal query to detect decimal char
Mike Bayer [Mon, 31 Oct 2022 19:09:34 +0000 (15:09 -0400)] 
use simple decimal query to detect decimal char

Fixed issue where the ``nls_session_parameters`` view queried on first
connect in order to get the default decimal point character may not be
available depending on Oracle connection modes, and would therefore raise
an error.  The approach to detecting decimal char has been simplified to
test a decimal value directly, instead of reading system views, which
works on any backend / driver.

Fixes: #8744
Change-Id: I39825131c13513798863197d0c180dd5a18b32dc
(cherry picked from commit 12b334417bf67c1ed302d30787e4c2dfae7ee335)

2 years agoMerge "ensure pool.reset event always called for reset" into rel_1_4
mike bayer [Sun, 30 Oct 2022 21:49:33 +0000 (21:49 +0000)] 
Merge "ensure pool.reset event always called for reset" into rel_1_4

2 years agoensure pool.reset event always called for reset
Mike Bayer [Tue, 25 Oct 2022 20:00:50 +0000 (16:00 -0400)] 
ensure pool.reset event always called for reset

Fixed issue where the :meth:`.PoolEvents.reset` event hook would
not be called when a :class:`.Connection` were closed which already
closed its own transaction.  Logic that bypasses the "rollback on return"
behavior of the pool was also skipping the event hook being emitted,
preventing custom pool reset schemes from being used within this hook.
This was a regression that appeared in version 1.4.

For version 1.4, the hook is still not called in the case of an asyncio
connection that is being discarded due to garbage collection. Version 2.0
will feature an improved version of :meth:`.PoolEvents.reset` which also
receives contextual information about the reset, so that comprehensive
"custom connection reset" schemes can be devised.  Existing custom
reset schemes that make use of :meth:`.PoolEvents.checkin` remain
usable as they typically only need to deal with connections that are to
be re-used.

Change-Id: Ie17c4f55d02beb6f570b9de6b3044baffa7d6df6
Fixes: #8717
(cherry picked from commit bb8c36c5d2622e6e7033dc59dc98da0926ba7c00)

2 years agofix test for same mapper to use "isa"
Mike Bayer [Sun, 30 Oct 2022 00:08:25 +0000 (20:08 -0400)] 
fix test for same mapper to use "isa"

Fixed issue in joined eager loading where an assertion fail would occur
with a particular combination of outer/inner joined eager loads in
conjunction with an inherited subclass mapper as the middle target.

Fixes: #8738
Change-Id: I4909e7518302cbb82046e0425abbbdc8eb1c0146
(cherry picked from commit 99e7afb4b2d82baff80f5d1fe1b2d1b21cbbec09)

2 years agoMerge "use only object_id() function for temp tables" into rel_1_4
mike bayer [Sat, 29 Oct 2022 01:36:29 +0000 (01:36 +0000)] 
Merge "use only object_id() function for temp tables" into rel_1_4

2 years agoMerge "ensure _ORMJoin transfers parententity from left side" into rel_1_4
mike bayer [Sat, 29 Oct 2022 01:35:08 +0000 (01:35 +0000)] 
Merge "ensure _ORMJoin transfers parententity from left side" into rel_1_4

2 years agoupdate rel/fk FAQ entry
Mike Bayer [Fri, 28 Oct 2022 16:20:22 +0000 (12:20 -0400)] 
update rel/fk FAQ entry

this entry still made the assumptions of behavior before
ticket #3061, that accessing a non-initialized scalar attribute
on a pending object would populate the attribute with None.
It also used the word "initialize" when referring to a persistent
object which is a misleading term, it's "loaded", even though
in this example it's "loading" the value of None.

Fix up the language to be more consistent with the #3061 change.

Change-Id: I1abd8f1d2e9c44ebc9a29737ea270b338f104a3e
(cherry picked from commit 654d941ce9c571de18aa09a09dc6cd90bf24734c)

2 years agoMerge "apply basic escaping to anon_labels unconditionally" into rel_1_4
mike bayer [Fri, 28 Oct 2022 13:59:16 +0000 (13:59 +0000)] 
Merge "apply basic escaping to anon_labels unconditionally" into rel_1_4

2 years agouse only object_id() function for temp tables
Mike Barry [Wed, 26 Oct 2022 17:40:32 +0000 (13:40 -0400)] 
use only object_id() function for temp tables

Fixed issue with :meth:`.Inspector.has_table` when used against a temporary
table for the SQL Server dialect would fail an invalid object name error on
some Azure variants, due to an unnecessary information schema query that is
not supported on those server versions. Pull request courtesy Mike Barry.

the patch also fills out test support for has_table()
against temp tables, temp views, adding to the has_table() support just
added for views in #8700.

Fixes: #8714
Closes: #8716
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8716
Pull-request-sha: e2ac7a52e2b09a349a703ba1e1a2911f4d3c0912

Change-Id: Ia73e4e9e977a2d6b7e100abd2f81a8c8777dc9bb
(cherry picked from commit 2af33d79eddc696c0fb1ef749999fa5d0d33f214)

2 years agoopen some compound tests for mysql 8.0.31
Mike Bayer [Fri, 28 Oct 2022 05:49:48 +0000 (01:49 -0400)] 
open some compound tests for mysql 8.0.31

Not sure of exact version but as we have done a major
rebuild of CI, newer mysql 8.0 is passing on these.

Change-Id: Ibcfe0ce519ab6a2941ca514b4254944769b60df4
(cherry picked from commit 50d3b85c693a4ca673bcabd711f130ae58111f16)

2 years agomssql doc updates
Mike Bayer [Fri, 28 Oct 2022 05:49:03 +0000 (01:49 -0400)] 
mssql doc updates

clarify some URL things

Change-Id: Ic162834052f06fd3a6c010ce5d091903fdc65cd8
(cherry picked from commit c262184ae5bac969b18eff8e10ba6d94c229499d)

2 years agoapply basic escaping to anon_labels unconditionally
Mike Bayer [Thu, 27 Oct 2022 13:28:02 +0000 (09:28 -0400)] 
apply basic escaping to anon_labels unconditionally

Fixed issue which prevented the :func:`_sql.literal_column` construct from
working properly within the context of a :class:`.Select` construct as well
as other potential places where "anonymized labels" might be generated, if
the literal expression contained characters which could interfere with
format strings, such as open parenthesis, due to an implementation detail
of the "anonymous label" structure.

Fixes: #8724
Change-Id: I3089124fbd055a011c8a245964258503b717d941
(cherry picked from commit caa9f0ff98d44359f5162bca8e7fe7bcaa2989a7)

2 years agoensure _ORMJoin transfers parententity from left side
Mike Bayer [Thu, 27 Oct 2022 02:59:51 +0000 (22:59 -0400)] 
ensure _ORMJoin transfers parententity from left side

Fixed bug involving :class:`.Select` constructs which used a combination of
:meth:`.Select.select_from` with an ORM entity followed by
:meth:`.Select.join` against the entity sent in
:meth:`.Select.select_from`, as well as using plain
:meth:`.Select.join_from`, which when combined with a columns clause that
didn't explicitly include that entity would then cause "automatic WHERE
criteria" features such as the IN expression required for a single-table
inheritance subclass, as well as the criteria set up by the
:func:`_orm.with_loader_criteria` option, to not be rendered for that
entity. The correct entity is now transferred to the :class:`.Join` object
that's generated internally, so that the criteria against the left
side entity is correctly added.

Fixes: #8721
Change-Id: I8266430063e2c72071b7262fdd5ec5079fbcba3e
(cherry picked from commit 54ecc0fde9851f551c6e467b58d5bf7c4135e0ba)

2 years agoraise for non-Load opt passed to options()
Mike Bayer [Tue, 25 Oct 2022 14:22:14 +0000 (10:22 -0400)] 
raise for non-Load opt passed to options()

Fixed the exception that's raised when the
:func:`_orm.with_loader_criteria` option is attempted to be used within a
specific loader path, like in loader.options().
:func:`_orm.with_loader_criteria` is only intended to be used at the top
level.

Fixes: #8711
Change-Id: Iaa7b13956b808761e618a6be6406e5c82df1c65c
(cherry picked from commit eae9d1420bbfde4dbd835b654e80653cd5ac2155)

2 years agoadd Oracle-specific parameter escapes for expanding params
Mike Bayer [Mon, 24 Oct 2022 23:24:11 +0000 (19:24 -0400)] 
add Oracle-specific parameter escapes for expanding params

Fixed issue where bound parameter names, including those automatically
derived from similarly-named database columns, which contained characters
that normally require quoting with Oracle would not be escaped when using
"expanding parameters" with the Oracle dialect, causing execution errors.
The usual "quoting" for bound parameters used by the Oracle dialect is not
used with the "expanding parameters" architecture, so escaping for a large
range of characters is used instead, now using a list of characters/escapes
that are specific to Oracle.

Fixes: #8708
Change-Id: I90c24e48534e1b3a4c222b3022da58159784d91a
(cherry picked from commit b1cd6e4295b07e01983deb2845f6e22a059f5b76)

2 years agoskip ad-hoc properties within subclass_load_via_in
Mike Bayer [Sun, 23 Oct 2022 23:24:54 +0000 (19:24 -0400)] 
skip ad-hoc properties within subclass_load_via_in

Fixed issue where "selectin_polymorphic" loading for inheritance mappers
would not function correctly if the :param:`_orm.Mapper.polymorphic_on`
parameter referred to a SQL expression that was not directly mapped on the
class.

Fixes: #8704
Change-Id: I1b6be2650895fd18d2c804f6ba96de966d11041a
(cherry picked from commit bd1777426255648215328252795dff24dfd08616)

2 years agotest support for has_table()->view; backport to 1.4
Mike Bayer [Sun, 23 Oct 2022 14:34:33 +0000 (10:34 -0400)] 
test support for has_table()->view; backport to 1.4

For 1.4 only; in 2.0 this just refines the test suite a bit.

Fixed regression which occurred throughout the 1.4 series where the
:meth:`.Inspector.has_table` method, which historically reported on views
as well, stopped working for SQL Server.  The method never worked for
Oracle in this way, so for compatibility within the 1.4 series,
Oracle's dialect remains returning False for ``has_table()`` against a
view within the 1.4 series.

The issue is not present in the 2.0 series which uses a different
reflection architecture, where has_table() reports True for views on all
backends including SQL Server and Oracle. Test support is added within the
1.4 series to ensure ``has_table()`` remains working per spec re: views.

Fixes: #8700
Change-Id: I119a91ec07911edb08cf0799234827fec9ea1195
(cherry picked from commit c02f6b744d304578fe67da2e13d2c02ab71140d2)

2 years agoadd step 6 to migration docs
Mike Bayer [Fri, 21 Oct 2022 16:44:18 +0000 (12:44 -0400)] 
add step 6 to migration docs

Users will need to attend to explicitly annotated models
that don't use Mapped[], for a clean transition from 1.4
to 2.0.

Fixes: #8692
Change-Id: I212018574e752d1109c712ea29ea277be5a13382

2 years agofix missing pool __init__ documentation
Mike Bayer [Fri, 21 Oct 2022 13:26:26 +0000 (09:26 -0400)] 
fix missing pool __init__ documentation

Change-Id: Ic3e7fb3cc4995372646822e40d914b83a7fa78c8
(cherry picked from commit 2fc5cf56a4b146b94b5dd14239a791e354d7ebe4)

2 years agomove API docs downwards
Mike Bayer [Thu, 20 Oct 2022 16:28:29 +0000 (12:28 -0400)] 
move API docs downwards

Sphinx 5.3 (compared to 5.1.1) is now putting all the autodoc
names into the TOC.   So we have to start being more careful
to make sure API docs are well below narrative docs, because
this new style is a wall of text.   i dont yet see any options
to turn it off, but it does seem like a good improvement, just makes
doc organization a more difficult endeavor.

Change-Id: I49428076fef9b96ef1544621de9a9dfca1699dab
(cherry picked from commit b3e1fe7577efa799821a1e3ab6321d712fbfaab6)

2 years agorename tables to _table for basic relationships
Mike Bayer [Wed, 19 Oct 2022 13:23:21 +0000 (09:23 -0400)] 
rename tables to _table for basic relationships

the names "parent" / "child" are confusing for new users
in that they are used for table names as well as
"back_populates='parent'", use a disambiguated name.

In this change, there's now overlap between the
variable named "association_table" and the table name
"association_table".  not sure of a better naming system.

Change-Id: Ic036c8072caf6e9e5fbd1178986353c00b91f43d
References: https://github.com/sqlalchemy/sqlalchemy/discussions/8675#discussioncomment-3915204

2 years agoupdate SEQUENCE docs ahead of default change
Mike Bayer [Mon, 17 Oct 2022 19:09:01 +0000 (15:09 -0400)] 
update SEQUENCE docs ahead of default change

for backport to 1.4 as well, remove references to
Firebird, and also revert "associate Sequence with MetaData"
step as this is not needed usually, just note that schema
is not shared.  encourage users to use IDENTITY instead.

Change-Id: I5d25357042127c9cd1274c9de7abb44a525b0195
(cherry picked from commit 665c94cc2f0340735515c4f4477e11b556d2bcd8)

2 years agoVersion 1.4.43 placeholder
Mike Bayer [Sun, 16 Oct 2022 14:25:36 +0000 (10:25 -0400)] 
Version 1.4.43 placeholder

2 years ago- 1.4.42 rel_1_4_42
Mike Bayer [Sun, 16 Oct 2022 14:12:34 +0000 (10:12 -0400)] 
- 1.4.42

2 years agoadd python 3.11 to supported versions
Mike Bayer [Sun, 16 Oct 2022 14:09:20 +0000 (10:09 -0400)] 
add python 3.11 to supported versions

Change-Id: Ibf699297b12c1c72c570db380282e97adfdef2b9
(cherry picked from commit 7fd8898b10669c8e6b08c5d66c92bdc975aaa353)

2 years agodisable isort in pyproject.toml
Mike Bayer [Sat, 15 Oct 2022 15:12:25 +0000 (11:12 -0400)] 
disable isort in pyproject.toml

disable isort, for IDEs that just default isort to be turned on, e.g. vscode.
we use flake8-import-order for import sorting, using zimports to actually
reformat code.  isort is nicer in many ways but doesn't have our
"import *" fixer and also is not 100% compatible with flake8-import-order.

Change-Id: I8e53d475cdc1d6178e2c9276d2b21d47be207ede
(cherry picked from commit e8da50ce0f0474bc89cee15603931760cb6c55ce)

2 years agofix instances of objects as instances of classes (#8627)
Muhammad Abdur Rakib [Fri, 14 Oct 2022 17:53:49 +0000 (23:53 +0600)] 
fix instances of objects as instances of classes (#8627)

document mentions `creating instances of "User" and "Address" objects` which is a mistake as we create instances or objects from classes.

(cherry picked from commit fe89ffe7563192a0b8f83b045f6e35fbed2a4a19)

2 years agocorrect python compat statement
Mike Bayer [Fri, 14 Oct 2022 15:33:54 +0000 (11:33 -0400)] 
correct python compat statement

2.0 uses 3.7 at a minimum, update verbiage here.

Change-Id: I076e205bbfc9b502f1ac382f6292c290c3fc8c1b
(cherry picked from commit cb0dd78f584cea4f169a47a2f4660300f4a6e081)

2 years agonarrow formatting in table, turn format off
Mike Bayer [Fri, 14 Oct 2022 13:17:09 +0000 (09:17 -0400)] 
narrow formatting in table, turn format off

Change-Id: I0824495e0582657ffb63eaa2466021f56005c81c
References: https://github.com/sqlalchemy/sqlalchemy/discussions/8157#discussioncomment-3878806
(cherry picked from commit 1985cb0f48b298ffc445b052cd62a8d4a81f4e10)

2 years agoMerge "warn for no polymorphic identity w/ poly hierarchy" into rel_1_4
mike bayer [Tue, 11 Oct 2022 22:19:14 +0000 (22:19 +0000)] 
Merge "warn for no polymorphic identity w/ poly hierarchy" into rel_1_4

2 years agosupport multiple files to work correctly w/ pre-commit
Mike Bayer [Tue, 11 Oct 2022 19:32:47 +0000 (15:32 -0400)] 
support multiple files to work correctly w/ pre-commit

Change-Id: I7ddf1848b96105701b733306353ae949a4579339

2 years agowarn for no polymorphic identity w/ poly hierarchy
Mike Bayer [Mon, 10 Oct 2022 18:03:04 +0000 (14:03 -0400)] 
warn for no polymorphic identity w/ poly hierarchy

A warning is emitted when attempting to configure a mapped class within an
inheritance hierarchy where the mapper is not given any polymorphic
identity, however there is a polymorphic discriminator column assigned.
Such classes should be abstract if they never intend to load directly.

Fixes: #7545
Change-Id: I94f04e59736c73e3f39d883a75d763e3f06ecc3d
(cherry picked from commit bf0634131115a76aaca52eebd3c7d3fb52f8258b)

2 years agoremove redundant paragraph
Mike Bayer [Mon, 10 Oct 2022 14:42:59 +0000 (10:42 -0400)] 
remove redundant paragraph

backported from main; see comment at
https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/4042/52..61/doc/build/orm/queryguide/api.rst#239

Change-Id: I214784ef8f6ff523c3cc55df2318a85d45a0690d

2 years agoMerge "Add format docs to pre-commits" into rel_1_4
mike bayer [Mon, 10 Oct 2022 14:16:29 +0000 (14:16 +0000)] 
Merge "Add format docs to pre-commits" into rel_1_4

2 years agodont mutate bind_arguments incoming dictionary
Mike Bayer [Fri, 7 Oct 2022 15:25:08 +0000 (11:25 -0400)] 
dont mutate bind_arguments incoming dictionary

The :paramref:`_orm.Session.execute.bind_arguments` dictionary is no longer
mutated when passed to :meth:`_orm.Session.execute` and similar; instead,
it's copied to an internal dictionary for state changes. Among other
things, this fixes and issue where the "clause" passed to the
:meth:`_orm.Session.get_bind` method would be incorrectly referring to the
:class:`_sql.Select` construct used for the "fetch" synchronization
strategy, when the actual query being emitted was a :class:`_dml.Delete` or
:class:`_dml.Update`. This would interfere with recipes for "routing
sessions".

Fixes: #8614
Change-Id: I8d237449485c9bbf41db2b29a34b6136aa43b7bc
(cherry picked from commit 3efc9e1df378be8046d4b1f1b624968a62eb100f)

2 years agoAdd format docs to pre-commits
Federico Caselli [Thu, 6 Oct 2022 20:48:21 +0000 (22:48 +0200)] 
Add format docs to pre-commits

Also report changes from main to 1_4

Change-Id: Ia41399155ee0ec1b878aebf18967eabe38f5afd1

2 years agoFix missing column name in 1.x `IS NULL` example (#8595)
Jochen Kupperschmidt [Thu, 6 Oct 2022 19:27:02 +0000 (21:27 +0200)] 
Fix missing column name in 1.x `IS NULL` example (#8595)

2 years agoMerge "experiment w/ docs formatter on SQLA 1.4" into rel_1_4
mike bayer [Wed, 5 Oct 2022 14:56:45 +0000 (14:56 +0000)] 
Merge "experiment w/ docs formatter on SQLA 1.4" into rel_1_4

2 years agoadjust MySQL view reflection for non-standard MySQL variants
John Bodley [Fri, 30 Sep 2022 01:58:58 +0000 (21:58 -0400)] 
adjust MySQL view reflection for non-standard MySQL variants

Adjusted the regular expression used to match "CREATE VIEW" when
testing for views to work more flexibly, no longer requiring the
special keyword "ALGORITHM" in the middle, which was intended to be
optional but was not working correctly.  The change allows view reflection
to work more completely on MySQL-compatible variants such as StarRocks.
Pull request courtesy John Bodley.

Fixes: #8588
Closes: #8589
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8589
Pull-request-sha: d85b2c5b51e45cec543c9ae9d62d6d659b063354

Change-Id: I173137f0bf68639cad0d5c329055475b40ddb5e4
(cherry picked from commit 9829bc43d69ea5e714014f5ac5f036a94d13bc08)

2 years agoclarify precedence docs
Mike Bayer [Mon, 3 Oct 2022 15:40:27 +0000 (11:40 -0400)] 
clarify precedence docs

Change-Id: I748f2736eb6382c8625b3419a82785b48766d8f7
references: #8584
(cherry picked from commit b295a3b58f13d566c37244448218e4287f5e47ee)

2 years agoexperiment w/ docs formatter on SQLA 1.4
Mike Bayer [Sun, 2 Oct 2022 18:04:43 +0000 (14:04 -0400)] 
experiment w/ docs formatter on SQLA 1.4

Enhanced the "{sql}" thing some more so that it maintains
these tags exactly as they were.

Note that the "{sql}" and "{stop}" tags are intended
to be on the Python code lines, not the SQL lines, so special
handling to find these, preserve them, then add them back
after python code is formatted is added here.

Change-Id: I07acd3ea54608cd63bee8003679f8dff131a90f4

2 years agoadd autobuild; improve a few session docs
Mike Bayer [Fri, 30 Sep 2022 17:07:04 +0000 (13:07 -0400)] 
add autobuild; improve a few session docs

this is from the writeonly patch, some doc edits became
more general so will backport these to 1.4.

Change-Id: I19231e4bcfa33a0742c8995b6059c9a9488b1a6f
(cherry picked from commit abcd088551fda5490ad56c401a8e8260fae0dcfd)

2 years agorewrite the first section of ORM quickstart
Mike Bayer [Thu, 29 Sep 2022 21:32:54 +0000 (17:32 -0400)] 
rewrite the first section of ORM quickstart

Adapted from  1158cf3a872e22e3136cccb05e975d

Change-Id: Ic124321b6d6fb50827be26d1917ce158683ce82f

2 years agoDocument user-defined functions for sqlite
Gord Thompson [Wed, 29 Jun 2022 13:38:38 +0000 (07:38 -0600)] 
Document user-defined functions for sqlite

Change-Id: I64e4d4dce8c5f5aced3190f9e3682c630462a61e
(cherry picked from commit 48a0df55c1cfb8746eec8073c0feb05be1652665)

2 years agoMerge "`aggregate_order_by` now supports cache generation." into rel_1_4
mike bayer [Mon, 26 Sep 2022 02:33:29 +0000 (02:33 +0000)] 
Merge "`aggregate_order_by` now supports cache generation." into rel_1_4

2 years ago`aggregate_order_by` now supports cache generation.
Federico Caselli [Sun, 25 Sep 2022 14:37:15 +0000 (16:37 +0200)] 
`aggregate_order_by` now supports cache generation.

also adjusted CacheKeyFixture to be a general purpose
fixture so that sub-components / dialects can run
their own cache key tests.

Fixes: #8574
Change-Id: I6c66107856aee11e548d357cea77bceee3e316a0
(cherry picked from commit 7980b677085fc759a0406f6778b9729955f3c7f6)

2 years agowarn for local-only column in remote side
Mike Bayer [Sun, 25 Sep 2022 18:56:22 +0000 (14:56 -0400)] 
warn for local-only column in remote side

A warning is emitted in ORM configurations when an explicit
:func:`_orm.remote` annotation is applied to columns that are local to the
immediate mapped class, when the referenced class does not include any of
the same table columns. Ideally this would raise an error at some point as
it's not correct from a mapping point of view.

Fixes: #7094
Fixes: #8575
Change-Id: Ia31be24aebe143161e19dc311b52c08fd5014d33
(cherry picked from commit 29838ef584d49e5ecca08f76e4966454dc7f060f)

2 years agoadd missing changelog for #8569
Mike Bayer [Sat, 24 Sep 2022 15:16:16 +0000 (11:16 -0400)] 
add missing changelog for #8569

Missed this in 57b400f07951f0ae8651ca383.  have no idea how.

Fixes: #8569
Change-Id: I4cec98d8c963930ef822bfd53d8a60a20be02894
(cherry picked from commit 75ab50869b37368f32ec311dfb59777c0c1d1edb)

2 years agoremove should_nest behavior for contains_eager()
Mike Bayer [Fri, 23 Sep 2022 19:17:57 +0000 (15:17 -0400)] 
remove should_nest behavior for contains_eager()

Fixed regression for 1.4 in :func:`_orm.contains_eager` where the "wrap in
subquery" logic of :func:`_orm.joinedload` would be inadvertently triggered
for use of the :func:`_orm.contains_eager` function with similar statements
(e.g. those that use ``distinct()``, ``limit()`` or ``offset()``). This is
not appropriate for :func:`_orm.contains_eager` which has always had the
contract that the user-defined SQL statement is unmodified with the
exception of adding the appropriate columns.

Also includes an adjustment to the assertion in Label._make_proxy()
which was there to prevent a fixed label name from being anonymized;
if the label is already anonymous, the change should proceed.
This logic was being hit before the contains_eager behavior was
adjusted. With the adjustment, this code is not used.

Fixes: #8569
Change-Id: I161e65041c0162fd2b83cbef40f57a50fcfaf0fd
(cherry picked from commit 57b400f07951f0ae8651ca38338ec5be1d222c7e)

2 years agobreak out text() from TextualSelect for col matching
Mike Bayer [Mon, 19 Sep 2022 13:40:40 +0000 (09:40 -0400)] 
break out text() from TextualSelect for col matching

Fixed issue where mixing "*" with additional explicitly-named column
expressions within the columns clause of a :func:`_sql.select` construct
would cause result-column targeting to sometimes consider the label name or
other non-repeated names to be an ambiguous target.

Fixes: #8536
Change-Id: I3c845eaf571033e54c9208762344f67f4351ac3a
(cherry picked from commit 78327d98be9236c61f950526470f29b184dabba6)

2 years agochange verbiage stating exact compliance with RFC-1738
Mike Bayer [Sat, 17 Sep 2022 14:33:55 +0000 (10:33 -0400)] 
change verbiage stating exact compliance with RFC-1738

As long as we aren't using urlparse() to parse URLs,
we are not RFC-1738 compliant.   As we accept underscores
in the scheme and not dashes or dots, we are not
RFC-1738 compliant, so emulate language like
that of PostgreSQL [1] that we "generally follow" this
scheme but include some exceptions.

[1] https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6
Fixes: #8519
Change-Id: I2d7e55d9df17aed122cebb2c4c315f56c06a3da5
(cherry picked from commit c88bb2167b1c4b39c7f9378b621bb8d429269d90)

2 years agoremove obtuse section about "bundled bind parameters"
Mike Bayer [Sat, 17 Sep 2022 14:18:56 +0000 (10:18 -0400)] 
remove obtuse section about "bundled bind parameters"

Just looking for basics on insert in the first pages
of the tutorial I see this weird detour into something that
nobody ever uses and definitely isn't going to make sense
to the people I see complaining about our docs on twitter,
remove this.   the tutorial probably needs a big sweep
for wordy obtuse things.  the userbase is changing and
we really have a lot of brand-new-to-programming types coming
in.

Change-Id: I3bb11f0399e55edbb8f874e7eb63c40616b04e8b
(cherry picked from commit f0bcd57f9ed76ba8d871448d821a85089f490b6c)

2 years agoMerge "use get_event_loop() for python 3.6" into rel_1_4
mike bayer [Fri, 16 Sep 2022 22:27:37 +0000 (22:27 +0000)] 
Merge "use get_event_loop() for python 3.6" into rel_1_4

2 years agoMerge "catch exception for system_views also" into rel_1_4
mike bayer [Fri, 16 Sep 2022 22:26:40 +0000 (22:26 +0000)] 
Merge "catch exception for system_views also" into rel_1_4

2 years agofix documentation typos
Federico Caselli [Fri, 16 Sep 2022 21:50:47 +0000 (23:50 +0200)] 
fix documentation typos

Closes #8527
Change-Id: I0354f3953075fa35a84b09ad45fd850d8889c992

2 years agouse get_event_loop() for python 3.6
Mike Bayer [Thu, 15 Sep 2022 22:54:31 +0000 (18:54 -0400)] 
use get_event_loop() for python 3.6

per https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop
the get_event_loop method will eventually be an alias for
get_running_loop.   the latter is not present in python 3.6

Fixes: #8516
Change-Id: Idc9ba0ca5030e7f5878d31a9ab5b5cc5d40f98b9

2 years agoMake 652755e7571c8cc2ec4e8beab8ef6b1f180c496b compatible with py36
Federico Caselli [Thu, 15 Sep 2022 21:38:47 +0000 (23:38 +0200)] 
Make 652755e7571c8cc2ec4e8beab8ef6b1f180c496b compatible with py36

Change-Id: I8072146e9c4405a96b566392afa8e57661aa2a42

2 years agoMerge "Improved usage of ``asyncio.shield()``" into rel_1_4
Federico Caselli [Thu, 15 Sep 2022 20:19:12 +0000 (20:19 +0000)] 
Merge "Improved usage of ``asyncio.shield()``" into rel_1_4

2 years agoMerge "Add type awareness to evaluator" into rel_1_4
mike bayer [Thu, 15 Sep 2022 15:31:52 +0000 (15:31 +0000)] 
Merge "Add type awareness to evaluator" into rel_1_4

2 years agoImproved usage of ``asyncio.shield()``
Federico Caselli [Tue, 13 Sep 2022 19:23:12 +0000 (21:23 +0200)] 
Improved usage of ``asyncio.shield()``

Fixes: #8516
Change-Id: Ifd8f5e5f42d9fbcd5b8d00bddc81ff6be690a75e
(cherry picked from commit e2e85de93daef31c75d397251cee2fbee7a5de65)

2 years agoAdd type awareness to evaluator
Mike Bayer [Tue, 13 Sep 2022 15:00:46 +0000 (11:00 -0400)] 
Add type awareness to evaluator

Fixed regression where using ORM update() with synchronize_session='fetch'
would fail due to the use of evaluators that are now used to determine the
in-Python value for expressions in the the SET clause when refreshing
objects; if the evaluators make use of math operators against non-numeric
values such as PostgreSQL JSONB, the non-evaluable condition would fail to
be detected correctly. The evaluator now limits the use of math mutation
operators to numeric types only, with the exception of "+" that continues
to work for strings as well. SQLAlchemy 2.0 may alter this further by
fetching the SET values completely rather than using evaluation.

For 1.4 this also adds "concat_op" as evaluable; 2.0 already has
more string operator support

Fixes: #8507
Change-Id: Icf7120ccbf4266499df6bb3e05159c9f50971d69
(cherry picked from commit 4ab1bc641c7d5833cf20d8ab9b38f5bfba37cfdd)

2 years agocatch exception for system_views also
Mike Bayer [Thu, 15 Sep 2022 12:42:34 +0000 (08:42 -0400)] 
catch exception for system_views also

Fixed yet another regression in SQL Server isolation level fetch (see
:ticket:`8231`, :ticket:`8475`), this time with "Microsoft Dynamics CRM
Database via Azure Active Directory", which apparently lacks the
``system_views`` view entirely. Error catching has been extended that under
no circumstances will this method ever fail, provided database connectivity
is present.

Fixes: #8525
Change-Id: I76a429e3329926069a0367d2e77ca1124b9a059d
(cherry picked from commit 0ee7d693b805c0f1aea0da5ebc11ea6e52b42c71)

2 years agoadd missing doc for mariadb-connector
Mike Bayer [Thu, 15 Sep 2022 03:09:08 +0000 (23:09 -0400)] 
add missing doc for mariadb-connector

this module was never indexed.   kind of a major oversight

Change-Id: I4389a2ca3900edc70130fbae66195605a5704362
(cherry picked from commit 310dd2e6a741c606e5be40ef35cac6ed63e10bfe)

2 years agoadd docs for session.get()
Mike Bayer [Wed, 7 Sep 2022 23:00:31 +0000 (19:00 -0400)] 
add docs for session.get()

also use the term "primary key" a bit more

Change-Id: Ib654b30a9d06a2aeed019b4754db920afe05d774
References: https://twitter.com/encthenet/status/1567644850471989248
(cherry picked from commit cc72081b0c32dbd089fb9601747f448b65414640)

2 years agoupdate workflows
Federico Caselli [Wed, 7 Sep 2022 20:08:55 +0000 (22:08 +0200)] 
update workflows

Change-Id: Iaec865386bb3e969efec3ac75dc27ead288eca5d

2 years agoVersion 1.4.42 placeholder
Mike Bayer [Wed, 7 Sep 2022 00:58:37 +0000 (20:58 -0400)] 
Version 1.4.42 placeholder

2 years ago- 1.4.41 rel_1_4_41
Mike Bayer [Wed, 7 Sep 2022 00:53:28 +0000 (20:53 -0400)] 
- 1.4.41

2 years agochangelog fixes
Mike Bayer [Wed, 7 Sep 2022 00:49:15 +0000 (20:49 -0400)] 
changelog fixes

Change-Id: Ie0217dfea32d08abf7934950b1e1b381e612bb56

2 years agoFix Azure Synapse connection error
Gord Thompson [Thu, 1 Sep 2022 17:10:20 +0000 (11:10 -0600)] 
Fix Azure Synapse connection error

Fixed regression caused by the fix for :ticket:`8231` released in 1.4.40
where connection would fail if the user does not have permission to query
the dm_exec_sessions or dm_pdw_nodes_exec_sessions system view when trying
to determine the current transaction isolation level.

Fixes: #8475
Change-Id: Ie2bcda92f2ef2d12360ddda47eb6e896313c71f2
(cherry picked from commit 645977088404da0ed6d72ae7638a7d23dcf1e8e7)

2 years agoMerge "run update_subclass anytime we add new clslevel dispatch" into rel_1_4
mike bayer [Thu, 1 Sep 2022 12:26:18 +0000 (12:26 +0000)] 
Merge "run update_subclass anytime we add new clslevel dispatch" into rel_1_4

2 years agofix minor typo subuqeries -> subqueries
bkcsfi [Wed, 31 Aug 2022 20:42:47 +0000 (16:42 -0400)] 
fix minor typo subuqeries -> subqueries

(cherry picked from commit 41268fa6352c514ba2d5f0b3ecc16019a63547b6)

2 years agorun update_subclass anytime we add new clslevel dispatch
Mike Bayer [Wed, 31 Aug 2022 15:07:23 +0000 (11:07 -0400)] 
run update_subclass anytime we add new clslevel dispatch

Fixed event listening issue where event listeners added to a superclass
would be lost if a subclass were created which then had its own listeners
associated. The practical example is that of the :class:`.sessionmaker`
class created after events have been associated with the
:class:`_orm.Session` class.

Fixes: #8467
Change-Id: I9bdba8769147e30110a09900d4a577e833ac3af9
(cherry picked from commit d3e0b8e750d864766148cdf1a658a601079eed46)

2 years agoFix typo in 'ORM Querying Guide' docs
Andrés Álvarez [Fri, 26 Aug 2022 16:55:12 +0000 (10:55 -0600)] 
Fix typo in 'ORM Querying Guide' docs

(cherry picked from commit 087efa784d4ba08118dc9a34a765afd5174f4287)

2 years agoFix doc snippet (#8414)
Daniel Dương [Tue, 30 Aug 2022 21:05:25 +0000 (18:05 -0300)] 
Fix doc snippet (#8414)

(cherry picked from commit ec65def6bffa94d1c89ae5896e4d7e85f9abe84a)

2 years agoMerge "include TableClause.schema in cache key" into rel_1_4
mike bayer [Tue, 30 Aug 2022 17:11:12 +0000 (17:11 +0000)] 
Merge "include TableClause.schema in cache key" into rel_1_4

2 years agoMerge "implement event for merge/load=False for mutable state setup" into rel_1_4
mike bayer [Tue, 30 Aug 2022 17:10:33 +0000 (17:10 +0000)] 
Merge "implement event for merge/load=False for mutable state setup" into rel_1_4

2 years agorestore test concurrency try 2
Federico Caselli [Mon, 29 Aug 2022 18:57:01 +0000 (20:57 +0200)] 
restore test concurrency try 2

Change-Id: I54730f9683a1de3f1379ca8d2a1cab8c485e7bcc
(cherry picked from commit d8e135a474bdc2147786ec8919facc8f6fdf84f6)

2 years agoinclude TableClause.schema in cache key
Mike Bayer [Tue, 30 Aug 2022 14:47:24 +0000 (10:47 -0400)] 
include TableClause.schema in cache key

Fixed issue where use of the :func:`_sql.table` construct, passing a string
for the :paramref:`_sql.table.schema` parameter, would fail to take the
"schema" string into account when producing a cache key, thus leading to
caching collisions if multiple, same-named :func:`_sql.table` constructs
with different schemas were used.

Fixes: #8441
Change-Id: Ic4b55b3e8ec53b4c88ba112691bdf60ea1d4c448
(cherry picked from commit 613642d9639f47ad11ab62a3fa71f6132edbaa0d)

2 years agoimplement event for merge/load=False for mutable state setup
Mike Bayer [Tue, 30 Aug 2022 14:25:47 +0000 (10:25 -0400)] 
implement event for merge/load=False for mutable state setup

Fixed issue in :mod:`sqlalchemy.ext.mutable` extension where collection
links to the parent object would be lost if the object were merged with
:meth:`.Session.merge` while also passing :paramref:`.Session.merge.load`
as False.

The event added here is currently private for expediency, but
is acceptable to become a public event at some point.

Fixes: #8446
Change-Id: I9e5b9f1f5a0c5a9781f51635d5e57b1134c9e866
(cherry picked from commit e15cf451affdef95b3248d1ea5c31ac923e661c3)

2 years agoapply consistent ORM mutable notes for all mutable SQL types
Mike Bayer [Tue, 30 Aug 2022 13:50:03 +0000 (09:50 -0400)] 
apply consistent ORM mutable notes for all mutable SQL types

in
https://github.com/sqlalchemy/sqlalchemy/discussions/8447
I was surprised that we didnt have any notes about using Mutable
for ARRAY classes, since we have them for HSTORE and JSON.

Add a consistent topic box for these so we have something to
point towards.

Change-Id: Idfa1b2cbee67024545f4fa299e4c875075ec7d3f
(cherry picked from commit 2f146b172ad228e40f1e8d5f1d2abc888ae5e669)

2 years agoMerge "refine ruleset to determine when poly adaption should be used" into rel_1_4
mike bayer [Tue, 30 Aug 2022 04:53:00 +0000 (04:53 +0000)] 
Merge "refine ruleset to determine when poly adaption should be used" into rel_1_4

2 years agorefine ruleset to determine when poly adaption should be used
Mike Bayer [Mon, 29 Aug 2022 14:43:36 +0000 (10:43 -0400)] 
refine ruleset to determine when poly adaption should be used

Fixed regression appearing in the 1.4 series where a joined-inheritance
query placed as a subquery within an enclosing query for that same entity
would fail to render the JOIN correctly for the inner query. The issue
manifested in two different ways prior and subsequent to version 1.4.18
(related issue #6595), in one case rendering JOIN twice, in the other
losing the JOIN entirely. To resolve, the conditions under which
"polymorphic loading" are applied have been scaled back to not be invoked
for simple joined inheritance queries.

Fixes: #8456
Change-Id: Ie4332fadb1dfc670cd31d098a6586a9f6976bcf7
(cherry picked from commit 137b50e1ecf1ddea1ff63d94f24f6445e6807dc9)

2 years agorun github pipeline on python 3.11
Mike Bayer [Thu, 25 Aug 2022 18:05:16 +0000 (14:05 -0400)] 
run github pipeline on python 3.11

Change-Id: I555c1e16c5347e67da4c70414b4677b2d3afebd5

2 years agotry out greenlet / cython on py311
Mike Bayer [Thu, 25 Aug 2022 18:05:16 +0000 (14:05 -0400)] 
try out greenlet / cython on py311

I've updated jenkins to see what happens

Change-Id: If71b3f6da98dacd21419e8ece2395bc5fd20d133
(cherry picked from commit e14a8e3295d289e256bf236d0461034f35b7fcc3)