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

3 years agomssql login failure if password starts with "{"
Gord Thompson [Sun, 29 May 2022 13:07:45 +0000 (07:07 -0600)] 
mssql login failure if password starts with "{"

Fix issue where a password with a leading "{" would
result in login failure.

Fixes: #8062
Change-Id: If91c2c211937b5eac89b8d525c22a19b0a94c5c4
(cherry picked from commit 8ac7cb92b4972a08b8008b80b34989694510139f)

3 years agoMerge "apply bindparam escape name to processors dictionary" into rel_1_4
mike bayer [Wed, 25 May 2022 16:45:49 +0000 (16:45 +0000)] 
Merge "apply bindparam escape name to processors dictionary" into rel_1_4

3 years agoMerge "enable pg8000 for 1.29.1 and above" into rel_1_4
mike bayer [Wed, 25 May 2022 14:13:18 +0000 (14:13 +0000)] 
Merge "enable pg8000 for 1.29.1 and above" into rel_1_4

3 years agoapply bindparam escape name to processors dictionary
Mike Bayer [Wed, 25 May 2022 12:47:29 +0000 (08:47 -0400)] 
apply bindparam escape name to processors dictionary

Fixed SQL compiler issue where the "bind processing" function for a bound
parameter would not be correctly applied to a bound value if the bound
parameter's name were "escaped". Concretely, this applies, among other
cases, to Oracle when a :class:`.Column` has a name that itself requires
quoting, such that the quoting-required name is then used for the bound
parameters generated within DML statements, and the datatype in use
requires bind processing, such as the :class:`.Enum` datatype.

Fixes: #8053
Change-Id: I39d060a87e240b4ebcfccaa9c535e971b7255d99
(cherry picked from commit 4d58ca05e83048e999059a8c2c2e67cb77abf976)

3 years agoenable pg8000 for 1.29.1 and above
Mike Bayer [Mon, 23 May 2022 14:34:32 +0000 (10:34 -0400)] 
enable pg8000 for 1.29.1 and above

ROLLBACK TO SAVEPOINT is re-enabled
in https://github.com/tlocke/pg8000/issues/111.

we still have to add savepoint support to our fixture that
deletes from tables without checking for them.
this is inconvenient but not incorrect.

Change-Id: I2f4a0a3e18db93c3e6794ade9b0fee33d2e4b7dc
(cherry picked from commit c0612f8166b7cd07895e7302bb59192abbb68c43)

3 years agouse random table name
Mike Bayer [Tue, 24 May 2022 16:27:59 +0000 (12:27 -0400)] 
use random table name

this test is failing on CI with "##foo does not exist",
so hypothesize there's some kind of race condition with
global temp table names.

Change-Id: I8c6c26a7fda70f67735ce20af67373c311e48731
(cherry picked from commit d7b131d2dfc4c519b23d9ed29364036ef88b1863)

3 years agoMerge "Add a note on using server_onupdate=FetchedValue()" into rel_1_4
mike bayer [Mon, 23 May 2022 13:50:37 +0000 (13:50 +0000)] 
Merge "Add a note on using server_onupdate=FetchedValue()" into rel_1_4

3 years agoremove insanely old note from 12 years ago
Mike Bayer [Mon, 23 May 2022 13:48:05 +0000 (09:48 -0400)] 
remove insanely old note from 12 years ago

Change-Id: Id0929b6bc062fc4766c9c69427524e3cd2da1030
(cherry picked from commit 853f726454cff2f34c010cbafacfec85f51f8eeb)

3 years agoFormat code in documentation
Doctor [Sun, 22 May 2022 20:05:25 +0000 (16:05 -0400)] 
Format code in documentation

Closes: #7959
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7959
Pull-request-sha: fd8f60fcfe9cda0c2ba6dc9ddd171bf85a180295

Change-Id: I9a96c6e3e56cfd550672db4c1da4d68a961f970a
(cherry picked from commit eea04615536215a4651ed0c9877cf40d7bc7c12e)

3 years agoAdd a note on using server_onupdate=FetchedValue()
Andrew Brookins [Sun, 22 May 2022 20:24:15 +0000 (16:24 -0400)] 
Add a note on using server_onupdate=FetchedValue()

Add a note on using `server_onupdate=FetchedValue()` when using SQL expressions with `onupdate`.

My team encountered an issue with using a SQL expression with `onupdate`.
Despite the dialect (PG) supporting `RETURNING`, we needed to mark the column with
`server_onupdate=FetchedValue()` in order to get the column used with `onupdate`
to appear in the `RETURNING` clause of `UPDATE` statements.

This was not clear from the documentation, so I want to make it crystal clear for other
folks defining similar columns.

Closes: #7437
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7437
Pull-request-sha: 4845fb09a90ab58f0ae882e0d335ddba09b32ca0

Change-Id: I272278830c8f3f42d057ff77c3209e87df7adf02
(cherry picked from commit 0487cd1678458b786d4beca5ae3a9c8e343c3763)

3 years agoblock pg8000 >=1.29
Mike Bayer [Sun, 22 May 2022 14:19:18 +0000 (10:19 -0400)] 
block pg8000 >=1.29

Issue at https://github.com/tlocke/pg8000/issues/111
prevents savepoints from being usable.

Change-Id: Ic689cf065c47aea5a146d30c47eb9bbfe8375692
(cherry picked from commit 8ec93170d1434ca7e2a1506a3c962d40b8658183)

3 years agoUse collation in reflection in MSSQL
Federico Caselli [Wed, 18 May 2022 20:20:01 +0000 (22:20 +0200)] 
Use collation in reflection in MSSQL

Explicitly specify the collation when reflecting table columns using
MSSQL to prevent "collation conflict" errors.

Fixes: #8035
Change-Id: I4239a5ca8b041f56d7b3bba67b3357c176db31ee
(cherry picked from commit 5e54d5f1ad022781f5d8c6c7da4802613050dde5)

3 years agoMerge "Include new MySQL error code 4031 for MySQL disconnect check" into rel_1_4
mike bayer [Thu, 19 May 2022 14:56:00 +0000 (14:56 +0000)] 
Merge "Include new MySQL error code 4031 for MySQL disconnect check" into rel_1_4

3 years agoMerge "favor bool_op over op in comparison" into rel_1_4
mike bayer [Thu, 19 May 2022 14:05:11 +0000 (14:05 +0000)] 
Merge "favor bool_op over op in comparison" into rel_1_4

3 years agoInclude new MySQL error code 4031 for MySQL disconnect check
valievkarim [Wed, 18 May 2022 20:24:41 +0000 (16:24 -0400)] 
Include new MySQL error code 4031 for MySQL disconnect check

Added disconnect code for MySQL error 4031, introduced in MySQL >= 8.0.24,
indicating connection idle timeout exceeded. In particular this repairs an
issue where pre-ping could not reconnect on a timed-out connection. Pull
request courtesy valievkarim.

Fixes: #8036
Closes: #8037
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8037
Pull-request-sha: 7ab605c2d25c3cd83af41e3250c97c623220cc7a

Change-Id: I21249c9d8acb305ac43ce61b90b41daf7fabdfe8
(cherry picked from commit de399c914b923ec3c81d3a51e16c7b720d34e058)

3 years agofavor bool_op over op in comparison
Mike Bayer [Wed, 18 May 2022 20:21:49 +0000 (16:21 -0400)] 
favor bool_op over op in comparison

there's no need to use the is_comparison parameter
anymore as bool_op() works better and in 2.0 also does
typing correctly.

Change-Id: I9e92b665b112d40d90e539003b0efe00ed7b075f
(cherry picked from commit deb9bcc0d97dd8b38dfccb340a5fc1f880202ff6)

3 years agoUpdate dbapi_transactions.rst (#8032)
Robert Kulagowski [Wed, 18 May 2022 20:25:18 +0000 (15:25 -0500)] 
Update dbapi_transactions.rst (#8032)

If you're defining 'y=row.y' then you might as well use 'y' in the print statement.

(cherry picked from commit b66d57451ad28572c000490c10e451cbf600a9d1)

3 years agofix most sphinx warnings
Mike Bayer [Mon, 16 May 2022 14:57:51 +0000 (10:57 -0400)] 
fix most sphinx warnings

still can't figure out the warnings with some of the older
changelog files.

Fixes: #7946
Change-Id: Id657ab23008eed0b133fed65b2f9ea75a626215c

3 years agoMerge "render col name in on conflict set clause, not given key" into rel_1_4
mike bayer [Sun, 15 May 2022 23:27:59 +0000 (23:27 +0000)] 
Merge "render col name in on conflict set clause, not given key" into rel_1_4

3 years agorender col name in on conflict set clause, not given key
Mike Bayer [Fri, 13 May 2022 20:08:34 +0000 (16:08 -0400)] 
render col name in on conflict set clause, not given key

Fixed bug where the PostgreSQL :meth:`_postgresql.Insert.on_conflict`
method and the SQLite :meth:`_sqlite.Insert.on_conflict` method would both
fail to correctly accommodate a column with a separate ".key" when
specifying the column using its key name in the dictionary passed to
``set_``, as well as if the :attr:`_sqlite.Insert.excluded` or
:attr:`_postgresql.Insert.excluded` collection were used as the dictionary
directly.

Fixes: #8014
Change-Id: I67226aeedcb2c683e22405af64720cc1f990f274
(cherry picked from commit 927abc3b33f10464ed04db3d7a454faeb6e729f2)

3 years agoraise for same param name in expanding + non expanding
Mike Bayer [Fri, 13 May 2022 19:43:53 +0000 (15:43 -0400)] 
raise for same param name in expanding + non expanding

An informative error is raised if two individual :class:`.BindParameter`
objects share the same name, yet one is used within an "expanding" context
(typically an IN expression) and the other is not; mixing the same name in
these two different styles of usage is not supported and typically the
``expanding=True`` parameter should be set on the parameters that are to
receive list values outside of IN expressions (where ``expanding`` is set
by default).

Fixes: #8018
Change-Id: Ie707f29680eea16b9e421af93560ac1958e11a54
(cherry picked from commit f9fccdeeb6749d10aeec458f1a549906d58ddad8)

3 years agoadjust log stacklevel for py3.11.0b1; enable greenlet
Mike Bayer [Sat, 14 May 2022 14:25:53 +0000 (10:25 -0400)] 
adjust log stacklevel for py3.11.0b1; enable greenlet

Fixed issue where support for logging "stacklevel" implemented in
:ticket:`7612` required adjustment to work with recently released Python
3.11.0b1, also repairs the unit tests which tested this feature.

Install greenlet from a py311 compat patch.

re: the stacklevel thing, this is going to be very inconvenient
if we have to keep hardcoding numbers everywhere for every
new python version

Change-Id: I0c8f7293e98c0ca5cc544538284bfd1d3020cb1f
References: https://github.com/python-greenlet/greenlet/issues/288
Fixes: #8019
(cherry picked from commit 43ff5b82dc0d91cacd625ac8943622ab340958c5)

3 years agoRevert "search for pickle failures"
Mike Bayer [Fri, 13 May 2022 14:53:07 +0000 (10:53 -0400)] 
Revert "search for pickle failures"

This reverts commit 48ccecbe69795753baac1ca6d351c1af5ebcdd7b.

not being careful w/ the commandline as I eat breakfast today

3 years agomore expire_on_commit reminders
Mike Bayer [Fri, 13 May 2022 14:25:37 +0000 (10:25 -0400)] 
more expire_on_commit reminders

the session commit/close docs still feel awkward in how
one learns about this operation.   hopefully another pass
over 2.0 can make things more linear.

removed a 1.4 note about autobegin that was completely inaccurate;
commit() does autobegin so it has an effect, just not usually
on the database.

Change-Id: Iaa4b96bd3df6cf82e851b2943322ddad7abbbac0
(cherry picked from commit cd628fad7c92f5f54bf1bf6985fd983269b0ec19)

3 years agosearch for pickle failures
Mike Bayer [Fri, 13 May 2022 13:24:09 +0000 (09:24 -0400)] 
search for pickle failures

this is not for merge, trying to locate what might be
the problem at #8000

Change-Id: I3ee7bf85f42eca861d32fc402b69796d518934d1

3 years agobump zimports to 0.6.0
Mike Bayer [Tue, 10 May 2022 14:32:18 +0000 (10:32 -0400)] 
bump zimports to 0.6.0

new multiprocessing support

Change-Id: I165a419a67c4e4a5e49d15cf2ac5c8aa46d16cbc
(cherry picked from commit 9294ac7fe02eb2f8aad78122eae199192f12ef52)

3 years agodont use the label convention for memoized entities
Mike Bayer [Mon, 9 May 2022 14:27:51 +0000 (10:27 -0400)] 
dont use the label convention for memoized entities

Fixed issue where ORM results would apply incorrect key names to the
returned :class:`.Row` objects in the case where the set of columns to be
selected were changed, such as when using
:meth:`.Select.with_only_columns`.

Fixes: #8001
Change-Id: If3a2a5d00d15ebc2e9d41494845cfb3b06f80dcc
(cherry picked from commit 319f09ffced3f655e7d500b3a9965e19468fd9d9)

3 years agoUse tuple instead of raw url in string formatting (#7987)
dzcode [Tue, 3 May 2022 20:18:43 +0000 (14:18 -0600)] 
Use tuple instead of raw url in string formatting (#7987)

* Fixes: #7902 - Use tuple instead of raw url in string formatting

* Fix lint error

(cherry picked from commit 675c3e17f7fcccb7534c46adb56529fc3ddd8dbf)

3 years agodocs(types) Fix missing import from sqlalchemy (#7978)
khashashin [Tue, 3 May 2022 20:00:59 +0000 (22:00 +0200)] 
docs(types) Fix missing import from sqlalchemy (#7978)

* docs(types) Fix missing import from sqlalchemy

The sample code is missing the import of Enum from sqlalchemy, which might confuse the reader, since we are using another enum type from Python itself here. So it makes sense to clarify that here.

* fix whitespaces

Change-Id: I019bbed8a7278f60e7239160ea4c99ecd2519d3b

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

3 years agobypass pyodbc default server version / set charset
Mike Bayer [Tue, 3 May 2022 12:58:27 +0000 (08:58 -0400)] 
bypass pyodbc default server version / set charset

Further adjustments to the MySQL PyODBC dialect to allow for complete
connectivity, which was previously still not working despite fixes in
:ticket:`7871`.

Fixes: #7966
Change-Id: I549ea9e7b6e722e22d3e25bdb2fe0934603e2454
(cherry picked from commit 4abca61b4903e42f9568cc06f3c18ac27a139cf7)

3 years agouse bindparam_type in BinaryElementImpl._post_coercion if available
Mike Bayer [Sun, 1 May 2022 16:28:36 +0000 (12:28 -0400)] 
use bindparam_type in BinaryElementImpl._post_coercion if available

Fixed an issue where using :func:`.bindparam` with no explicit data or type
given could be coerced into the incorrect type when used in expressions
such as when using :meth:`.ARRAY.comparator.any` and
:meth:`.ARRAY.comparator.all`.

Fixes: #7979
Change-Id: If7779e713c9a3a5fee496b66e417cfd3fca5b1f9
(cherry picked from commit 889cbe53121c8fd50c845357dd52b24594346b68)

3 years agoVersion 1.4.37 placeholder
Mike Bayer [Tue, 26 Apr 2022 21:12:08 +0000 (17:12 -0400)] 
Version 1.4.37 placeholder

3 years ago- 1.4.36 rel_1_4_36
Mike Bayer [Tue, 26 Apr 2022 20:56:04 +0000 (16:56 -0400)] 
- 1.4.36

3 years agoMerge "repair fetch_setting call in mysql pyodbc dialect" into rel_1_4
mike bayer [Tue, 26 Apr 2022 20:52:17 +0000 (20:52 +0000)] 
Merge "repair fetch_setting call in mysql pyodbc dialect" into rel_1_4

3 years agochangelog edits for 1.4.36
Mike Bayer [Tue, 26 Apr 2022 19:32:30 +0000 (15:32 -0400)] 
changelog edits for 1.4.36

Change-Id: I0dd6b8ace355e4884b918484ae7b2c7a8319ff7e

3 years agorepair fetch_setting call in mysql pyodbc dialect
Mike Bayer [Tue, 26 Apr 2022 19:02:37 +0000 (15:02 -0400)] 
repair fetch_setting call in mysql pyodbc dialect

Fixed a regression in the untested MySQL PyODBC dialect caused by the fix
for :ticket:`7518` in version 1.4.32 where an argument was being propagated
incorrectly upon first connect, leading to a ``TypeError``.

Fixes: #7871
Change-Id: I37f8ca8e83cb352ee2a2336b52863858259b1d77
(cherry picked from commit 3deff88fe12adc470792f71da7b9c54a5438638f)

3 years agobackport 6f02d5edd88fe247 to 1.4
Mike Bayer [Sun, 24 Apr 2022 20:19:16 +0000 (16:19 -0400)] 
backport 6f02d5edd88fe247 to 1.4

in 6f02d5edd88fe2475629438b0730181a2b00c5fe some cleanup
to ForeignKey repaired the use case of ForeignKey objects
referring to table name alone, by adding more robust
column resolution logic.  This change also fixes an issue
where the "referred column" naming convention key uses the
resolved referred column earlier than usual when a
ForeignKey is setting up its constraint.

Fixed bug where :class:`.ForeignKeyConstraint` naming conventions using the
``referred_column_0`` naming convention key would not work if the foreign
key constraint were set up as a :class:`.ForeignKey` object rather than an
explicit :class:`.ForeignKeyConstraint` object. As this change makes use of
a backport of some fixes from version 2.0, an additional little-known
feature that has likely been broken for many years is also fixed which is
that a :class:`.ForeignKey` object may refer to a referred table by name of
the table alone without using a column name, if the name of the referent
column is the same as that of the referred column.

The ``referred_column_0`` naming convention key was not previously not
tested with the :class:`.ForeignKey` object, only
:class:`.ForeignKeyConstraint`, and this bug reveals that the feature has
never worked correctly unless :class:`.ForeignKeyConstraint` is used for
all FK constraints. This bug traces back to the original introduction of
the feature introduced for :ticket:`3989`.

Fixes: #7958
Change-Id: I230d43e9deba5dff889b9e7fee6cd4d3aa2496d3