]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
3 years agoMerge "First round of removal of python 2" into main
mike bayer [Tue, 2 Nov 2021 20:51:28 +0000 (20:51 +0000)] 
Merge "First round of removal of python 2" into main

3 years agoFixes: #7278
jonathan vanasco [Tue, 2 Nov 2021 17:35:44 +0000 (13:35 -0400)] 
Fixes: #7278
Correct a typo in the 1.4 changelog

Change-Id: Ib7d1fc75957ad2efb348fee9d862d75b06dbafef

3 years agouse full context manager flow for future.Engine.begin()
Mike Bayer [Mon, 1 Nov 2021 20:36:51 +0000 (16:36 -0400)] 
use full context manager flow for future.Engine.begin()

Fixed issue in future :class:`_future.Engine` where calling upon
:meth:`_future.Engine.begin` and entering the context manager would not
close the connection if the actual BEGIN operation failed for some reason,
such as an event handler raising an exception; this use case failed to be
tested for the future version of the engine. Note that the "future" context
managers which handle ``begin()`` blocks in Core and ORM don't actually run
the "BEGIN" operation until the context managers are actually entered. This
is different from the legacy version which runs the "BEGIN" operation up
front.

Fixes: #7272
Change-Id: I9667ac0861a9e007c4b3dfcf0fcf0829038a8711

3 years agoFirst round of removal of python 2
Federico Caselli [Sat, 30 Oct 2021 20:00:25 +0000 (22:00 +0200)] 
First round of removal of python 2

References: #4600
Change-Id: I61e35bc93fe95610ae75b31c18a3282558cd4ffe

3 years agoMerge "remove case_sensitive create_engine parameter" into main
mike bayer [Mon, 1 Nov 2021 19:07:43 +0000 (19:07 +0000)] 
Merge "remove case_sensitive create_engine parameter" into main

3 years agoremove case_sensitive create_engine parameter
Mike Bayer [Sun, 31 Oct 2021 16:54:23 +0000 (12:54 -0400)] 
remove case_sensitive create_engine parameter

Removed the previously deprecated ``case_sensitive`` parameter from
:func:`_sa.create_engine`, which would impact only the lookup of string
column names in Core-only result set rows; it had no effect on the behavior
of the ORM. The effective behavior of what ``case_sensitive`` refers
towards remains at its default value of ``True``, meaning that string names
looked up in ``row._mapping`` will match case-sensitively, just like any
other Python mapping.

Change-Id: I0dc4be3fac37d30202b1603db26fa10a110b618d

3 years agode-link LegacyRow, LegacyCursorResult
Mike Bayer [Mon, 1 Nov 2021 16:45:23 +0000 (12:45 -0400)] 
de-link LegacyRow, LegacyCursorResult

Change-Id: I4a9d210c3cb07fc1d59643463acef95f9cc9b12e

3 years agoMerge "Update psycopg2 dialect to use the DBAPI interface to execute two phase transa...
mike bayer [Mon, 1 Nov 2021 16:40:33 +0000 (16:40 +0000)] 
Merge "Update psycopg2 dialect to use the DBAPI interface to execute two phase transactions" into main

3 years agoRevise "literal parameters" FAQ section
Mike Bayer [Mon, 1 Nov 2021 16:06:32 +0000 (12:06 -0400)] 
Revise "literal parameters" FAQ section

based on feedback in #7271, the emphasis on TypeDecorator
as a solution to this problem is not very practical.  illustrate
a series of quick recipes that are useful for debugging purposes
to print out a repr() or simple stringify of a parameter
without the need to construct custom dialects or types.

Change-Id: I788ce1b5ea01d88dd0a22d03d06f35aabff5e5c8

3 years agoMerge "2.0 removals: LegacyRow, connectionless execution, close_with_result" into...
mike bayer [Sun, 31 Oct 2021 20:48:33 +0000 (20:48 +0000)] 
Merge "2.0 removals: LegacyRow, connectionless execution, close_with_result" into main

3 years ago2.0 removals: LegacyRow, connectionless execution, close_with_result
Mike Bayer [Sat, 30 Oct 2021 18:44:55 +0000 (14:44 -0400)] 
2.0 removals: LegacyRow, connectionless execution, close_with_result

in order to remove LegacyRow / LegacyResult, we have
to also lose close_with_result, which connectionless
execution relies upon.

also includes a new profiles.txt file that's all against
py310, as that's what CI is on now.  some result counts
changed by one function call which was enough to fail the
low-count result tests.

Replaces Connectable as the common interface between
Connection and Engine with EngineEventsTarget.  Engine
is no longer Connectable.  Connection and MockConnection
still are.

References: #7257
Change-Id: Iad5eba0313836d347e65490349a22b061356896a

3 years agoUpdate psycopg2 dialect to use the DBAPI interface to execute
Federico Caselli [Wed, 27 Oct 2021 20:52:39 +0000 (22:52 +0200)] 
Update psycopg2 dialect to use the DBAPI interface to execute
two phase transactions

Fixes: #7238
Change-Id: Ie4f5cf59d29b5bfc142ec2dfdecffb896ee7d708

3 years agoMerge "Remove deprecated dialects and drivers" into main
mike bayer [Sun, 31 Oct 2021 17:09:56 +0000 (17:09 +0000)] 
Merge "Remove deprecated dialects and drivers" into main

3 years agoRemove deprecated dialects and drivers
Federico Caselli [Sat, 30 Oct 2021 20:24:51 +0000 (22:24 +0200)] 
Remove deprecated dialects and drivers

Fixes: #7258
Change-Id: I3577f665eca04f2632b69bcb090f0a4ec9271db9

3 years agoThe ``has_table`` method now also checks views
Federico Caselli [Sun, 10 Oct 2021 08:41:13 +0000 (10:41 +0200)] 
The ``has_table`` method now also checks views

The :meth:`_engine.Inspector.has_table` method will now consistently check
for views of the given name as well as tables. Previously this behavior was
dialect dependent, with PostgreSQL, MySQL/MariaDB and SQLite supporting it,
and Oracle and SQL Server not supporting it. Third party dialects should
also seek to ensure their :meth:`_engine.Inspector.has_table` method
searches for views as well as tables for the given name.

Fixes: #7161
Change-Id: I9e523c76741b19596c81ef577dc6f0823e44183b

3 years agoremove ORM autocommit and public-facing subtransactions concept
Mike Bayer [Sun, 31 Oct 2021 00:45:26 +0000 (20:45 -0400)] 
remove ORM autocommit and public-facing subtransactions concept

In order to do LegacyRow we have to do Connection, which means
we lose close_with_result (hooray) which then means we
have to get rid of ORM session autocommit which relies on it, so
let's do that first.

Change-Id: I115f614733b1d0ba19f320ffa9a49f0d762db094

3 years agoMerge "initial 2.0 setup" into main
mike bayer [Sat, 30 Oct 2021 23:20:17 +0000 (23:20 +0000)] 
Merge "initial 2.0 setup" into main

3 years agoremove python2 from workflows
Federico Caselli [Sat, 30 Oct 2021 19:19:52 +0000 (21:19 +0200)] 
remove python2 from workflows

Change-Id: Ib2da811acbad291dc9bbe798c84f2309f5d0f21e

3 years agoinitial 2.0 setup
Mike Bayer [Thu, 11 Apr 2019 16:43:47 +0000 (12:43 -0400)] 
initial 2.0 setup

Adapted from 55e64f857daeb6057b85ff67297a774b when we
previously started a 2.0 branch.

Change-Id: Ib5af75df94b23104eebe0e918adcf979d798ea3b

3 years agowarnings removal, merge_result
Mike Bayer [Fri, 29 Oct 2021 21:36:26 +0000 (17:36 -0400)] 
warnings removal, merge_result

this is the last warning to remove.

Also fixes some mistakes I made with the new
Base20DeprecationWarning and LegacyAPIWarning classes created,
where functions in deprecations.py were still hardcoded to
RemovedIn20Warning.

Change-Id: I9a6045ac9b813fd2f9668c4bc518c46a7774c6ef

3 years agoMerge "warnings: session.autocommit, subtransactions" into main
mike bayer [Fri, 29 Oct 2021 21:56:38 +0000 (21:56 +0000)] 
Merge "warnings: session.autocommit, subtransactions" into main

3 years agoclarify order_by(None) for Core; improve wording
Mike Bayer [Fri, 29 Oct 2021 21:53:12 +0000 (17:53 -0400)] 
clarify order_by(None) for Core; improve wording

the order_by(None) convention was documented for orm.Query
but not Core select.

Change-Id: I0c1ad76c3eefba1cb54b1649cfd09169c17e2bba

3 years agowarnings: session.autocommit, subtransactions
Mike Bayer [Fri, 29 Oct 2021 15:12:13 +0000 (11:12 -0400)] 
warnings: session.autocommit, subtransactions

Change-Id: I7eb7c87c9656f8043ea90d53897958afad2b8fe9

3 years agowarnings: with_polymorphic()
Mike Bayer [Fri, 29 Oct 2021 16:10:37 +0000 (12:10 -0400)] 
warnings: with_polymorphic()

Also clarifies a behavior of None/False for the selectable
parameter to with_polymorphic()

Fixes: #7262
Change-Id: I58c4004e0af227d3995e9ae2461470440f97f252

3 years agoMerge "Modernize tests - session_query_get" into main
mike bayer [Fri, 29 Oct 2021 14:22:41 +0000 (14:22 +0000)] 
Merge "Modernize tests - session_query_get" into main

3 years agoModernize tests - session_query_get
Gord Thompson [Thu, 30 Sep 2021 23:39:05 +0000 (17:39 -0600)] 
Modernize tests - session_query_get

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I92013aad471baf32df1b51b756e86d95449b5cfd

3 years agowarnings: cascade_backrefs
Mike Bayer [Thu, 28 Oct 2021 21:10:15 +0000 (17:10 -0400)] 
warnings: cascade_backrefs

this one is a little different in that the thing changing
is the detection of a behavior, not an explicit API.

Change-Id: Id142943a2b901b39fe9053d0120c1e820dc1a6d0

3 years agoMerge "Improve array support on pg8000" into main
mike bayer [Thu, 28 Oct 2021 15:43:15 +0000 (15:43 +0000)] 
Merge "Improve array support on pg8000" into main

3 years agoImprove array support on pg8000
Federico Caselli [Tue, 16 Mar 2021 23:27:18 +0000 (00:27 +0100)] 
Improve array support on pg8000

References: #6023

Change-Id: I0f6cbc34b3c0bfc0b8c86b3ebe4531e23039b6c0

3 years agoMerge "deprecation warnings: with_parent, aliased, from_joinpoint" into main
mike bayer [Wed, 27 Oct 2021 17:11:18 +0000 (17:11 +0000)] 
Merge "deprecation warnings: with_parent, aliased, from_joinpoint" into main

3 years agoMerge "consider "inspect(_of_type)" to be the entity of a comparator" into main
mike bayer [Wed, 27 Oct 2021 15:56:16 +0000 (15:56 +0000)] 
Merge "consider "inspect(_of_type)" to be the entity of a comparator" into main

3 years agodeprecation warnings: with_parent, aliased, from_joinpoint
Mike Bayer [Tue, 26 Oct 2021 19:37:16 +0000 (15:37 -0400)] 
deprecation warnings: with_parent, aliased, from_joinpoint

most of the work for aliased / from_joinpoint has been done
already as I added all new tests for these and moved
most aliased/from_joinpoint to test/orm/test_deprecations.py
already

Change-Id: Ia23e332dec183de17b2fb9d89d946af8d5e89ae7

3 years agoMerge "Fixes: #5020" into main
mike bayer [Wed, 27 Oct 2021 15:23:35 +0000 (15:23 +0000)] 
Merge "Fixes: #5020" into main

3 years agoconsider "inspect(_of_type)" to be the entity of a comparator
Mike Bayer [Wed, 27 Oct 2021 15:14:50 +0000 (11:14 -0400)] 
consider "inspect(_of_type)" to be the entity of a comparator

Fixed 1.4 regression where :meth:`_orm.Query.filter_by` would not function
correctly when :meth:`_orm.Query.join` were joined to an entity which made
use of :meth:`_orm.PropComparator.of_type` to specify an aliased version of
the target entity. The issue also applies to future style ORM queries
constructed with :func:`_sql.select`.

Fixes: #7244
Change-Id: Ied28a03ce93201f932c7172d283cd4297be4d592

3 years agoMerge "Fixes: #4100" into main
mike bayer [Wed, 27 Oct 2021 14:22:14 +0000 (14:22 +0000)] 
Merge "Fixes: #4100" into main

3 years agoFixes: #5020
jonathan vanasco [Tue, 28 Sep 2021 13:15:37 +0000 (09:15 -0400)] 
Fixes: #5020
Add mike's example to docs

Change-Id: I96a79084cccca5c792bee697338422f3de0884fb

3 years agoMerge "add additional "oracle mode" reserved words" into main
mike bayer [Tue, 26 Oct 2021 21:20:45 +0000 (21:20 +0000)] 
Merge "add additional "oracle mode" reserved words" into main

3 years agoadd additional "oracle mode" reserved words
Mike Bayer [Tue, 26 Oct 2021 19:52:25 +0000 (15:52 -0400)] 
add additional "oracle mode" reserved words

despite mariadb's docs, the word "system" must be
quoted in plain mariadb 10.5, not sure if that's
"oracle mode" but it is > 10.3.   observed keystone
tests failing on a column of this name.

Fixes: #7167
Change-Id: I153b79809e7da007bcceecec96c1340d1641f0de

3 years agoMerge "Remove depractions:" into main
mike bayer [Tue, 26 Oct 2021 19:41:53 +0000 (19:41 +0000)] 
Merge "Remove depractions:" into main

3 years agoRemove depractions:
Federico Caselli [Sun, 24 Oct 2021 16:53:54 +0000 (18:53 +0200)] 
Remove depractions:

- Passing bind arguments to Session.execute
- This Session located a target engine via bound metadata

Change-Id: I916c8c4cff344ee5652fceac4dfd241dd8160f7b

3 years agodont pull filter_by from from_obj, entity is hopefully sufficient
Mike Bayer [Tue, 26 Oct 2021 15:28:42 +0000 (11:28 -0400)] 
dont pull filter_by from from_obj, entity is hopefully sufficient

Fixed 1.4 regression where :meth:`_orm.Query.filter_by` would not function
correctly on a :class:`_orm.Query` that was produced from
:meth:`_orm.Query.union`, :meth:`_orm.Query.from_self` or similar.

Fixes: #7239
Change-Id: I3a0c3fd71180b1bfb6bf855f436a29c729664082

3 years agoFixes: #4100
jonathan vanasco [Fri, 24 Sep 2021 18:55:59 +0000 (14:55 -0400)] 
Fixes: #4100
Add a warning, in two places, stating `with_for_update` will lock joinedload
tables, because at least one person did not expect the obvious to happen.

Also warn that eager loading techniques may not work with `with_for_update`
and combining the two is not officially supported or recommended.

Change-Id: Iedd609b56b3144d90a90fc2eea3cf5335a2d178a

3 years agoadd sections for ORM use with UNION
Mike Bayer [Tue, 26 Oct 2021 02:21:33 +0000 (22:21 -0400)] 
add sections for ORM use with UNION

this is a fairly non-obvious part of the new ORM
querying style and needs its own sections

Change-Id: Iacb176020d580066c1e0b7f2b40bfbbcb3587d76

3 years agowarnings: select_entity_from()
Mike Bayer [Fri, 22 Oct 2021 21:37:07 +0000 (17:37 -0400)] 
warnings: select_entity_from()

Change-Id: I8c259e61134c38a1fa907c308068337473c82914

3 years agodeprecation warnings: strings in loader options, join, with_parent
Mike Bayer [Wed, 20 Oct 2021 16:50:53 +0000 (12:50 -0400)] 
deprecation warnings: strings in loader options, join, with_parent

Repairs one in-library deprecation warning regarding
mapper propagation of options

raises maxfail to 250, as 25 is too low when we are trying
to address many errors at once.   the 25 was originally
due to the fact that our fixtures would be broken after
that many failures in most cases, which today should not
be the case nearly as often.

Change-Id: I26affddf42e2cae2aaf9561633e9b8cd431eb189

3 years agoadd full docs/notes for all TypeEngine/TypeDecorator interactions
Mike Bayer [Sun, 24 Oct 2021 00:36:41 +0000 (20:36 -0400)] 
add full docs/notes for all TypeEngine/TypeDecorator interactions

Added notes to all TypeEngine methods as to which should be
overridden by TypeDecorator implementations.  Made sure
docstrings are present for all TypeDecorator methods as some
were missing, and clarified which should be overridden, which
should not, as well as what phase each method is called within.

Change-Id: Ibd6e7fb0933ad3ca0927d8785d9087e3eddac90e
References: #7230

3 years agoMerge "use correct entity in path for aliased class relationship" into main
mike bayer [Fri, 22 Oct 2021 18:48:22 +0000 (18:48 +0000)] 
Merge "use correct entity in path for aliased class relationship" into main

3 years agouse correct entity in path for aliased class relationship
Mike Bayer [Fri, 22 Oct 2021 16:31:06 +0000 (12:31 -0400)] 
use correct entity in path for aliased class relationship

Fixed bug in "relationship to aliased class" feature introduced at
:ref:`relationship_aliased_class` where it was not possible to create a
loader strategy option targeting an attribute on the target using the
:func:`_orm.aliased` construct directly in a second loader option, such as
``selectinload(A.aliased_bs).joinedload(aliased_b.cs)``, without explicitly
qualifying using :meth:`_orm.PropComparator.of_type` on the preceding
element of the path. Additionally, targeting the non-aliased class directly
would be accepted (inappropriately), but would silently fail, such as
``selectinload(A.aliased_bs).joinedload(B.cs)``; this now raises an error
referring to the typing mismatch.

Fixes: #7224
Change-Id: I40857c7275667dcb64f1d1fd0c8072e48758e678

3 years agoApply minor update to async_orm example
Gord Thompson [Wed, 20 Oct 2021 21:15:37 +0000 (15:15 -0600)] 
Apply minor update to async_orm example

- Fixed import to avoid MovedIn20Warning.

- Separated drop_all() and create_all() into separate
context managers to avoid dropping and creating the
same table within the same transaction. Apparently
some databases (e.g., CockroachDB) don't allow that.

Change-Id: Id26d7d719871a75ffb78c6af589658666802fb2f

3 years agoFix wheels generation for python 3.10+
Federico Caselli [Wed, 20 Oct 2021 20:28:55 +0000 (22:28 +0200)] 
Fix wheels generation for python 3.10+

Change-Id: I0124bb1bb164fbf2eadf41be066773a2e316b3fe

3 years agoMerge "fix: Update reserved words list of MySQL / MariaDB dialect" into main
mike bayer [Wed, 20 Oct 2021 17:51:20 +0000 (17:51 +0000)] 
Merge "fix: Update reserved words list of MySQL / MariaDB dialect" into main

3 years agofix: Update reserved words list of MySQL / MariaDB dialect
Kevin Kirsche [Tue, 19 Oct 2021 21:22:03 +0000 (17:22 -0400)] 
fix: Update reserved words list of MySQL / MariaDB dialect

Reorganized the list of reserved words into two separate lists, one for
MySQL and one for MariaDB, so that these diverging sets of words can be
managed more accurately; adjusted the MySQL/MariaDB dialect to switch among
these lists based on either explicitly configured or
server-version-detected "MySQL" or "MariaDB" backend. Added all current
reserved words through MySQL 8 and current MariaDB versions including
recently added keywords like "lead" . Pull request courtesy Kevin Kirsche.

1. Move reserved words to it's own file.
2. Add missing reserved words from https://mariadb.com/kb/en/reserved-words/
    * Note: this only adds MariaDB though links to MySQL, it also does not
      include the reserved words for Oracle mode, as listed in the link.

Fixes: #7167
Supercedes: #7197
Closes: #7207
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7207
Pull-request-sha: 5a682e331069520ccad9e6bf3cc5e4a77a889ef0

Change-Id: Ib25be8148568899f56b5c9b42d4f530ade8a04e3

3 years agoMerge "Add missing deprecation to ``MetaData.bind`` argument" into main
mike bayer [Wed, 20 Oct 2021 16:28:16 +0000 (16:28 +0000)] 
Merge "Add missing deprecation to ``MetaData.bind`` argument" into main

3 years agoremove _resolve_label and related attributes
Mike Bayer [Mon, 18 Oct 2021 20:35:21 +0000 (16:35 -0400)] 
remove _resolve_label and related attributes

these seem to date back to 0.9 and revs like #3148 but none
of it seems to be affecting things now, try removing it all
and seeing what fails.

we've noted that _resolve_label does not appear to be
needed, however allow_label_resolve remains relevant both
for non-column elements like text() as well as that it is
used explicitly by the joined eager loader.

Change-Id: Ic8a5d8001ef2a4133360f51a92a6f7b0cc389095

3 years agoVersion 1.4.27 placeholder
Mike Bayer [Tue, 19 Oct 2021 21:08:18 +0000 (17:08 -0400)] 
Version 1.4.27 placeholder

3 years ago- 1.4.26 rel_1_4_26
Mike Bayer [Tue, 19 Oct 2021 21:03:34 +0000 (17:03 -0400)] 
- 1.4.26

3 years agotypo fix
Mike Bayer [Tue, 19 Oct 2021 21:01:13 +0000 (17:01 -0400)] 
typo fix

Change-Id: Ic4a334e48e652d5bd561a04cc11c35433a429188

3 years agorevise _get_crud_kv_pairs from 18b4a3437
Mike Bayer [Tue, 19 Oct 2021 20:13:51 +0000 (16:13 -0400)] 
revise _get_crud_kv_pairs from 18b4a3437

submitted 18b4a3437a60fbfa0c25287d9a3b83d7c9d4f762 too soon
as @CaselIT found a great refinement for this method.

Change-Id: Id3818aa6bdc5938fc2f1395558aa8ead8ea6b319

3 years agoprocess bulk_update_tuples before cache key or compilation
Mike Bayer [Tue, 19 Oct 2021 18:07:32 +0000 (14:07 -0400)] 
process bulk_update_tuples before cache key or compilation

Fixed regression where the use of a :class:`_orm.hybrid_property` attribute
or a mapped :func:`_orm.composite` attribute as a key passed to the
:meth:`_dml.Update.values` method for an ORM-enabled :class:`_dml.Update`
statement, as well as when using it via the legacy
:meth:`_orm.Query.update` method, would be processed for incoming
ORM/hybrid/composite values within the compilation stage of the UPDATE
statement, which meant that in those cases where caching occurred,
subsequent invocations of the same statement would no longer receive the
correct values. This would include not only hybrids that use the
:meth:`_orm.hybrid_property.update_expression` method, but any use of a
plain hybrid attribute as well. For composites, the issue instead caused a
non-repeatable cache key to be generated, which would break caching and
could fill up the statement cache with repeated statements.

The :class:`_dml.Update` construct now handles the processing of key/value
pairs passed to :meth:`_dml.Update.values` and
:meth:`_dml.Update.ordered_values` up front when the construct is first
generated, before the cache key has been generated so that the key/value
pairs are processed each time, and so that the cache key is generated
against the individual column/value pairs that will ultimately be
used in the statement.

Fixes: #7209
Change-Id: I08f248d1d60ea9690b014c21439b775d951fb9e5

3 years agochangelog updates
Mike Bayer [Tue, 19 Oct 2021 13:57:27 +0000 (09:57 -0400)] 
changelog updates

Change-Id: I527dd71eb90b7c3e9e773f7c3ba79374806ffad7

3 years agoMerge "use coercions for label element, ensure propagate_attrs" into main
mike bayer [Mon, 18 Oct 2021 20:40:07 +0000 (20:40 +0000)] 
Merge "use coercions for label element, ensure propagate_attrs" into main

3 years agoMerge "Modernize tests - query_from_self" into main
mike bayer [Mon, 18 Oct 2021 20:22:31 +0000 (20:22 +0000)] 
Merge "Modernize tests - query_from_self" into main

3 years agoMerge "vendor asynccontextmanager outside of greenlet dependency" into main
mike bayer [Mon, 18 Oct 2021 20:00:11 +0000 (20:00 +0000)] 
Merge "vendor asynccontextmanager outside of greenlet dependency" into main

3 years agouse coercions for label element, ensure propagate_attrs
Mike Bayer [Mon, 18 Oct 2021 19:43:27 +0000 (15:43 -0400)] 
use coercions for label element, ensure propagate_attrs

Fixed bug where the ORM "plugin", necessary for features such as
:func:`_orm.with_loader_criteria` to work correctly, would not be applied
to a :func:`_sql.select` which queried from an ORM column expression if it
made use of the :meth:`_sql.ColumnElement.label` modifier.

Fixes: #7205
Change-Id: I72b84442e14df8b5ece33916f3c51ca3f358864b

3 years agoAdd missing deprecation to ``MetaData.bind`` argument
Federico Caselli [Sat, 16 Oct 2021 17:31:45 +0000 (19:31 +0200)] 
Add missing deprecation to ``MetaData.bind`` argument

Fixes: #7194
Change-Id: I9dacbb562aa55d9c408a43f8e57050db31dc8bfc

3 years agoAdd Firebolt to table of external dialects (#7206)
Kevin Marr [Mon, 18 Oct 2021 19:39:06 +0000 (14:39 -0500)] 
Add Firebolt to table of external dialects (#7206)

We recently built an external dialect for our data warehouse, Firebolt, and would like it to be listed in the documentation. Thanks!

3 years agovendor asynccontextmanager outside of greenlet dependency
Mike Bayer [Mon, 18 Oct 2021 18:31:40 +0000 (14:31 -0400)] 
vendor asynccontextmanager outside of greenlet dependency

Fixed installation issue where the ``sqlalchemy.dialects.mysql`` module
would not be importable if "greenlet" were not installed.

This was actually breaking the sphinx build for when greenlet
were not installed.

Fixes: #7204
Change-Id: Ia351c124a2f1ca44bafe20a97267ce20cb55808f

3 years agoDocument dynamic for asyncio
Federico Caselli [Thu, 30 Sep 2021 21:26:33 +0000 (23:26 +0200)] 
Document dynamic for asyncio

Change-Id: Ieedc748587288c30630a2453f20eb72001cb78ab
(cherry picked from commit aeb61f4bb7d0b6d3d550d0206046208d6d4d7e91)

3 years agoModernize tests - query_from_self
Gord Thompson [Sun, 17 Oct 2021 17:52:32 +0000 (11:52 -0600)] 
Modernize tests - query_from_self

Change-Id: Ic14fdb5b6c49b668698de146bbafbd996da3d843

3 years agoMerge "re-enable asnycmy >= 0.2.3; disable aiomysql totally" into main
mike bayer [Sun, 17 Oct 2021 02:52:35 +0000 (02:52 +0000)] 
Merge "re-enable asnycmy >= 0.2.3; disable aiomysql totally" into main

3 years agoAdd missing note: bind arg will be required in 2.0 (#7195)
Sergey Golitsynskiy [Sat, 16 Oct 2021 07:53:04 +0000 (03:53 -0400)] 
Add missing note: bind arg will be required in 2.0 (#7195)

Applies to Index.create() and Index.drop()

3 years agoMerge "fix with_loader_criteria for select(A).join(B)" into main
mike bayer [Fri, 15 Oct 2021 21:41:36 +0000 (21:41 +0000)] 
Merge "fix with_loader_criteria for select(A).join(B)" into main

3 years agore-enable asnycmy >= 0.2.3; disable aiomysql totally
Mike Bayer [Fri, 15 Oct 2021 15:47:08 +0000 (11:47 -0400)] 
re-enable asnycmy >= 0.2.3; disable aiomysql totally

Change-Id: I94bc22db0462509003c8241d0ccef915fe6513c6

3 years agofix with_loader_criteria for select(A).join(B)
Mike Bayer [Fri, 15 Oct 2021 15:03:46 +0000 (11:03 -0400)] 
fix with_loader_criteria for select(A).join(B)

Also revise the contains_eager() note that was just
added in fec2b6560c14bb28ee7f, as I mistakenly forgot that
WLC also affects elements of the query that are there
as part of the normal entites/criteria.

Fixes: #7189
Change-Id: Ibd8a1826aaee8e91ab6704173df5fccb56b7e785

3 years agoMerge "support bind expressions w/ expanding IN; apply to psycopg2" into main
mike bayer [Fri, 15 Oct 2021 15:27:45 +0000 (15:27 +0000)] 
Merge "support bind expressions w/ expanding IN; apply to psycopg2" into main

3 years agoMerge "Fix reflection of FK against a unique index" into main
mike bayer [Fri, 15 Oct 2021 13:50:25 +0000 (13:50 +0000)] 
Merge "Fix reflection of FK against a unique index" into main

3 years agorepair fetch after session close for mssql+pyodbc
Mike Bayer [Fri, 15 Oct 2021 13:48:41 +0000 (09:48 -0400)] 
repair fetch after session close for mssql+pyodbc

this test relies upon a cursor that can do fetchall()
after connection.rollback() was called.

Change-Id: I8c19a67bad97019375671c69d6ed7fa4f4e6872f

3 years agosupport bind expressions w/ expanding IN; apply to psycopg2
Mike Bayer [Wed, 13 Oct 2021 19:52:12 +0000 (15:52 -0400)] 
support bind expressions w/ expanding IN; apply to psycopg2

Fixed issue where "expanding IN" would fail to function correctly with
datatypes that use the :meth:`_types.TypeEngine.bind_expression` method,
where the method would need to be applied to each element of the
IN expression rather than the overall IN expression itself.

Fixed issue where IN expressions against a series of array elements, as can
be done with PostgreSQL, would fail to function correctly due to multiple
issues within the "expanding IN" feature of SQLAlchemy Core that was
standardized in version 1.4.  The psycopg2 dialect now makes use of the
:meth:`_types.TypeEngine.bind_expression` method with :class:`_types.ARRAY`
to portably apply the correct casts to elements.  The asyncpg dialect was
not affected by this issue as it applies bind-level casts at the driver
level rather than at the compiler level.

as part of this commit the "bind translate" feature has been
simplified and also applies to the names in the POSTCOMPILE tag to
accommodate for brackets.

Fixes: #7177
Change-Id: I08c703adb0a9bd6f5aeee5de3ff6f03cccdccdc5

3 years agoFix reflection of FK against a unique index
Gord Thompson [Sat, 9 Oct 2021 19:58:36 +0000 (13:58 -0600)] 
Fix reflection of FK against a unique index

Also implement reflection of ON DELETE, ON UPDATE
as the data is right there.

Fixes: #7160
Change-Id: Ifff871a8cb1d1bea235616042e16ed3b5c5f19f9

3 years agoclarify that with_loader_criteria does not affect contains_eager()
Mike Bayer [Thu, 14 Oct 2021 22:24:26 +0000 (18:24 -0400)] 
clarify that with_loader_criteria does not affect contains_eager()

The ORM contains_eager() option does not affect the rendering
of a SQL query in any way except that it adds additional columns
to the columns clause of the SELECT. Therefore the
with_loader_criteria() function has no interaction with this
loader option.

Fixes: #7189
Change-Id: I2e5439746de92382615b652c0e0801b6e48210c8

3 years agotemporarily disable asyncmy from testing
Mike Bayer [Thu, 14 Oct 2021 22:19:30 +0000 (18:19 -0400)] 
temporarily disable asyncmy from testing

we are getting too many failures with this library
for the moment and we have other reviews that need to
go in.

Change-Id: I096d792780f08a8ed421acddec28efb0ec9b22e2

3 years agoMerge "Reflect table can reflect table with no columns" into main
mike bayer [Thu, 14 Oct 2021 21:08:37 +0000 (21:08 +0000)] 
Merge "Reflect table can reflect table with no columns" into main

3 years agoReflect table can reflect table with no columns
Sumit Khanna [Mon, 4 Oct 2021 15:14:38 +0000 (11:14 -0400)] 
Reflect table can reflect table with no columns

The :meth:`_engine.Inspector.reflect_table` method now supports reflecting
tables that do not have user defined columns. This allows
:meth:`_schema.MetaData.reflect` to properly complete reflection on
databases that contain such tables.   Currently, only PostgreSQL is known
to support such a construct among the common database backends.

Fixes: #3247
Closes: #7118
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7118
Pull-request-sha: cb8ce01957e9a1453290a7c2728af8c60ef55fa1

Change-Id: I906cebe17d13554d79086b92f3e1e51ffba3e818

3 years agoMerge "Pickling fixes for ORM / Core" into main
mike bayer [Wed, 13 Oct 2021 20:05:55 +0000 (20:05 +0000)] 
Merge "Pickling fixes for ORM / Core" into main

3 years agoPickling fixes for ORM / Core
Mike Bayer [Wed, 13 Oct 2021 16:00:52 +0000 (12:00 -0400)] 
Pickling fixes for ORM / Core

Fixed regression where ORM loaded objects could not be pickled in cases
where loader options making use of ``"*"`` were used in certain
combinations, such as combining the :func:`_orm.joinedload` loader strategy
with ``raiseload('*')`` of sub-elements.

Fixes: #7134
Fixed issue where SQL queries using the
:meth:`_functions.FunctionElement.within_group` construct could not be
pickled, typically when using the ``sqlalchemy.ext.serializer`` extension
but also for general generic pickling.

Fixes: #6520
Change-Id: Ib73fd49c875e6da9898493c190f610e68b88ec72

3 years agoMerge "Fix has_table() false negative for #temp tables" into main
mike bayer [Wed, 13 Oct 2021 14:11:19 +0000 (14:11 +0000)] 
Merge "Fix has_table() false negative for #temp tables" into main

3 years agoFix recursive CTE to support nesting
Eric Masseran [Fri, 8 Oct 2021 14:02:58 +0000 (10:02 -0400)] 
Fix recursive CTE to support nesting

Repaired issue in new :paramref:`_sql.HasCTE.cte.nesting` parameter
introduced with :ticket:`4123` where a recursive :class:`_sql.CTE` using
:paramref:`_sql.HasCTE.cte.recursive` in typical conjunction with UNION
would not compile correctly.  Additionally makes some adjustments so that
the :class:`_sql.CTE` construct creates a correct cache key.
Pull request courtesy Eric Masseran.

Fixes: #4123
> This has not been caught by the tests because the nesting recursive
queries there did not union against itself, eg there was only the i
root clause...

- Now tests are real recursive queries
- Add tests on aliased nested CTEs (recursive or not)
- Adapt the `_restates` attribute to use it as a reference
- Add some docs around to explain some variables usage

Closes: #7133
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7133
Pull-request-sha: 2633f34f7f5336a4a85bd3f71d07bca33ce27a2c

Change-Id: I15512c94e1bc1f52afc619d82057ca647d274e92

3 years agoFix has_table() false negative for #temp tables
Gord Thompson [Sat, 9 Oct 2021 22:44:57 +0000 (16:44 -0600)] 
Fix has_table() false negative for #temp tables

Fixed issue with :meth:`.Inspector.has_table` where it would return False
if a local temp table with the same name from a different session happened
to be returned first when querying tempdb.  This is a continuation of
:ticket:`6910` which accounted for the temp table existing only in the
alternate session and not the current one.

Fixes: #7168
Change-Id: I19dbb71a63184c6d41822b0e882b7b284ac83786

3 years agoAdd support for Python 3.10
Federico Caselli [Mon, 11 Oct 2021 19:47:18 +0000 (15:47 -0400)] 
Add support for Python 3.10

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->

Python 3.10 was released last week.

Test on Python 3.10 and add the Trove classifier.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

^ Which checklist option should I use?

Should I do something to trigger/test all the workflows?

Closes: #7179
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7179
Pull-request-sha: 5df7ff0e0d309301a877314e620fadb6f3f570cb

Change-Id: Ib7ecc0de75f7dffdf05db13563f7be10898e67ba

3 years agoblock asyncmy 0.2.2
Mike Bayer [Mon, 11 Oct 2021 17:49:30 +0000 (13:49 -0400)] 
block asyncmy 0.2.2

two issues that are also in the already blocked 0.2.1:

https://github.com/long2ice/asyncmy/issues/21

https://github.com/long2ice/asyncmy/issues/22

Change-Id: I188cfc22c5896bfc49f60f6b026d6076acbca3cf

3 years agoMerge "rename elements to main" into main
mike bayer [Mon, 11 Oct 2021 17:26:07 +0000 (17:26 +0000)] 
Merge "rename elements to main" into main

3 years agoAdd missing changelog file for #7153
Mike Bayer [Mon, 11 Oct 2021 16:34:02 +0000 (12:34 -0400)] 
Add missing changelog file for #7153

Fixes: #7153
Change-Id: I613d3179781344923add904cbdca87aff89eee83

3 years agorename elements to main
Mike Bayer [Mon, 11 Oct 2021 16:30:10 +0000 (12:30 -0400)] 
rename elements to main

There are still some SQLite / MySQL specific occurrences
of "master" but this is most of it.

Change-Id: I0144c992e2f0207777e20e058b63a11c031986b9

3 years agocreate main branch in gerrit
Mike Bayer [Mon, 11 Oct 2021 16:29:34 +0000 (12:29 -0400)] 
create main branch in gerrit

Change-Id: I952364222800eb6985ed2554dd4b594cc6c1a01e

3 years agoupdate versioned rows examples for 1.4
Mike Bayer [Sat, 9 Oct 2021 22:56:25 +0000 (18:56 -0400)] 
update versioned rows examples for 1.4

Repaired the examples in examples/versioned_rows to use SQLAlchemy 1.4 APIs
correctly; these examples had been missed when API changes like removing
"passive" from ``Session.is_modified()`` were made as well as the
``do_orm_execute()`` event hook were added.

Fixes: #7169
Change-Id: I30930a3b185dc0f73be4467faa2f97c5ebf1a36d

3 years agoMerge "fixes for usage of the null() and similar constants"
mike bayer [Fri, 8 Oct 2021 18:32:26 +0000 (18:32 +0000)] 
Merge "fixes for usage of the null() and similar constants"

3 years agoAdd documentation on how to use the events with asyncio
Federico Caselli [Wed, 29 Sep 2021 19:54:09 +0000 (21:54 +0200)] 
Add documentation on how to use the events with asyncio

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #6899
Change-Id: I965af321fb36d9645fe3fc2675ad9943f24e32f2

3 years agofixes for usage of the null() and similar constants
Mike Bayer [Wed, 6 Oct 2021 22:51:08 +0000 (18:51 -0400)] 
fixes for usage of the null() and similar constants

Adjusted the "column disambiguation" logic that's new in 1.4, where the
same expression repeated gets an "extra anonymous" label, so that the logic
more aggressively deduplicates those labels when the repeated element
is the same Python expression object each time, as occurs in cases like
when using "singleton" values like :func:`_sql.null`.  This is based on
the observation that at least some databases (e.g. MySQL, but not SQLite)
will raise an error if the same label is repeated inside of a subquery.

Related to :ticket:`7153`, fixed an issue where result column lookups
would fail for "adapted" SELECT statements that selected for
"constant" value expressions most typically the NULL expression,
as would occur in such places as joined eager loading in conjunction
with limit/offset.  This was overall a regression due to issue
:ticket:`6259` which removed all "adaption" for constants like NULL,
"true", and "false", but this broke the case where the same adaption
logic were used to match the constant to a labeled expression referring
to the constant in a subquery.

Fixes: #7153
Fixes: #7154
Change-Id: I43823343721b9e70524ea3f5e8f39dd543a3e92b

3 years agoblock asyncmy 0.2.1
Mike Bayer [Fri, 8 Oct 2021 16:53:08 +0000 (12:53 -0400)] 
block asyncmy 0.2.1

Change-Id: I0c95e20be01846ed2c705e54d8d5a8395031ff03
References: https://github.com/long2ice/asyncmy/issues/18

3 years agoMerge "Enable tests of fetch/offset for mariadb>=10.6"
mike bayer [Fri, 8 Oct 2021 14:28:11 +0000 (14:28 +0000)] 
Merge "Enable tests of fetch/offset for mariadb>=10.6"