]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
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)

2 years agointegrate connection.terminate() for supporting dialects
Mike Bayer [Tue, 23 Aug 2022 13:28:06 +0000 (09:28 -0400)] 
integrate connection.terminate() for supporting dialects

Integrated support for asyncpg's ``terminate()`` method call for cases
where the connection pool is recycling a possibly timed-out connection,
where a connection is being garbage collected that wasn't gracefully
closed, as well as when the connection has been invalidated. This allows
asyncpg to abandon the connection without waiting for a response that may
incur long timeouts.

Fixes: #8419
Change-Id: Ia575af779d5733b483a72dff3690b8bbbad2bb05
(cherry picked from commit 3b7e621aa728d9b01dbac4150e13ea2ef6af35a3)

2 years agomore function adjustments
Mike Bayer [Mon, 22 Aug 2022 17:55:08 +0000 (13:55 -0400)] 
more function adjustments

the inherited-members feature works very poorly
and inconsistently in sphinx.  just dont use it here as it
refuses to exclude ColumnOperators methods

Change-Id: Ic50865c9901e7225a99ff7f33454da15ff91b12f
(cherry picked from commit 25fa4c0250730958c39676007cc39df7b0ee2124)

2 years agoreformat functions.rst; document coalsce
Mike Bayer [Mon, 22 Aug 2022 17:43:59 +0000 (13:43 -0400)] 
reformat functions.rst; document coalsce

this file was all over the place autodocumenting all the
contents of functions.py with no regards to the heading
paragraph which seemed to be introducing the generic functions.
Use specific autoclass/autofunc docs as automodule is generally
unworkable.

Add missing docstring for coalesce function.

Fixes: #8415
Change-Id: I4c37e6153282ce99b9f5d674f6e802c25ef536e1
(cherry picked from commit 07961a8bd0b965d79855275b0eb80075b57c2d49)

2 years agoremove narrative "reconstructor" document
Mike Bayer [Fri, 19 Aug 2022 15:12:41 +0000 (11:12 -0400)] 
remove narrative "reconstructor" document

this event hook is not commonly used and this page does not
fit into the current narrative very well.  We should possibly
write a new paragraph regarding how instances load
at some point though the best place to put it is not clear.

(cherry picked from commit e7b2055866f315a77e1e19a832a5afdae90bfd9f)

2 years agoremove notes re: current pymssql DBAPI features
Mike Bayer [Fri, 19 Aug 2022 14:16:34 +0000 (10:16 -0400)] 
remove notes re: current pymssql DBAPI features

Fixes: #8337
Change-Id: Ib0c107bb386489dcb6d1683f29d0a9574dd96f1e
(cherry picked from commit 319e5a3d8e92ccc97faeeaecd55313131e5a611b)

2 years agofix some inaccuracies in with_variant doc
Mike Bayer [Fri, 19 Aug 2022 13:49:25 +0000 (09:49 -0400)] 
fix some inaccuracies in with_variant doc

* the table wont create on mysql/mariadb b.c. user_name had
  no length
* "utf-8" is not recognized by mysql/mariadb, use "utf8"
* mysql or mariadb name match is determined by the URL, not the
  actual DB that is detected (I know I made it work that way but
  I forgot)
* for the 1.4 backport only, will remove the "mariadb" part
  as we dont support that API, #8408

Fixes: #8408
Change-Id: I5b0a58a3f94a3450631e2405bd07d0a77599ae26
(cherry picked from commit 7f99c4ab55a80ee428b3466e9fa476d6ea03bfaf)

2 years agoset old declarative docs as orphan
Mike Bayer [Thu, 18 Aug 2022 17:56:50 +0000 (13:56 -0400)] 
set old declarative docs as orphan

these otherwise show up in the sidebar where they are
confusing

Change-Id: Ic7bdcd31207a135e2805241928ca2379a8189565
(cherry picked from commit e2e412f6a3354682ab792f3f9eefc537207a44b4)

2 years agomore abstractconcretebase clarity
Mike Bayer [Thu, 18 Aug 2022 15:54:04 +0000 (11:54 -0400)] 
more abstractconcretebase clarity

Change-Id: I9ddb6b1a2e0c0be1fe355a7ea714d0e16aa93b47
(cherry picked from commit a47d76ca25275344345b208def5f72292e8687b4)

2 years agoremove nonsensical note
Mike Bayer [Thu, 18 Aug 2022 15:29:25 +0000 (11:29 -0400)] 
remove nonsensical note

this note is not factually incorrect but it makes no sense
why this would be in the middle of the abstract concrete doc

Change-Id: Icd67d9d9a93ee72714bf85d8d5ca39c0af61f356
(cherry picked from commit acf14885833da238606e6a0df7c5ab256e477f2c)

2 years agoMerge "fill out all distinguising fields for AliasedInsp" into rel_1_4
mike bayer [Wed, 17 Aug 2022 22:23:48 +0000 (22:23 +0000)] 
Merge "fill out all distinguising fields for AliasedInsp" into rel_1_4

2 years agofill out all distinguising fields for AliasedInsp
Mike Bayer [Wed, 17 Aug 2022 17:06:51 +0000 (13:06 -0400)] 
fill out all distinguising fields for AliasedInsp

Hardened the cache key strategy for the :func:`_orm.aliased` and
:func:`_orm.with_polymorphic` constructs. While no issue involving actual
statements being cached can easily be demonstrated (if at all), these two
constructs were not including enough of what makes them unique in their
cache keys for caching on the aliased construct alone to be accurate.

Fixes: #8401
Change-Id: I13d14985b6965f398edd9494601d8ae89ac641f2
(cherry picked from commit a58f1b9c698dc7be29d43f2c4c21de8918943f77)

2 years agoMerge "refine transfer of cached ORM options for selectin, lazy" into rel_1_4
mike bayer [Wed, 17 Aug 2022 18:42:32 +0000 (18:42 +0000)] 
Merge "refine transfer of cached ORM options for selectin, lazy" into rel_1_4

2 years agorefine transfer of cached ORM options for selectin, lazy
Mike Bayer [Tue, 16 Aug 2022 18:25:12 +0000 (14:25 -0400)] 
refine transfer of cached ORM options for selectin, lazy

Fixed issue involving :func:`_orm.with_loader_criteria` where a closure
variable used as bound parameter value within the lambda would not carry
forward correctly into additional relationship loaders such as
:func:`_orm.selectinload` and :func:`_orm.lazyload` after the statement
were cached, using the stale originally-cached value instead.

This change brings forth a good refinement where we finally realize
we shouldn't be testing every ORM option with lots of switches, we
just let the option itself be given "here is your uncached version,
you are cached, tell us what to do!".   the current decision is
that strategy loader options used the cached in all cases as they
always have, with_loader_criteria uses the uncached, because the
uncached will have been invoked with new closure state that we
definitely need.   The only
edge that might not work is if with_loader_criteria referenced
an entity that is local to the query, namely a specific AliasedInsp,
however that's not a documented case for this.  if we had to do that,
then we perhaps would introduce a more complex reconcilation
logic, and this would also give us the hook to do that.

For this approach to work in 1.4, state.load_options has to
be ordered, so, this does the switch of load_options from set->tuple,
which has been in 2.0 for a long time.  if this change is not
feasbile, due to affecting other areas, we may have to scale
back this fix a bit, but for here, it's just two collections
without any deep impacts.

Fixes: #8399
Change-Id: Ided8e2123915131e3f11cf6b06d773039e73797a
(cherry picked from commit 860d582028f6bbbb39cbf17698f7d6b7a8e458ea)

2 years agoremove erroneous note about future metadata
Mike Bayer [Wed, 17 Aug 2022 13:17:33 +0000 (09:17 -0400)] 
remove erroneous note about future metadata

this change was already applied

Change-Id: I24cfdc1912b77f98ae6d0f3865cabd223553fc79
(cherry picked from commit 0eea54e84df104ffe8bc246eb82e4a7a2cf05079)

2 years agoimprove names for datatypes section
Mike Bayer [Tue, 9 Aug 2022 13:50:57 +0000 (09:50 -0400)] 
improve names for datatypes section

Continuing along #8362, if we look at the document here without
"this is the same text I've read for 14 years", we begin to see
that the title "Column and Data types" makes no sense at all,
is there a "column type" and a "Data type"?  I guess what I was
thinking at that time is that a type can be placed on a
Column, or it can be used whenever you have, you know, "data".
The phrase "SQL expression" wasn't discovered yet.

"SQL Datatype" is not spectacular but at least it's one term.
the new intro then is focused on the hierarchy layout so let's
name it that.

not amazing, but better than the duplicate name that made
no sense before.

Fixes: #8362
Change-Id: Iab37ef5605ec55f30284ac9a98bf7246f736675d
(cherry picked from commit 7e442cd0a9341ac828b4c4820818ad80ad9200fa)

2 years agoimprove typing intro
Mike Bayer [Mon, 8 Aug 2022 18:50:29 +0000 (14:50 -0400)] 
improve typing intro

Fixes: #8362
Change-Id: I38aa1727e94c50a9f06bd75d57ea1ca1cfffd2f3
(cherry picked from commit ac1d775d862e62561effcce54462f687dd79b8bb)

2 years agoVersion 1.4.41 placeholder
Mike Bayer [Mon, 8 Aug 2022 16:16:26 +0000 (12:16 -0400)] 
Version 1.4.41 placeholder

2 years ago- 1.4.40 rel_1_4_40
Mike Bayer [Mon, 8 Aug 2022 16:10:25 +0000 (12:10 -0400)] 
- 1.4.40

2 years agorepair doc warnings
Mike Bayer [Mon, 8 Aug 2022 16:08:30 +0000 (12:08 -0400)] 
repair doc warnings

Change-Id: I446105028539a34da90d6b8ae4812965cc398ee5

2 years agodeep compare CTEs before considering them conflicting
Mike Bayer [Fri, 5 Aug 2022 21:25:05 +0000 (17:25 -0400)] 
deep compare CTEs before considering them conflicting

Fixed issue where referencing a CTE multiple times in conjunction with a
polymorphic SELECT could result in multiple "clones" of the same CTE being
constructed, which would then trigger these two CTEs as duplicates. To
resolve, the two CTEs are deep-compared when this occurs to ensure that
they are equivalent, then are treated as equivalent.

Fixes: #8357
Change-Id: I1f634a9cf7a6c4256912aac1a00506aecea3b0e2
(cherry picked from commit 85fa363c846f4ed287565c43c32e2cca29470e25)

2 years agoMerge "Fix 'No transaction found' error on Synapse." into rel_1_4
mike bayer [Thu, 4 Aug 2022 13:37:41 +0000 (13:37 +0000)] 
Merge "Fix 'No transaction found' error on Synapse." into rel_1_4

2 years agoupdate quoted_name doc
Mike Bayer [Thu, 4 Aug 2022 13:26:47 +0000 (09:26 -0400)] 
update quoted_name doc

Fixes: #8339
Change-Id: If78bc9babfdc6a4dde4e65d72858ac7a402cbb4d
(cherry picked from commit dc5a1c482ee1a8faf15fd81db866e5f72c1c719f)

2 years agomore mysql 8.0.30 fixes
Mike Bayer [Thu, 4 Aug 2022 00:47:50 +0000 (20:47 -0400)] 
more mysql 8.0.30 fixes

Change-Id: I9df3506f364f4721404cf2022486bc31fd5c2ce6
(cherry picked from commit 0b57cc9564caba442febb76a224a96c2b263ba10)

2 years agoadjust mysql utf test
Mike Bayer [Wed, 3 Aug 2022 22:09:39 +0000 (18:09 -0400)] 
adjust mysql utf test

we've updated mysql on jenkins and this test seems to need
a small adjustment

Change-Id: I21508f667700cf8f3200f15af501a66a85f48779
(cherry picked from commit ea6fb4ff5bcffcf71cdbc587504f10f03fe921ca)

2 years agoglossary/association relationship: role->role_name (#8331)
Fabian Preiß [Wed, 3 Aug 2022 20:25:19 +0000 (22:25 +0200)] 
glossary/association relationship: role->role_name (#8331)

(cherry picked from commit b5485fe41828c21a555d0d5a6abf29ceb3b3147f)

2 years agosend in the dragons on async_scoped_session
Mike Bayer [Wed, 3 Aug 2022 16:08:54 +0000 (12:08 -0400)] 
send in the dragons on async_scoped_session

make it clear that async_scoped_session.remove() must
be called, else memory will build up.    Generally
discourage the whole pattern as well, as this is a
"framework" pattern and we don't really want to be supporting
frameworks.    Also indicate that scopefunc must be idempotent
and lightweight.

Fixes: #8340
Change-Id: Ibc3d21124ae73c3b25ee51966504bbb1975c36b2
(cherry picked from commit c2327ec60f3f3b52a4b3a0daeef39174d96d225e)

2 years agoFix 'No transaction found' error on Synapse.
Gord Thompson [Fri, 22 Jul 2022 12:31:24 +0000 (08:31 -0400)] 
Fix 'No transaction found' error on Synapse.

Fixed issue where the SQL Server dialect's query for the current isolation
level would fail on Azure Synapse Analytics, due to the way in which this
database handles transaction rollbacks after an error has occurred. The
initial query has been modified to no longer rely upon catching an error
when attempting to detect the appropriate system view. Additionally, to
better support this database's very specific "rollback" behavior,
implemented new parameter ``ignore_no_transaction_on_rollback`` indicating
that a rollback should ignore Azure Synapse error 'No corresponding
transaction found. (111214)', which is raised if no transaction is present
in conflict with the Python DBAPI.

Fixes: #8231
Closes: #8233
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8233
Pull-request-sha: c48bd44a9f53d00e5e94f1b8bf996711b6419562

Change-Id: I6407a03148f45cc9eba8fe1d31d4f59ebf9c7ef7
(cherry picked from commit 8fe3cd69c5f2d8f73e75fb19ae929273282fba57)

2 years agoreword yield_per a bit more
Mike Bayer [Tue, 2 Aug 2022 18:51:49 +0000 (14:51 -0400)] 
reword yield_per a bit more

I'm still not satisified with this section as it is still
too wordy and dense, but at least let's put a better description
of what yield_per actually is and why one might use it at the top.

Change-Id: I10f4d862d9c499044f5718fca0d27ac106289717
(cherry picked from commit 3ef9fa6d4ff8ade8915000b41c262caf4a88e064)

2 years agofix mypy test
Mike Bayer [Tue, 2 Aug 2022 15:45:09 +0000 (11:45 -0400)] 
fix mypy test

this change seems to be from 2.0 in
4fe222d9412df30fc15ace3d7a however does not apply to 1.4.

Change-Id: Ie736afaf18abf048f4bf5f5266e76aefa98e4e80

2 years agofix up SAVEPOINT docs
Mike Bayer [Tue, 2 Aug 2022 15:34:35 +0000 (11:34 -0400)] 
fix up SAVEPOINT docs

these contained a factual error that the entire session is
expired, which is no longer the case (I can't find exactly
when this was changed).  Additionally, added a PostgreSQL
specific example w/ IntegrityError as this is the most
common case for this.   Tried to tighten up other language
and make it as clear as possible.

Change-Id: I39160e7443964db59d1d5a2e0616084767813eea
(cherry picked from commit 37b8c5e755cefd9ae0fdf6816dae09b519be3b06)