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

3 years agomove backref to "legacy"
Mike Bayer [Mon, 4 Jul 2022 17:05:37 +0000 (13:05 -0400)] 
move backref to "legacy"

in the interests of consistency as well as new typing features,
backref should be considered legacy and is fully superseded
by back_populates.

this commit is for 2.0 /1.4, in 2.0 further updates will be
made for new ORM syntaxes.

Change-Id: Idd3b7a3b07843b73304df69e476dc4239c60b3f8
(cherry picked from commit d49dfa74e86778eb5c581470405131ed9f9d0206)

3 years agofix formatting problems
Mike Bayer [Sun, 3 Jul 2022 15:09:16 +0000 (11:09 -0400)] 
fix formatting problems

Change-Id: Ib55fe1c60130a45bfbf28de5c74cfe7a30418bb3
(cherry picked from commit 4b3f204d07d53ae09b59ce8f33b534f26a605cd4)

3 years agodont use import * in any docs, ever
Mike Bayer [Sun, 3 Jul 2022 15:01:25 +0000 (11:01 -0400)] 
dont use import * in any docs, ever

(cherry picked from commit 9ab7b9a624cf5dfed93e0927eb4b3b62fe87e5ae)

3 years agochore: Set permissions for GitHub actions (#8117)
Naveen [Sat, 2 Jul 2022 21:58:16 +0000 (16:58 -0500)] 
chore: Set permissions for GitHub actions (#8117)

Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
(cherry picked from commit a8af28c99431fb62243f025cdea18099dde0c844)

3 years agoSupport lambda expression in mypy plugin
Cyril Chapellier [Thu, 30 Jun 2022 12:59:38 +0000 (14:59 +0200)] 
Support lambda expression in mypy plugin

Avoid `error: INTERNAL ERROR` when the default is a lambda

Fixes: #8196
Change-Id: I7346c693519b024c56156db6f4ffc9a45bb748d3
(cherry picked from commit 472dc0735c4d9385b05e5e2088dad9f507a59a63)

3 years agoclarify eager loading terminology
Mike Bayer [Fri, 1 Jul 2022 18:35:27 +0000 (14:35 -0400)] 
clarify eager loading terminology

Change-Id: Idb27ec5f09ef958d71738e1095b4be7a1377eecb
(cherry picked from commit 4b5ed6ad27b3b63ecf1b082653e2e3ee0abb887f)

3 years agorepair yield_per for non-SS dialects and add new options
Mike Bayer [Thu, 30 Jun 2022 23:10:06 +0000 (19:10 -0400)] 
repair yield_per for non-SS dialects and add new options

Implemented new :paramref:`_engine.Connection.execution_options.yield_per`
execution option for :class:`_engine.Connection` in Core, to mirror that of
the same :ref:`yield_per <orm_queryguide_yield_per>` option available in
the ORM. The option sets both the
:paramref:`_engine.Connection.execution_options.stream_results` option at
the same time as invoking :meth:`_engine.Result.yield_per`, to provide the
most common streaming result configuration which also mirrors that of the
ORM use case in its usage pattern.

Fixed bug in :class:`_engine.Result` where the usage of a buffered result
strategy would not be used if the dialect in use did not support an
explicit "server side cursor" setting, when using
:paramref:`_engine.Connection.execution_options.stream_results`. This is in
error as DBAPIs such as that of SQLite and Oracle already use a
non-buffered result fetching scheme, which still benefits from usage of
partial result fetching.   The "buffered" strategy is now used in all
cases where :paramref:`_engine.Connection.execution_options.stream_results`
is set.

Added :meth:`.FilterResult.yield_per` so that result implementations
such as :class:`.MappingResult`, :class:`.ScalarResult` and
:class:`.AsyncResult` have access to this method.

Fixes: #8199
Change-Id: I6dde3cbe483a1bf81e945561b60f4b7d1c434750
(cherry picked from commit e5a0cdb2eaa1d7f381e93d0529a7f8e6d5888877)

3 years agomore partition doc adjustments
Mike Bayer [Thu, 30 Jun 2022 19:00:08 +0000 (15:00 -0400)] 
more partition doc adjustments

the partition story is not very good, this is a ton
of different options and they have to all be used
simultaenously for the common case.

Change-Id: I62963b7db1230a2670dda0ce812086f9265a3cb7
(cherry picked from commit aae1696a64509e54efd7d59a137c5ea6743363a7)

3 years agoadd more cross-linking / notes for yield_per, partitions
Mike Bayer [Thu, 30 Jun 2022 17:33:30 +0000 (13:33 -0400)] 
add more cross-linking / notes for yield_per, partitions

Change-Id: I0f8db2532827c76a2751186638d22104230db843
references: #8198
(cherry picked from commit 59bafe0fbefe16269c72ac39e699e4127d49841f)

3 years agoMerge "produce column copies up the whole hierarchy first" into rel_1_4
mike bayer [Wed, 29 Jun 2022 16:52:57 +0000 (16:52 +0000)] 
Merge "produce column copies up the whole hierarchy first" into rel_1_4

3 years agofix documentation typo
Jefferson Oliveira [Wed, 29 Jun 2022 14:53:36 +0000 (11:53 -0300)] 
fix documentation typo

(cherry picked from commit 52317cec36e1807d06a9715e2bcc4067b7eb173f)

3 years agoproduce column copies up the whole hierarchy first
Mike Bayer [Tue, 28 Jun 2022 22:55:19 +0000 (18:55 -0400)] 
produce column copies up the whole hierarchy first

Fixed issue where a hierarchy of classes set up as an abstract or mixin
declarative classes could not declare standalone columns on a superclass
that would then be copied correctly to a :class:`_orm.declared_attr`
callable that wanted to make use of them on a descendant class.

Originally it looked like this would produce an ordering change,
however an adjustment to the flow for produce_column_copies
has avoided that for now.

Fixes: #8190
Change-Id: I4e2ee74edb110793eb42691c3e4a0e0535fba7e9
(cherry picked from commit 9d12d493eb38f958c2d50da28f83ccc6de01f0dc)

3 years ago8152: add documentation for postgresql dialect time and timestamp types
Daniel Hall [Tue, 28 Jun 2022 19:03:34 +0000 (15:03 -0400)] 
8152: add documentation for postgresql dialect time and timestamp types

add documentation for postgresql dialect time and timestamp types

This pull request is:

- [ X] A documentation / typographical error fix
- Good to go, no issue or tests are needed

**Have a nice day!**

Closes: #8185
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8185
Pull-request-sha: 2b76fe080babd72f8e5615b34cb544abbc446a28

Change-Id: Ib71b35d106d0d0686e5551f07b88486b6c59624d
(cherry picked from commit 300ce85463474c0264b37c0f2a8baa5f3cf3d822)

3 years agoblock mariadb 1.1.2
Mike Bayer [Tue, 28 Jun 2022 14:18:58 +0000 (10:18 -0400)] 
block mariadb 1.1.2

regression causing unicode schema queries to fail

Change-Id: Ie66ca038357ec90804a357979d4fd22611c47340
References: https://jira.mariadb.org/browse/CONPY-209
(cherry picked from commit f19e50ab75cfc904acef31434c92542f3ab50d61)

3 years agoVersion 1.4.40 placeholder
Mike Bayer [Fri, 24 Jun 2022 16:20:36 +0000 (12:20 -0400)] 
Version 1.4.40 placeholder

3 years ago- 1.4.39 rel_1_4_39
Mike Bayer [Fri, 24 Jun 2022 16:15:11 +0000 (12:15 -0400)] 
- 1.4.39

3 years agoadd fallback for old mutable format
Mike Bayer [Fri, 24 Jun 2022 14:31:46 +0000 (10:31 -0400)] 
add fallback for old mutable format

Fixed regression caused by :ticket:`8133` where the pickle format for
mutable attributes was changed, without a fallback to recognize the old
format, causing in-place upgrades of SQLAlchemy to no longer be able to
read pickled data from previous versions. A check plus a fallback for the
old format is now in place.

Fixes: #8133
Change-Id: I9029729b4bc56c8b3145797869229eeff48a3b3b
(cherry picked from commit 271c38fd15b94d8acd0e6f054c8001b22535844e)

3 years agoVersion 1.4.39 placeholder
Mike Bayer [Thu, 23 Jun 2022 16:26:49 +0000 (12:26 -0400)] 
Version 1.4.39 placeholder

3 years ago- 1.4.38 rel_1_4_38
Mike Bayer [Thu, 23 Jun 2022 16:22:46 +0000 (12:22 -0400)] 
- 1.4.38

3 years agochangelog fixes
Mike Bayer [Thu, 23 Jun 2022 16:21:51 +0000 (12:21 -0400)] 
changelog fixes

Change-Id: Ibeba5cf159ed2d80bdea22f300c09a8d18c56593

3 years agorefine _include_fn to not include sibling mappers
Mike Bayer [Thu, 23 Jun 2022 15:15:19 +0000 (11:15 -0400)] 
refine _include_fn to not include sibling mappers

Fixed regression caused by :ticket:`8064` where a particular check for
column correspondence was made too liberal, resulting in incorrect
rendering for some ORM subqueries such as those using
:meth:`.PropComparator.has` or :meth:`.PropComparator.any` in conjunction
with joined-inheritance queries that also use legacy aliasing features.

Fixes: #8162
Change-Id: Ib1fff33aa219aadf178348dd571bec1e691e606d
(cherry picked from commit 4553f24980c0a23685afdb9ef6958b79f4b22e70)

3 years agosub-categorize special function forms
Mike Bayer [Wed, 22 Jun 2022 22:50:35 +0000 (18:50 -0400)] 
sub-categorize special function forms

this is the tutorial, which should have some semblence of
not getting too far into the weeds.  however, as we dont
really have other places to explain SQL concepts, and SQL
functions have a lot of them, we dont have another home right
now.  so at least further sub-categorize window functions,
table/column valued functions, and WITHIN GROUP into an
"advanced function techniques" section with a disclaimer that
these are less common use cases.

Change-Id: I4b16bd5673c0bd39a9b880338f6ce3cfbafbe271
(cherry picked from commit c7519e94b5f7bfd9cee908f80c793d628bc37a1c)

3 years agopost-edits for ORM rework
Mike Bayer [Tue, 21 Jun 2022 20:41:06 +0000 (16:41 -0400)] 
post-edits for ORM rework

amends f9f1e8b6c5890eb17b6ba055ff563

Change-Id: I2fd6de56db82aad4d22abf5807e5849e48693124
(cherry picked from commit 8fe6a3fa550f18068e7566e25a9e96f60a186430)

3 years agorework ORM mapping docs
Mike Bayer [Mon, 13 Jun 2022 15:46:28 +0000 (11:46 -0400)] 
rework ORM mapping docs

prepare docs for newly incoming mapper styles, including
new dataclass mapping.   move the existing dataclass/attrs
docs all into their own section and try to improve organization
and wording into the relatively recent "mapping styles"
document.

Change-Id: I0b5e2a5b6a70db65ab19b5bb0a2bb7df20e0b498
(cherry picked from commit 8820e02ca9dd8acb57d757d809fff7dc03c44ee6)

3 years agoMerge "Normalize postgresql docs links to point to current" into rel_1_4
mike bayer [Sat, 18 Jun 2022 19:00:30 +0000 (19:00 +0000)] 
Merge "Normalize postgresql docs links to point to current" into rel_1_4

3 years agoNormalize postgresql docs links to point to current
Federico Caselli [Fri, 17 Jun 2022 19:53:32 +0000 (21:53 +0200)] 
Normalize postgresql docs links to point to current

Change-Id: Ib7d3ea7ff3356ff8a2f935892d904a69dbc25c3e
(cherry picked from commit 3bde1eae31212b5bc2c6652dca52f70fb79d5950)

3 years agoAllow NUMERIC()/DECIMAL() IDENTITY columns
Gord Thompson [Tue, 14 Jun 2022 16:09:04 +0000 (10:09 -0600)] 
Allow NUMERIC()/DECIMAL() IDENTITY columns

Fixed issue where :class:`.Table` objects that made use of IDENTITY columns
with a :class:`.Numeric` datatype would produce errors when attempting to
reconcile the "autoincrement" column, preventing construction of the
:class:`.Column` from using the :paramref:`.Column.autoincrement` parameter
as well as emitting errors when attempting to invoke an :class:`.Insert`
construct.

Fixes: #8111
Change-Id: Iaacc4eebfbafb42fa18f9a1a4f43cb2b6b91d28a
(cherry picked from commit a134956c4e4564844c33302ddf27a70102fe00a8)

3 years agoMerge "pickle mutable parents according to key" into rel_1_4
mike bayer [Wed, 15 Jun 2022 01:46:53 +0000 (01:46 +0000)] 
Merge "pickle mutable parents according to key" into rel_1_4

3 years agopickle mutable parents according to key
Mike Bayer [Tue, 14 Jun 2022 19:41:31 +0000 (15:41 -0400)] 
pickle mutable parents according to key

Fixed bug in :class:`.Mutable` where pickling and unpickling of an ORM
mapped instance would not correctly restore state for mappings that
contained multiple :class:`.Mutable`-enabled attributes.

Fixes: #8133
Change-Id: I508763e0df0d7a624e1169f9a46d7f25404add1e
(cherry picked from commit 69020e416d9836fcc0bc99fcf008563263fb86f3)

3 years agoRemove reflect=True in Base.prepare examples
Gord Thompson [Tue, 14 Jun 2022 13:27:31 +0000 (07:27 -0600)] 
Remove reflect=True in Base.prepare examples

Change-Id: Icdb17fab0f92762a266efbe1a64bec1d5a6dc9ab
(cherry picked from commit be9937d385a74560b65c6ab525f13bc68a5041c1)

3 years agotry fixing the build
Federico Caselli [Mon, 13 Jun 2022 20:15:48 +0000 (22:15 +0200)] 
try fixing the build

Change-Id: Id2e965aa13a6d7134ca1081554cc5b25dbcc9fde
(cherry picked from commit 92bd08c3daff74b94652a5edefd5efa7632ccb22)

# Conflicts:
# test/requirements.py

3 years agoMerge "restore parameter escaping for public methods" into rel_1_4
mike bayer [Thu, 9 Jun 2022 16:04:00 +0000 (16:04 +0000)] 
Merge "restore parameter escaping for public methods" into rel_1_4

3 years agoMerge "handle non-mapped mixins for with_loader_criteria reduce" into rel_1_4
mike bayer [Thu, 9 Jun 2022 16:02:30 +0000 (16:02 +0000)] 
Merge "handle non-mapped mixins for with_loader_criteria reduce" into rel_1_4

3 years agoMerge "dont transfer __weakref__ to regenerated class" into rel_1_4
mike bayer [Thu, 9 Jun 2022 16:01:41 +0000 (16:01 +0000)] 
Merge "dont transfer __weakref__ to regenerated class" into rel_1_4

3 years agoRevert "document thread safety workaround for lambda statements"
Mike Bayer [Thu, 9 Jun 2022 14:57:22 +0000 (10:57 -0400)] 
Revert "document thread safety workaround for lambda statements"

This reverts commit f83d95085332454b700a46ab2540036dfa67363c.

3 years agorestore parameter escaping for public methods
Mike Bayer [Thu, 9 Jun 2022 01:35:02 +0000 (21:35 -0400)] 
restore parameter escaping for public methods

Adjusted the fix made for :ticket:`8056` which adjusted the escaping of
bound parameter names with special characters such that the escaped names
were translated after the SQL compilation step, which broke a published
recipe on the FAQ illustrating how to merge parameter names into the string
output of a compiled SQL string. The change restores the escaped names that
come from ``compiled.params`` and adds a conditional parameter to
:meth:`.SQLCompiler.construct_params` named ``escape_names`` that defaults
to ``True``, restoring the old behavior by default.

Fixes: #8113
Change-Id: I9cbedb1080bc06d51f287fd2cbf26aaab1c74653
(cherry picked from commit 105cd180856309cf5abf24f59b782a1bcd8210d6)

3 years agodont transfer __weakref__ to regenerated class
Mike Bayer [Thu, 9 Jun 2022 13:53:43 +0000 (09:53 -0400)] 
dont transfer __weakref__ to regenerated class

Repaired a deprecation warning class decorator that was preventing key
objects such as :class:`_engine.Connection` from having a proper
``__weakref__`` attribute, causing operations like Python standard library
``inspect.getmembers()`` to fail.

Fixes: #8115
Change-Id: Ifd0bc2325fb9dc9e1431998c308b7fc081968373
(cherry picked from commit cc7cc3c9ec73055703acc78c8d92eb0242e5cd20)

3 years agohandle non-mapped mixins for with_loader_criteria reduce
Mike Bayer [Thu, 9 Jun 2022 12:55:14 +0000 (08:55 -0400)] 
handle non-mapped mixins for with_loader_criteria reduce

special handling is needed for a with_loader_criteria()
against a non-mapped mixin class.  added that to test
coverage

Fixes: #8109
Change-Id: Ia599361c8faab008e92095eb4607d02820f590d5
(cherry picked from commit 6f93f88b5ee683141c81ecd434a4c0818e08dbd9)

3 years agoMerge "fix race conditions in lambda statements" into rel_1_4
mike bayer [Thu, 9 Jun 2022 12:37:27 +0000 (12:37 +0000)] 
Merge "fix race conditions in lambda statements" into rel_1_4

3 years agoMerge "suppport with_loader_criteria pickling w/ fixed callable" into rel_1_4
mike bayer [Thu, 9 Jun 2022 00:54:07 +0000 (00:54 +0000)] 
Merge "suppport with_loader_criteria pickling w/ fixed callable" into rel_1_4

3 years agoadd tests to confirm no issue w/ pg json keys
Mike Bayer [Wed, 8 Jun 2022 23:04:23 +0000 (19:04 -0400)] 
add tests to confirm no issue w/ pg json keys

Change-Id: Ie91e5efb217c309bc40c3933f538bcf29c1fd87b
References: #8112
(cherry picked from commit 409a2173ebe8a9126911051873b3734e6c6be3f4)

3 years agosuppport with_loader_criteria pickling w/ fixed callable
Mike Bayer [Wed, 8 Jun 2022 17:05:20 +0000 (13:05 -0400)] 
suppport with_loader_criteria pickling w/ fixed callable

Fixed issue where a :func:`_orm.with_loader_criteria` option could not be
pickled, as is necessary when it is carried along for propagation to lazy
loaders in conjunction with a caching scheme. Currently, the only form that
is supported as picklable is to pass the "where criteria" as a fixed
module-level callable function that produces a SQL expression. An ad-hoc
"lambda" can't be pickled, and a SQL expression object is usually not fully
picklable directly.

Fixes: #8109
Change-Id: I49fe69088b0c7e58a0f22c67d2ea4e33752a5a73
(cherry picked from commit 293b0e3dd8205185b84cd3baf2f078348437d245)

3 years agofix race conditions in lambda statements
Mike Bayer [Tue, 7 Jun 2022 19:00:20 +0000 (15:00 -0400)] 
fix race conditions in lambda statements

Fixed multiple observed race conditions related to :func:`.lambda_stmt`,
including an initial "dogpile" issue when a new Python code object is
initially analyzed among multiple simultaneous threads which created both a
performance issue as well as some internal corruption of state.
Additionally repaired observed race condition which could occur when
"cloning" an expression construct that is also in the process of being
compiled or otherwise accessed in a different thread due to memoized
attributes altering the ``__dict__`` while iterated, for Python versions
prior to 3.10; in particular the lambda SQL construct is sensitive to this
as it holds onto a single statement object persistently. The iteration has
been refined to use ``dict.copy()`` with or without an additional iteration
instead.

Fixes: #8098
Change-Id: I4e0b627bfa187f1780dc68ec81b94db1c78f846a
(cherry picked from commit 117878f7870377f143917a22160320a891eb0211)

3 years agodocument thread safety workaround for lambda statements
Mike Bayer [Wed, 8 Jun 2022 20:03:26 +0000 (16:03 -0400)] 
document thread safety workaround for lambda statements

Change-Id: Idb7840ff64487ef985087a28bb6e96088e6a392e
References: #8098
(cherry picked from commit bf40bade26e32fc3757bbd756f4c9ebdc5d72090)

3 years agoMerge "graceful degrade for FKs not reflectable" into rel_1_4
mike bayer [Wed, 8 Jun 2022 17:14:33 +0000 (17:14 +0000)] 
Merge "graceful degrade for FKs not reflectable" into rel_1_4

3 years agoadd note re: pickling for loader criteria
Mike Bayer [Wed, 8 Jun 2022 15:56:57 +0000 (11:56 -0400)] 
add note re: pickling for loader criteria

Change-Id: I75992af71ba08799a03995178a6e4612c9a7428a
References: #8108

3 years agograceful degrade for FKs not reflectable
Mike Bayer [Tue, 7 Jun 2022 13:40:26 +0000 (09:40 -0400)] 
graceful degrade for FKs not reflectable

Fixed bugs involving the :paramref:`.Table.include_columns` and the
:paramref:`.Table.resolve_fks` parameters on :class:`.Table`; these
little-used parameters were apparently not working for columns that refer
to foreign key constraints.

In the first case, not-included columns that refer to foreign keys would
still attempt to create a :class:`.ForeignKey` object, producing errors
when attempting to resolve the columns for the foreign key constraint
within reflection; foreign key constraints that refer to skipped columns
are now omitted from the table reflection process in the same way as
occurs for :class:`.Index` and :class:`.UniqueConstraint` objects with the
same conditions. No warning is produced however, as we likely want to
remove the include_columns warnings for all constraints in 2.0.

In the latter case, the production of table aliases or subqueries would
fail on an FK related table not found despite the presence of
``resolve_fks=False``; the logic has been repaired so that if a related
table is not found, the :class:`.ForeignKey` object is still proxied to the
aliased table or subquery (these :class:`.ForeignKey` objects are normally
used in the production of join conditions), but it is sent with a flag that
it's not resolvable. The aliased table / subquery will then work normally,
with the exception that it cannot be used to generate a join condition
automatically, as the foreign key information is missing. This was already
the behavior for such foreign key constraints produced using non-reflection
methods, such as joining :class:`.Table` objects from different
:class:`.MetaData` collections.

Fixes: #8100
Fixes: #8101
Change-Id: Ifa37a91bd1f1785fca85ef163eec031660d9ea4d
(cherry picked from commit 40e3c0da5be7dd526866bfc63590fc5621a9bd6e)

3 years agomigrate labels to new tutorial
Mike Bayer [Sat, 4 Jun 2022 19:53:34 +0000 (15:53 -0400)] 
migrate labels to new tutorial

other org changes and some sections from old tutorial
ported to new tutorial.

Change-Id: Ic0fba60ec82fff481890887beef9ed0fa271875a
(Cherry-picked and independently modified)

3 years agoDocs Update - Add **kwargs to CaseInsensitiveComparator docs (#8063)
Justin Crown [Sat, 4 Jun 2022 20:10:38 +0000 (16:10 -0400)] 
Docs Update - Add **kwargs to CaseInsensitiveComparator docs (#8063)

* Add **kwargs to CaseInsensitiveComparator docs

* add kwargs to other operate examples

Change-Id: I70a1e68bca27c2355ad3b7c5bbc538027f112bd9

* missed one entry

Change-Id: Ieb4a18ab6d96e588e9ec7672cfa65fe2fd8301e5

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
(cherry picked from commit 1508aed47261fe17180aa12fb312aebb0dd3c615)

3 years agoFixed orm not applying fetch
Federico Caselli [Fri, 3 Jun 2022 10:13:10 +0000 (12:13 +0200)] 
Fixed orm not applying fetch

Fixed an issue where :meth:`_sql.GenerativeSelect.fetch` would be
ignored when executing a statement using the ORM.

Fixes: #8091
Change-Id: I6790c7272a71278e90de2529c8bc8ae89e54e288
(cherry picked from commit 526e9bb6ae025d3b8032d6efc1deb1a0f4a3dae3)

3 years agoLink to dialect for Actian Avalanche, Vector, Actian X, and Ingres (#8039)
clach04 [Sat, 4 Jun 2022 10:15:17 +0000 (03:15 -0700)] 
Link to dialect for Actian Avalanche, Vector, Actian X, and Ingres (#8039)

(cherry picked from commit 7f20d506937a92019d2c44fd7804ed0f17d6a482)

3 years agodocs: spelling error (#8088)
Galen Rice [Sat, 4 Jun 2022 10:07:43 +0000 (06:07 -0400)] 
docs: spelling error (#8088)

Leave off the last S for savings!

(cherry picked from commit 424e9e621205c1186e8f9f5009fb35babec31c0e)

3 years agoemphasize expire_on_commit in detached error docs
Mike Bayer [Thu, 2 Jun 2022 18:52:27 +0000 (14:52 -0400)] 
emphasize expire_on_commit in detached error docs

issues like #8082 suggest users are still not
fully aware of the need to set this parameter
when dealing with detached objects.

Change-Id: I6f389fdbe18b9c977bfb8188fc4732dbd56884d9
(cherry picked from commit ad86d32f7fbd1c6deda8ff3bebe0595c0f2986cc)

3 years agopropagate proxy_key from WrapsColumnExpression
Mike Bayer [Wed, 1 Jun 2022 16:11:19 +0000 (12:11 -0400)] 
propagate proxy_key from WrapsColumnExpression

this allows cast() of a label() to propagate the
proxy key outwards in the same way that it apparently
works at the SQL level.

This is stuffing even more rules into naming so basically
seeing how far we can go without other cases starting
to fail.

Fixes: #8084
Change-Id: I20bd97dae798fee6492334c06934e807d0f269ef
(cherry picked from commit 14250f2668151f1c4df86dbf962c771e9788111e)

3 years agoVersion 1.4.38 placeholder
Mike Bayer [Tue, 31 May 2022 21:28:09 +0000 (17:28 -0400)] 
Version 1.4.38 placeholder

3 years ago- 1.4.37 rel_1_4_37
Mike Bayer [Tue, 31 May 2022 21:23:09 +0000 (17:23 -0400)] 
- 1.4.37

3 years agochangelog fixes
Mike Bayer [Tue, 31 May 2022 21:21:39 +0000 (17:21 -0400)] 
changelog fixes

Change-Id: Id3fc3019f8eb799aa5adf6ca28e0aeedc0da31dd
(cherry picked from commit 1e8e4ace63f93327e5c7e000acb6c0efb595eed1)

3 years agoMerge "Handle dead-connection errors for users of python-oracledb" into rel_1_4
mike bayer [Tue, 31 May 2022 20:42:41 +0000 (20:42 +0000)] 
Merge "Handle dead-connection errors for users of python-oracledb" into rel_1_4

3 years agoMerge "raise informative error when selectable can't be extended" into rel_1_4
mike bayer [Tue, 31 May 2022 19:48:15 +0000 (19:48 +0000)] 
Merge "raise informative error when selectable can't be extended" into rel_1_4

3 years agoUpdate declarative_styles.rst: Update code example to attrs TNG usage. (#8072)
Patrick Gerken [Tue, 31 May 2022 19:42:35 +0000 (21:42 +0200)] 
Update declarative_styles.rst: Update code example to attrs TNG usage. (#8072)

* Update declarative_styles.rst

Update docs to new style usage of attrs.
This is the default since December 2021.
While the old style still works, the newer one looks much nicer and is likely to be dominant pretty quickly. Imho.

* Update declarative_styles.rst

* Update declarative_styles.rst

(cherry picked from commit 1e1431fbfb4992f8d85d3fd42ec06975e7f762f0)

3 years agoraise informative error when selectable can't be extended
Mike Bayer [Tue, 31 May 2022 14:48:16 +0000 (10:48 -0400)] 
raise informative error when selectable can't be extended

An informative error is raised for the use case where
:meth:`.Insert.from_select` is being passed a "compound select" object such
as a UNION, yet the INSERT statement needs to append additional columns to
support Python-side or explicit SQL defaults from the table metadata. In
this case a subquery of the compound object should be passed.

Fixes: #8073
Change-Id: Ic4a5dbf84ec49d2451901be05cb9cf6ae93f02b7
(cherry picked from commit 7474df2159f89d684d32aabb15014ef95cea1641)

3 years agoHandle dead-connection errors for users of python-oracledb
Christopher Jones [Tue, 31 May 2022 12:27:18 +0000 (08:27 -0400)] 
Handle dead-connection errors for users of python-oracledb

Added two new error codes for Oracle disconnect handling to support early
testing of the new "python-oracledb" driver released by Oracle.

Fixes: #8066
Closes: #8065
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8065
Pull-request-sha: d630b8457a1d29b7a1354ccc6d5e2956eea865f6

Change-Id: Ib14dbb888597b1087b1bb7c505ccad59df226177
(cherry picked from commit 2bf00472bfafd8fd0cca5b4fe55ff4faf1a1279e)

3 years agorepair incorrect "cursor" var name in connection faq
Josep Pascual Badia [Mon, 30 May 2022 14:41:55 +0000 (10:41 -0400)] 
repair incorrect "cursor" var name in connection faq

Closes: #8075
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8075
Pull-request-sha: 34e5eaf3870f89c9c38ffe81121fa1b42e363752

Change-Id: Iab8cdc9f8da68ac955eea75efeba263d0a9dcb7b
(cherry picked from commit d97de97eff21af3bdacffc2b625feb7e0bd6c18c)

3 years agoMerge "remove "deannotate" from column_property expression" into rel_1_4
mike bayer [Sun, 29 May 2022 21:37:05 +0000 (21:37 +0000)] 
Merge "remove "deannotate" from column_property expression" into rel_1_4

3 years agoMerge "move bindparam quote application from compiler to default" into rel_1_4
mike bayer [Sun, 29 May 2022 21:35:00 +0000 (21:35 +0000)] 
Merge "move bindparam quote application from compiler to default" into rel_1_4

3 years agoremove "deannotate" from column_property expression
Mike Bayer [Fri, 27 May 2022 20:07:01 +0000 (16:07 -0400)] 
remove "deannotate" from column_property expression

Fixed issue where using a :func:`_orm.column_property` construct containing
a subquery against an already-mapped column attribute would not correctly
apply ORM-compilation behaviors to the subquery, including that the "IN"
expression added for a single-table inherits expression would fail to be
included.

This fix involves a few tweaks in the ORM adaptation logic,
including a missing "parententity" adaptation on the mapper
side.  The specific mechanics here have a lot of moving parts
so we will continue to add tests to assert these cases.  In
particular a more complete test for issue #2316 is added
that was relying upon the deannotate happening here.

Fixes: #8064
Change-Id: Ia85dd12dcf6e7c002b30de4a27d7aa66cb3cd20e
(cherry picked from commit 8c5cc8ae255a7580e2ff339659cf66cd2c6e02c1)

3 years agomove bindparam quote application from compiler to default
Mike Bayer [Sun, 29 May 2022 16:07:46 +0000 (12:07 -0400)] 
move bindparam quote application from compiler to default

in 296c84313ab29bf9599634f3 for #5653 we generalized Oracle's
parameter escaping feature into the compiler, so that it could also
work for PostgreSQL.  The compiler used quoted names within parameter
dictionaries, which then led to the complexity that all functions
which interpreted keys from the compiled_params dict had to
also quote the param names to use the dictionary.  This
extra complexity was not added to the ORM peristence.py however,
which led to the versioning id feature being broken as well as
other areas where persistence.py relies on naming schemes present
in context.compiled_params.  It also was not added to the
"processors" lookup which led to #8053, that added this escaping
to that part of the compiler.

To both solve the whole problem as well as simplify the compiler
quite a bit, move the actual application of the escaped names
to be as late as possible, when default.py builds the final list
of parameters.  This is more similar to how it worked previously
where OracleExecutionContext would be late-applying these
escaped names.   This re-establishes context.compiled_params as
deterministically named regardless of dialect in use and moves
out the complexity of the quoted param names to be only at the
cursor.execute stage.

Fixed bug, likely a regression from 1.3, where usage of column names that
require bound parameter escaping, more concretely when using Oracle with
column names that require quoting such as those that start with an
underscore, or in less common cases with some PostgreSQL drivers when using
column names that contain percent signs, would cause the ORM versioning
feature to not work correctly if the versioning column itself had such a
name, as the ORM assumes certain bound parameter naming conventions that
were being interfered with via the quotes. This issue is related to
:ticket:`8053` and essentially revises the approach towards fixing this,
revising the original issue :ticket:`5653` that created the initial
implementation for generalized bound-parameter name quoting.

Fixes: #8056
Change-Id: I57b064e8f0d070e328b65789c30076f6a0ca0fef
(cherry picked from commit a48b597d0cafa1dd7fc46be99eb808fd4cb0a347)