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

2 years agoMerge "repair psycopg2 (and psycopg) multiple hosts format" into rel_1_4
mike bayer [Tue, 2 Aug 2022 13:49:58 +0000 (13:49 +0000)] 
Merge "repair psycopg2 (and psycopg) multiple hosts format" into rel_1_4

2 years agodocument @ sign in issue template, docs
Mike Bayer [Tue, 2 Aug 2022 13:33:51 +0000 (09:33 -0400)] 
document @ sign in issue template, docs

Fixes: #8328
Change-Id: I69a48c4499fe7e57aad242403186e69c4452b84b
(cherry picked from commit 7f45bcd114c797105921e06789b3753e7d8f6daa)

2 years agorepair psycopg2 (and psycopg) multiple hosts format
Mike Bayer [Mon, 1 Aug 2022 14:29:13 +0000 (10:29 -0400)] 
repair psycopg2 (and psycopg) multiple hosts format

Fixed issue in psycopg2 dialect where the "multiple hosts" feature
implemented for :ticket:`4392`, where multiple ``host:port`` pairs could be
passed in the query string as
``?host=host1:port1&host=host2:port2&host=host3:port3`` was not implemented
correctly, as it did not propagate the "port" parameter appropriately.
Connections that didn't use a different "port" likely worked without issue,
and connections that had "port" for some of the entries may have
incorrectly passed on that hostname. The format is now corrected to pass
hosts/ports appropriately.

As part of this change, maintained support for another multihost style that
worked unintentionally, which is comma-separated
``?host=h1,h2,h3&port=p1,p2,p3``. This format is more consistent with
libpq's query-string format, whereas the previous format is inspired by a
different aspect of libpq's URI format but is not quite the same thing.

If the two styles are mixed together, an error is raised as this is
ambiguous.

Fixes: #4392
Change-Id: Ic9cc0b0e6e90725e158d9efe73e042853dd1263f
(cherry picked from commit 93e6f4f05ba885b16accf0ad811160dd7d0eec70)

2 years agoUpdate to flake8 5.
Federico Caselli [Sun, 31 Jul 2022 09:56:07 +0000 (11:56 +0200)] 
Update to flake8 5.

Change-Id: I5a241a70efba68bcea9819ddce6aebc25703e68d
(cherry picked from commit f8c4dba4e9f130c18ce00597c036bc26ae7abf90)

2 years agouse inherited members for Query
Mike Bayer [Sat, 30 Jul 2022 19:14:23 +0000 (15:14 -0400)] 
use inherited members for Query

not sure why these four methods were here, they don't
get sorted when doing it this way.

Change-Id: I554f132df3f299858ca5b451a79fbd9dd1f520ee
(cherry picked from commit 14bfbadfdf9260a1c40f63b31641b27fe9de12a0)

2 years agoglossary: update the acronym definition (#8306)
bbben [Sat, 30 Jul 2022 18:43:59 +0000 (02:43 +0800)] 
glossary: update the acronym definition (#8306)

* glossary: fix typo

* add 'Read' to the CRUD definition

(cherry picked from commit b86112fd85c7810424308d3864a67462fbc9288c)

2 years agoglossary: primary_key needs value (#8298)
Fabian Preiß [Sat, 30 Jul 2022 10:47:15 +0000 (12:47 +0200)] 
glossary: primary_key needs value (#8298)

(cherry picked from commit 8076f9f590bdf9d7d138bae3408b81e59771dbd5)

2 years agolink to index correctly
Mike Bayer [Sat, 30 Jul 2022 04:30:28 +0000 (00:30 -0400)] 
link to index correctly

Fixes: #8303
Change-Id: If3568309e4dd3e9ef715b32f9ad90eeba7f662e8
(cherry picked from commit 0c30dcfb4ba45400cf7df9056c53e4ad7fef1ad2)

3 years agoUpdate metadata.rst (#8290)
Paul Lettich [Tue, 26 Jul 2022 21:28:28 +0000 (23:28 +0200)] 
Update metadata.rst (#8290)

add missing colon in docs

(cherry picked from commit 2ab519f59cf81307966dba3d5b8a176d45deb297)

3 years agoremove mypy_path workaround and ensure messages received
Mike Bayer [Sat, 23 Jul 2022 14:18:06 +0000 (10:18 -0400)] 
remove mypy_path workaround and ensure messages received

Fixes: #8281
Change-Id: Ice47880ba7924daff68aef6b1791f3c66849f550
(cherry picked from commit 4fe222d9412df30fc15ace3d7a7fd4365eb9e05a)

3 years agoclarify update perf test has only one test so far
Mike Bayer [Thu, 21 Jul 2022 13:41:50 +0000 (09:41 -0400)] 
clarify update perf test has only one test so far

this was pretty misleading as it shows up first in the
file listing

Change-Id: I6a92820e487a04632b651f9f6c631b32e338c043
(cherry picked from commit b9043754f039ff5b2bdf2379bd3d89eadd81e96d)

3 years agoMerge "check for TypeDecorator when handling getitem" into rel_1_4
mike bayer [Tue, 19 Jul 2022 17:57:22 +0000 (17:57 +0000)] 
Merge "check for TypeDecorator when handling getitem" into rel_1_4

3 years agocheck for TypeDecorator when handling getitem
Mike Bayer [Tue, 19 Jul 2022 14:50:05 +0000 (10:50 -0400)] 
check for TypeDecorator when handling getitem

Fixed issue where :class:`.TypeDecorator` would not correctly proxy the
``__getitem__()`` operator when decorating the :class:`.ARRAY` datatype,
without explicit workarounds.

Fixes: #7249
Change-Id: I3273572b4757e41fb5952639cb867314227d368a
(cherry picked from commit 1e01fab7e600c53284eabceceab5706e4074eb2e)

3 years agorender all three elements selected in bundle example
Mike Bayer [Tue, 19 Jul 2022 15:13:59 +0000 (11:13 -0400)] 
render all three elements selected in bundle example

Fixes: #8013
Change-Id: I9b5f800d94abd80d07ca5f58c24f111618415674
(cherry picked from commit eefc8c985400cd458e561d61299a2b81bdff1189)

3 years agoadd shield() in aexit
Federico Caselli [Fri, 17 Jun 2022 21:12:39 +0000 (23:12 +0200)] 
add shield() in aexit

Added ``asyncio.shield()`` to the connection and session release process
specifically within the ``__aexit__()`` context manager exit, when using
:class:`.AsyncConnection` or :class:`.AsyncSession` as a context manager
that releases the object when the context manager is complete. This appears
to help with task cancellation when using alternate concurrency libraries
such as ``anyio``, ``uvloop`` that otherwise don't provide an async context
for the connection pool to release the connection properly during task
cancellation.

Fixes: #8145
Change-Id: I0b1ea9c3a22a18619341cbb8591225fcd339042c
(cherry picked from commit 1acaf0b2e4859a274e753b5054dcde3d5c7ca10e)

3 years agouse concat() directly for contains, startswith, endswith
Mike Bayer [Sun, 17 Jul 2022 15:32:27 +0000 (11:32 -0400)] 
use concat() directly for contains, startswith, endswith

Adjusted the SQL compilation for string containment functions
``.contains()``, ``.startswith()``, ``.endswith()`` to force the use of the
string concatenation operator, rather than relying upon the overload of the
addition operator, so that non-standard use of these operators with for
example bytestrings still produces string concatenation operators.

To accommodate this, needed to add a new _rconcat operator function,
which is private, as well as a fallback in concat_op() that works
similarly to Python builtin ops.

Fixes: #8253
Change-Id: I2b7f56492f765742d88cb2a7834ded6a2892bd7e
(cherry picked from commit 85a88df13ab8d217331cf98392544a888b4d7df3)

3 years agoremove needlessly complex assoc proxy mixin example
Mike Bayer [Fri, 15 Jul 2022 16:53:37 +0000 (12:53 -0400)] 
remove needlessly complex assoc proxy mixin example

this is some very exotic example that doesn't really
explain anything new about mixins and only serves
to make the docs less accessible.

Change-Id: Ic51a12de3358f3a451bd7cf3542b375569499fc1
(cherry picked from commit 68d882387978d60dd354ba067de85ea298940376)

3 years agostep five
Mike Bayer [Fri, 15 Jul 2022 12:55:08 +0000 (08:55 -0400)] 
step five

Change-Id: Ib6242d676c800b4b679aaf7f33f641ebcaed5b33
(cherry picked from commit a0597341195ba7445ef1e9c69092e3bd29427aec)

3 years agodocument create_engine.isolation_level for PG
Mike Bayer [Wed, 13 Jul 2022 15:02:37 +0000 (11:02 -0400)] 
document create_engine.isolation_level for PG

Change-Id: I06eaede9e021eb0790929168e9bedb0c8b58140a
References: #8252
(cherry picked from commit a3a3299b5b9728a432ba900754047844ecfb98d6)

3 years agolink to main isolation level document
Mike Bayer [Wed, 13 Jul 2022 14:54:52 +0000 (10:54 -0400)] 
link to main isolation level document

this was already in 2.0.  a few more corrections coming

Change-Id: Id94eee9081fd5174bad2275f544010e7cb467454
references: #8252

3 years agoUpdate docs for association_proxy
Gord Thompson [Fri, 8 Jul 2022 17:50:54 +0000 (11:50 -0600)] 
Update docs for association_proxy

Make naming more consistent and explicit

Change-Id: If90de9ab8b10348d6d1547b9fd6e3b2c312d9ee8
(cherry picked from commit 9f295d1e9ce9ffbdd93e6d9e2537fd9a353c1a2f)

3 years agosupport "SELECT *" for ORM queries
Mike Bayer [Mon, 11 Jul 2022 01:24:17 +0000 (21:24 -0400)] 
support "SELECT *" for ORM queries

A :func:`_sql.select` construct that is passed a sole '*' argument for
``SELECT *``, either via string, :func:`_sql.text`, or
:func:`_sql.literal_column`, will be interpreted as a Core-level SQL
statement rather than as an ORM level statement. This is so that the ``*``,
when expanded to match any number of columns, will result in all columns
returned in the result. the ORM- level interpretation of
:func:`_sql.select` needs to know the names and types of all ORM columns up
front which can't be achieved when ``'*'`` is used.

If ``'*`` is used amongst other expressions simultaneously with an ORM
statement, an error is raised as this can't be interpreted correctly by the
ORM.

Fixes: #8235
Change-Id: Ic8e84491e14acdc8570704eadeaeaf6e16b1e870
(cherry picked from commit 3916bfc9ccf2904f69498075849a82ceee225b3a)

3 years agodocument using fetch() with Oracle
Mike Bayer [Thu, 7 Jul 2022 15:44:09 +0000 (11:44 -0400)] 
document using fetch() with Oracle

We implemented working FETCH support, but it's not
yet implied by limit/offset.  The docs make no mention
that this is available which is very misleading including
to maintainers.    Make it clear that fetch() support is
there right now, it's just not yet implicit with
limit/offset.

Change-Id: Ib2231dcdd80a8bf3ac4bbf590e1a8dfeac31e9da
References: #8221
(cherry picked from commit 805a1323b973a30af99ce506dd5c5c4ab96cff0f)

3 years agogeneralize sql server check for id col to accommodate ORM cases
Mike Bayer [Wed, 6 Jul 2022 01:05:18 +0000 (21:05 -0400)] 
generalize sql server check for id col to accommodate ORM cases

Fixed issues that prevented the new usage patterns for using DML with ORM
objects presented at :ref:`orm_dml_returning_objects` from working
correctly with the SQL Server pyodbc dialect.

Here we add a step to look in compile_state._dict_values more thoroughly
for the keys we need to determine "identity insert" or not, and also
add a new compiler variable dml_compile_state so that we can skip the
ORM's compile_state if present.

Fixes: #8210
Change-Id: Idbd76bb3eb075c647dc6c1cb78f7315c821e15f7
(cherry picked from commit 5806428800d2f1ac775156f90497a2fc3a644f35)

3 years agoMerge "move backref to "legacy"" into rel_1_4
mike bayer [Mon, 4 Jul 2022 18:14:04 +0000 (18:14 +0000)] 
Merge "move backref to "legacy"" into rel_1_4

3 years agoMerge "Support lambda expression in mypy plugin" into rel_1_4
mike bayer [Mon, 4 Jul 2022 18:13:42 +0000 (18:13 +0000)] 
Merge "Support lambda expression in mypy plugin" into rel_1_4