]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
3 years ago📚 DOCS: Update performance script 7143/head
Chris Sewell [Mon, 4 Oct 2021 21:12:25 +0000 (23:12 +0200)] 
📚 DOCS: Update performance script

Updated to Python 3, and to use `future=True`.
Also added outputs for `return_default=True`

3 years agorepair any_() / all_() "implicit flip" behavior for None
Mike Bayer [Mon, 4 Oct 2021 15:21:35 +0000 (11:21 -0400)] 
repair any_() / all_() "implicit flip" behavior for None

Fixed an inconsistency in the any_() / all_() functions / methods where the
special behavior these functions have of "flipping" the expression such
that the "ANY" / "ALL" expression is always on the right side would not
function if the comparison were against the None value, that is,
"column.any_() == None" should produce the same SQL expression as "null()
== column.any_()". Added more docs to clarify this as well, plus mentions
that any_() / all_() generally supersede the ARRAY version "any()" /
"all()".

Fixes: #7140
Change-Id: Ia5d55414ba40eb3fbda3598931fdd24c9b4a4411

3 years agosupport utf8mb3 char encoding fully for mysqlclient, others
Mike Bayer [Sat, 2 Oct 2021 15:53:55 +0000 (11:53 -0400)] 
support utf8mb3 char encoding fully for mysqlclient, others

Fixes to accommodate for the MariaDB 10.6 series, including backwards
incompatible changes in both the mariadb-connector Python driver (supported
on SQLAlchemy 1.4 only) as well as the native 10.6 client libraries that
are used automatically by the mysqlclient DBAPI (applies to both 1.3 and
1.4). The "utf8mb3" encoding symbol is now reported by these client
libraries when the encoding is stated as "utf8", leading to lookup and
encoding errors within the MySQL dialect that does not expect this symbol.
Updates to both the MySQL base library to accommodate for this utf8mb3
symbol being reported as well as to the test suite. Thanks to Georg Richter
for support.

Fixes: #7136
Fixes: #7115
Change-Id: I655d9d9868aef76037023d0c602b8a7c881780b0

3 years agoMerge "Ensure all SQLAlchemy exception can be properly pickled"
mike bayer [Fri, 1 Oct 2021 22:28:59 +0000 (22:28 +0000)] 
Merge "Ensure all SQLAlchemy exception can be properly pickled"

3 years agoMerge "Fixes: #3160"
mike bayer [Fri, 1 Oct 2021 22:27:04 +0000 (22:27 +0000)] 
Merge "Fixes: #3160"

3 years agoMerge "Account for `schema` in `table()` `fullname` attribute."
mike bayer [Fri, 1 Oct 2021 22:25:58 +0000 (22:25 +0000)] 
Merge "Account for `schema` in `table()` `fullname` attribute."

3 years agoMerge "References: #4426"
mike bayer [Fri, 1 Oct 2021 22:20:05 +0000 (22:20 +0000)] 
Merge "References: #4426"

3 years agoMerge "Fixes: #4504"
mike bayer [Fri, 1 Oct 2021 22:18:38 +0000 (22:18 +0000)] 
Merge "Fixes: #4504"

3 years agoEnsure all SQLAlchemy exception can be properly pickled
Federico Caselli [Mon, 27 Sep 2021 19:40:47 +0000 (15:40 -0400)] 
Ensure all SQLAlchemy exception can be properly pickled

Implemented proper ``__reduce__()`` methods for all SQLAlchemy exception
objects to ensure they all support clean round trips when pickling, as
exception objects are often serialized for the purposes of various
debugging tools.

Fixes  #7077
Closes: #7078
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7078
Pull-request-sha: 8ba69f26532f0f60f679289702c9477e25149bf8

Change-Id: Id62f8d351cd9180c441ffa9201efcf5f1876bf83

3 years agoorganize datetime types for correct impls
Mike Bayer [Fri, 1 Oct 2021 16:53:40 +0000 (12:53 -0400)] 
organize datetime types for correct impls

Fixed bug in SQL Server ``DATETIMEOFFSET`` where the ODBC implementation
would not generate the correct DDL, for cases where the type were converted
using the ``dialect.type_descriptor()`` method, the usage of which is
illustrated in some documented examples for :class:`.TypeDecorator`, though
not necessary for most datatypes. Regression was introduced by
:ticket:`6366`. As part of this change, the full list of SQL Server date
types have been amended to return a "dialect impl" that generates the same
DDL name as the supertype.

Fixes: #7129
Change-Id: I7d9bea54c0c38e16d1a6ad978cca996006a1b624

3 years agoMerge "indicate private use of URL.__new__ privately only"
mike bayer [Fri, 1 Oct 2021 21:05:35 +0000 (21:05 +0000)] 
Merge "indicate private use of URL.__new__ privately only"

3 years agoAccount for `schema` in `table()` `fullname` attribute.
Federico Caselli [Fri, 1 Oct 2021 18:18:34 +0000 (20:18 +0200)] 
Account for `schema` in `table()` `fullname` attribute.

Fixes: #7061
Change-Id: I715da89591c03d40d77734473bd42b34b9c4e1dc

3 years agoindicate private use of URL.__new__ privately only
Mike Bayer [Fri, 1 Oct 2021 17:18:41 +0000 (13:18 -0400)] 
indicate private use of URL.__new__ privately only

Fixed issue where the deprecation warning for the :class:`.URL` constructor
which indicates that the :meth:`.URL.create` method should be used would
not emit if a full positional argument list of seven arguments were passed;
additionally, validation of URL arguments will now occur if the constructor
is called in this way, which was being skipped previously.

Fixes: #7130
Change-Id: I8c8491d8aa7774afaf67c22b4f8e9859f780f2d9

3 years agocorrect charset for mariadb connector with mdb 10.6
Georg Richter [Thu, 30 Sep 2021 22:13:49 +0000 (18:13 -0400)] 
correct charset for mariadb connector with mdb 10.6

Updated test suite to pass correctly for MariaDB 10.6 when using the
mariadb-connector driver, which made some adjustments to default encoding.
Pull request courtesy Georg Richter.

Use character set utf8mb4 instead of utf8:

1) Character set for mariadb connector is utf8mb4 and
cannot be changed.

2) Since MariaDB 10.6.1 utf8 is mapped to utf8mb3, and
will be mapped to utf8mb4 in 10.7, see [MDEV-8334](https://jira.mariadb.org/browse/MDEV-8334) (rename
utf8 to utf8mb3)

utf8mb4 character set support was added 12 years ago and
will work with all non eoled MariaDB server versions.

Fixes: #7115
Closes: #7116
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7116
Pull-request-sha: 79516ccce2dead11e6658596c9ad400b964d24c9

Change-Id: I86c30fb636c46307cb551080641e324d2bbc1cb3

3 years agoadd pep8 to github workflow
Federico Caselli [Thu, 30 Sep 2021 19:04:22 +0000 (21:04 +0200)] 
add pep8 to github workflow

Change-Id: I579e914e7bea38f73304f4d624649f09554ab21c

3 years agoModernize tests - calling_mapper_directly
Gord Thompson [Thu, 12 Aug 2021 19:04:28 +0000 (13:04 -0600)] 
Modernize tests - calling_mapper_directly

a few changes for py2k:

* map_imperatively() includes the check that a class
  is being sent, this was only working for mapper() before

* the test suite didn't place the py2k "autouse" workaround
  in the correct order, seemingly, tried to adjust the
  per-test ordering setup in pytestplugin.py

Change-Id: I4cc39630724e810953cfda7b2afdadc8b948e3c2

3 years agoMerge "remove declarative warnings"
mike bayer [Thu, 30 Sep 2021 12:58:59 +0000 (12:58 +0000)] 
Merge "remove declarative warnings"

3 years agoremove declarative warnings
Mike Bayer [Wed, 29 Sep 2021 19:07:36 +0000 (15:07 -0400)] 
remove declarative warnings

* sqlalchemy.ext.declarative names
* declarative_base(bind)

Change-Id: I0ca26894b224458b58e46504c5ff7b5d3031a829

3 years agoMerge branch 'master' of ssh://gerrit.sqlalchemy.org:29418/sqlalchemy/sqlalchemy
Mike Bayer [Wed, 29 Sep 2021 21:17:44 +0000 (17:17 -0400)] 
Merge branch 'master' of ssh://gerrit.sqlalchemy.org:29418/sqlalchemy/sqlalchemy

Change-Id: I610fecd5f40742db43de0a92e2b61a96f0ef1963

3 years agoFixes: #4504
jonathan vanasco [Tue, 28 Sep 2021 15:46:53 +0000 (11:46 -0400)] 
Fixes: #4504
Docstring for EXTRACT

Change-Id: Ie529ceb3551adedf0df873c22e65f8615cd1c9ef

3 years agofix python 3.6 tests
Federico Caselli [Wed, 29 Sep 2021 20:34:28 +0000 (22:34 +0200)] 
fix python 3.6 tests

Change-Id: Ie9184fd4dc8fb68dd218c82b7f6a93332aa3d24a

3 years agoclarifies that @reconstructor only applies to a single method 7114/head
E. Seiver [Wed, 29 Sep 2021 19:25:36 +0000 (12:25 -0700)] 
clarifies that @reconstructor only applies to a single method

3 years agoAdd missing methods added in :ticket:`6991`
Federico Caselli [Tue, 28 Sep 2021 20:58:08 +0000 (22:58 +0200)] 
Add missing methods added in :ticket:`6991`
to ``scoped_session`` and ``async_scoped_session``.

Fixes: #7103
Change-Id: If80481771d9b428f2403af3862e0479bd069257e

3 years agoMerge "warn or deprecate for auto-aliasing in joins"
mike bayer [Tue, 28 Sep 2021 20:14:12 +0000 (20:14 +0000)] 
Merge "warn or deprecate for auto-aliasing in joins"

3 years agoimprove bug report template. Many people don't know what dbapi is
Federico Caselli [Tue, 28 Sep 2021 18:06:20 +0000 (20:06 +0200)] 
improve bug report template. Many people don't know what dbapi is

Change-Id: Ibbe47a159292d333ae58fe046e5c32e949856d6d

3 years agoMerge "Fixes: #5151"
mike bayer [Tue, 28 Sep 2021 18:12:51 +0000 (18:12 +0000)] 
Merge "Fixes: #5151"

3 years agoFixes: #3160
jonathan vanasco [Fri, 24 Sep 2021 18:42:16 +0000 (14:42 -0400)] 
Fixes: #3160
Clarify that match() emits `to_tsquery`, which expects input text
to be in postgresql's own format.

Change-Id: Id723032bca2eededc03ac30681c0dd4ddf76c232

3 years agoMerge "Fixes: #2937"
mike bayer [Tue, 28 Sep 2021 18:00:16 +0000 (18:00 +0000)] 
Merge "Fixes: #2937"

3 years agoFixes: #2937
jonathan vanasco [Thu, 23 Sep 2021 17:06:40 +0000 (13:06 -0400)] 
Fixes: #2937
* docs for event listen kwargs
* docs for mysql to use `listen` for changing the sql_mode`

Change-Id: I7c1678488658edda3c5baaf0f7648108e93a4be1

3 years agoMerge "Fixes: #7051"
mike bayer [Tue, 28 Sep 2021 17:33:34 +0000 (17:33 +0000)] 
Merge "Fixes: #7051"

3 years agowarn or deprecate for auto-aliasing in joins
Mike Bayer [Sat, 4 Sep 2021 16:12:46 +0000 (12:12 -0400)] 
warn or deprecate for auto-aliasing in joins

An extra layer of warning messages has been added to the functionality
of :meth:`_orm.Query.join` and the ORM version of
:meth:`_sql.Select.join`, where a few places where "automatic aliasing"
continues to occur will now be called out as a pattern to avoid, mostly
specific to the area of joined table inheritance where classes that share
common base tables are being joined together without using explicit aliases.
One case emits a legacy warning for a pattern that's not recommended,
the other case is fully deprecated.

The automatic aliasing within ORM join() which occurs for overlapping
mapped tables does not work consistently with all APIs such as
``contains_eager()``, and rather than continue to try to make these use
cases work everywhere, replacing with a more user-explicit pattern
is clearer, less prone to bugs and simplifies SQLAlchemy's internals
further.

The warnings include links to the errors.rst page where each pattern is
demonstrated along with the recommended pattern to fix.

* Improved the exception message generated when configuring a mapping with
  joined table inheritance where the two tables either have no foreign key
  relationships set up, or where they have multiple foreign key relationships
  set up. The message is now ORM specific and includes context that the
  :paramref:`_orm.Mapper.inherit_condition` parameter may be needed
  particularly for the ambiguous foreign keys case.

* Add explicit support in the _expect_warnings() assertion for nested
  _expect_warnings calls

* generalize the NoCache fixture, which we also need to catch warnings
  during compilation consistently

* generalize the __str__() method for the HasCode mixin so all warnings
  and errors include the code link in their string

Fixes: #6974
Change-Id: I84ed79ba2112c39eaab7973b6d6f46de7fa80842

3 years agoReferences: #4426
jonathan vanasco [Tue, 28 Sep 2021 15:23:40 +0000 (11:23 -0400)] 
References: #4426

Updated elementtree example to replace the deprecated classical mappings
interface with the current `registry.map_imperatively()` version.

The examples STILL use classical mappings, so the ticket remains open.
This update merely removes the deprecated API in favor of the (temporary?) replacement.

Change-Id: I8ddb86b76d82ac9d87a55edb0225e6b2f6ab4940

3 years agoFixes: #5151
jonathan vanasco [Mon, 27 Sep 2021 19:53:03 +0000 (15:53 -0400)] 
Fixes: #5151
document `listen=True` on `before_create`

Change-Id: I0804ee073044d879eb0decafeb1b358741d69f02

3 years agorepair pg8000 changelogs; state that python 2 was dropped
Mike Bayer [Mon, 27 Sep 2021 17:39:35 +0000 (13:39 -0400)] 
repair pg8000 changelogs; state that python 2 was dropped

Change-Id: I3970682d5d7bede56618d722d9068e3998bc6560
References: #7010

3 years agoFix typo introduced in #3086/I44c1a021a3e7ab7d66fea2d79a36cb2195a1969d
jonathan vanasco [Mon, 27 Sep 2021 14:13:56 +0000 (10:13 -0400)] 
Fix typo introduced in #3086/I44c1a021a3e7ab7d66fea2d79a36cb2195a1969d

Thank you @lelit

Change-Id: I98e8e0fca25d6de6c7fa6c8c0ee429e80b14c102

3 years agoFixes: #7051
jonathan vanasco [Thu, 23 Sep 2021 15:22:37 +0000 (11:22 -0400)] 
Fixes: #7051
Update documentation regarding callproc and functions/stored procedures.

Change-Id: I47bc6ec648d11604a1b1a8e4ad4581cc7612b953

3 years agoFixes: #3086
jonathan vanasco [Thu, 23 Sep 2021 20:15:27 +0000 (16:15 -0400)] 
Fixes: #3086
show that `server_defaults` can accept contextually valid SQLAlchemy expressions or constructs

Change-Id: I44c1a021a3e7ab7d66fea2d79a36cb2195a1969d

3 years agoVersion 1.4.26 placeholder
Mike Bayer [Thu, 23 Sep 2021 01:58:05 +0000 (21:58 -0400)] 
Version 1.4.26 placeholder

3 years ago- 1.4.25 rel_1_4_25
Mike Bayer [Thu, 23 Sep 2021 01:51:25 +0000 (21:51 -0400)] 
- 1.4.25

3 years agoedits
Mike Bayer [Thu, 23 Sep 2021 01:50:32 +0000 (21:50 -0400)] 
edits

Change-Id: I8227dd30b037b405872c7fb4959c225e47fe0be1

3 years agoPlatform_machine names for greenlet check
JAMES.DOW [Wed, 22 Sep 2021 21:04:19 +0000 (17:04 -0400)] 
Platform_machine names for greenlet check

Fixed regression due to #7024 where the reorganization of the "platform
machine" names for greenlet dependency mis-spelled "aarch64" and
additionally omitted uppercase "AMD64" as is needed for windows machines.
Pull request courtesy James Dow.

Fixes: #7024
Closes: #7069
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7069
Pull-request-sha: dbd7419e21d2eb96a02b34a7f41de8a0382be559

Change-Id: Ia2793376a8fbb71d9b5b02fdc955dddbc0a0e80e

3 years agoVersion 1.4.25 placeholder
Mike Bayer [Wed, 22 Sep 2021 15:26:12 +0000 (11:26 -0400)] 
Version 1.4.25 placeholder

3 years ago- 1.4.24 rel_1_4_24
Mike Bayer [Wed, 22 Sep 2021 15:18:00 +0000 (11:18 -0400)] 
- 1.4.24

3 years agochangelog, doc edits
Mike Bayer [Wed, 22 Sep 2021 15:16:04 +0000 (11:16 -0400)] 
changelog, doc edits

Change-Id: Iafb50de7e28626d9cee755db9c05ac7189b4d963

3 years agoMerge "coerce for multivalues keys"
mike bayer [Wed, 22 Sep 2021 03:25:12 +0000 (03:25 +0000)] 
Merge "coerce for multivalues keys"

3 years agoMerge "implement _all_selected_columns for functionelement"
mike bayer [Wed, 22 Sep 2021 03:19:55 +0000 (03:19 +0000)] 
Merge "implement _all_selected_columns for functionelement"

3 years agoMerge "include setup_joins targets when scanning for FROM objects to clone"
mike bayer [Wed, 22 Sep 2021 03:19:31 +0000 (03:19 +0000)] 
Merge "include setup_joins targets when scanning for FROM objects to clone"

3 years agocoerce for multivalues keys
Mike Bayer [Wed, 22 Sep 2021 02:35:41 +0000 (22:35 -0400)] 
coerce for multivalues keys

Fixed issue where using ORM column expressions as keys in the list of
dictionaries passed to :meth:`_sql.Insert.values` for "multi-valued insert"
would not be processed correctly into the correct column expressions.

Fixes: #7060
Change-Id: I1c4c286c33ea6eeaafba617996828f5c88ff0a1c

3 years agoadd note to "quote" regarding case insensitive table reflection
Mike Bayer [Wed, 22 Sep 2021 01:12:15 +0000 (21:12 -0400)] 
add note to "quote" regarding case insensitive table reflection

this note basically states that the use case requested in
issue #7026 is not supported.  I'm not sure the note is
going to otherwise make sense to  anyone.

Fixes: #7026
Change-Id: Ib7782afc9bc5dc0c43cfab9b1f969a55c43209fe

3 years agoFix order of warnings filters 7062/head
rallyemax [Tue, 21 Sep 2021 22:27:41 +0000 (16:27 -0600)] 
Fix order of warnings filters

The `warnings.filterwarnings` method inserts entries at the front of the filter list, and entries closer to the front of the list override entries later in the list, if both match a particular warning. (See https://docs.python.org/3/library/warnings.html)

The intended behavior is for all `RemovedIn20Warning` warnings to log and continue, except that specific warnings that match the defined regular expressions should be raised as exceptions. To accomplish this intent, the general filter must be inserted before the regular expression special cases.

The original order would work if `warnings.filterwarnings` for the default case were invoked with `append=True`, but the intent of the documentation is for this set of filters to be determinative (i.e. to override any conflicting pre-existing filters that may exist), so `append=True` should not be used.

3 years agoinclude setup_joins targets when scanning for FROM objects to clone
Mike Bayer [Mon, 20 Sep 2021 17:43:21 +0000 (13:43 -0400)] 
include setup_joins targets when scanning for FROM objects to clone

Fixed a two issues where combinations of ``select()`` and ``join()`` when
adapted to form a copy of the element would not completely copy the state
of all column objects associated with subqueries. A key problem this caused
is that usage of the :meth:`_sql.ClauseElement.params` method (which should
probably be moved into a legacy category as it is inefficient and error
prone) would leave copies of the old :class:`_sql.BindParameter` objects
around, leading to issues in correctly setting the parameters at execution
time.

Fixes: #7055
Change-Id: Ib822a978a99561b4402da3fb727b370f5c58210b

3 years agoMerge "Relax the Python version check for `__class_getitem__` tests"
mike bayer [Mon, 20 Sep 2021 19:21:48 +0000 (19:21 +0000)] 
Merge "Relax the Python version check for `__class_getitem__` tests"

3 years agoimplement _all_selected_columns for functionelement
Mike Bayer [Mon, 20 Sep 2021 19:16:56 +0000 (15:16 -0400)] 
implement _all_selected_columns for functionelement

Implemented a method in ``FunctionElement`` that is essentially abstract in
an ancestor class (even though not used), leading to pylint complaints.

Fixes: #7052
Change-Id: Iceeeb332fbb3c7187cd2b1969e2f4233a47136b1

3 years agoclarify "encoding" parameter further
Mike Bayer [Mon, 20 Sep 2021 13:48:57 +0000 (09:48 -0400)] 
clarify "encoding" parameter further

Prevent any reading of this parameter that would omit that it
is not used under Python 3 and in Python 2 is not used very
much either.

Fixes: #7050
Change-Id: Iaf619f1ee164fc58afe710d11627ed6368d74343

3 years agoRemove misplaced apostrophe in tutorial/index.rst (#7043)
JMcB17 [Sun, 19 Sep 2021 16:30:24 +0000 (17:30 +0100)] 
Remove misplaced apostrophe in tutorial/index.rst (#7043)

Citation: http://www.sussex.ac.uk/informatics/punctuation/apostrophe/possessives

3 years agoRelax the Python version check for `__class_getitem__` tests
layday [Sun, 19 Sep 2021 15:58:05 +0000 (11:58 -0400)] 
Relax the Python version check for `__class_getitem__` tests

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

### Description
`__class_getitem__` to support generics was introduced in Python 3.7.
In 3.9 some built-ins were made generic but the functionality
for user-defined classes has been there since 3.7.

### 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!**

Closes: #7049
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7049
Pull-request-sha: 7bd16d416db010e7140313fe326861cc263b8864

Change-Id: I4f45b9585d263636e613cc5c86e710fa31c7d283

3 years agoMerge "pin asyncmy>=0.2.0 and remove cursor close workarounds"
mike bayer [Sat, 18 Sep 2021 14:55:49 +0000 (14:55 +0000)] 
Merge "pin asyncmy>=0.2.0 and remove cursor close workarounds"

3 years agoMerge "Surface driver connection object when using a proxied dialect"
mike bayer [Sat, 18 Sep 2021 14:00:16 +0000 (14:00 +0000)] 
Merge "Surface driver connection object when using a proxied dialect"

3 years agopin asyncmy>=0.2.0 and remove cursor close workarounds
Mike Bayer [Sat, 18 Sep 2021 13:47:34 +0000 (09:47 -0400)] 
pin asyncmy>=0.2.0 and remove cursor close workarounds

Change-Id: I9426e09e4fd21f9c94f3c89b199a7784d33b949f

3 years agoSurface driver connection object when using a proxied dialect
Federico Caselli [Tue, 31 Aug 2021 21:03:18 +0000 (23:03 +0200)] 
Surface driver connection object when using a proxied dialect

Improve the interface used by adapted drivers, like the asyncio ones,
to access the actual connection object returned by the driver.

The :class:`_engine._ConnectionRecord` and
:class:`_engine._ConnectionFairy` now have two new attributes:

* ``dbapi_connection`` always represents a DBAPI compatible
object.  For pep-249 drivers, this is the DBAPI connection as it always
has been, previously accessed under the ``.connection`` attribute.
For asyncio drivers that SQLAlchemy adapts into a pep-249 interface,
the returned object will normally be a SQLAlchemy adaption object
called :class:`_engine.AdaptedConnection`.
* ``driver_connection`` always represents the actual connection object
maintained by the third party pep-249 DBAPI or async driver in use.
For standard pep-249 DBAPIs, this will always be the same object
as that of the ``dbapi_connection``.  For an asyncio driver, it will be
the underlying asyncio-only connection object.

The ``.connection`` attribute remains available and is now a legacy alias
of ``.dbapi_connection``.

Fixes: #6832
Change-Id: Ib72f97deefca96dce4e61e7c38ba430068d6a82e

3 years agoadd attribute sphinx is breaking on
Mike Bayer [Fri, 17 Sep 2021 21:27:46 +0000 (17:27 -0400)] 
add attribute sphinx is breaking on

the hybridmethod internal seems to be confusing
a recent version of sphinx autodoc, add attribute it's searching
for.

Change-Id: I27f671a51f857b62337cc2374bbc87383ae9710d

3 years agovendor asynccontextmanager
Mike Bayer [Fri, 17 Sep 2021 18:34:51 +0000 (14:34 -0400)] 
vendor asynccontextmanager

while we still support python 3.6 vendor a simple version
of this for now in the one place we currently use it.

Change-Id: Ibcfc8b004b17e2ac79f9123ccb76c5eb25243f90

3 years agoMerge "Add `asyncmy` support"
mike bayer [Fri, 17 Sep 2021 17:35:55 +0000 (17:35 +0000)] 
Merge "Add `asyncmy` support"

3 years agoImplement nesting CTE
Eric Masseran [Mon, 13 Sep 2021 17:45:57 +0000 (13:45 -0400)] 
Implement nesting CTE

Added new parameter :meth:`_sql.HasCte.cte.nesting` to the
:class:`_sql.CTE` constructor and :meth:`_sql.HasCTE.cte` method, which
flags the CTE as one which should remain nested within an enclosing CTE,
rather than being moved to the top level of the outermost SELECT. While in
the vast majority of cases there is no difference in SQL functionality,
users have identified various edge-cases where true nesting of CTE
constructs is desirable. Much thanks to Eric Masseran for lots of work on
this intricate feature.

Fixes: #4123
Closes: #6709
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6709
Pull-request-sha: 64ab2f6ea269f2dcf37376a13ea38c48c5226fb6

Change-Id: Ic4dc25ab763af96d96632369e01527d48a654149

3 years agoMerge "References: #5831"
mike bayer [Fri, 17 Sep 2021 15:30:31 +0000 (15:30 +0000)] 
Merge "References: #5831"

3 years agoMerge "use the stack for insert_from_select"
mike bayer [Fri, 17 Sep 2021 15:30:07 +0000 (15:30 +0000)] 
Merge "use the stack for insert_from_select"

3 years agoMerge "test update_nowait - added support in MariaDB-10.3"
mike bayer [Fri, 17 Sep 2021 15:22:21 +0000 (15:22 +0000)] 
Merge "test update_nowait - added support in MariaDB-10.3"

3 years agoAdd `asyncmy` support
long2ice [Thu, 16 Sep 2021 15:08:25 +0000 (11:08 -0400)] 
Add `asyncmy` support

Added initial support for the ``asyncmy`` asyncio database driver for MySQL
and MariaDB. This driver is very new, however appears to be the only
current alternative to the ``aiomysql`` driver which currently appears to
be unmaintained and is not working with current Python versions. Much
thanks to long2ice for the pull request for this dialect.

Fixes: #6993
Closes: #7000
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7000
Pull-request-sha: f7d6c811fc72324a83c8af635bbca8b268b0098e

Change-Id: I4ef54b43334feff7e3a710fc4de6821437f3bb68

3 years agouse the stack for insert_from_select
Mike Bayer [Thu, 16 Sep 2021 17:38:11 +0000 (13:38 -0400)] 
use the stack for insert_from_select

Fixed issue related to new ``add_cte()`` feature where pairing two
"INSERT..FROM SELECT" statements simultaneously would lose track of the two
independent SELECT statements, leading to the wrong SQL.

Fixes: #7036
Change-Id: I90fe47eb203bc5c1ea5810db0edba08250b2b7e6

3 years agoMerge "test_for_update to recognise skip_locked for MariaDB-10.6"
mike bayer [Thu, 16 Sep 2021 15:33:11 +0000 (15:33 +0000)] 
Merge "test_for_update to recognise skip_locked for MariaDB-10.6"

3 years agotest update_nowait - added support in MariaDB-10.3
Daniel Black [Sun, 12 Sep 2021 05:17:50 +0000 (01:17 -0400)] 
test update_nowait - added support in MariaDB-10.3

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

MariaDB supported NOWAIT in 10.3.

ref: https://mariadb.com/kb/en/wait-and-nowait/

This pull request is:

- [X] very trivial test change
- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] 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!**

Closes: #7009
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7009
Pull-request-sha: 4fa750e3d34638be7e9583d849216f6d90ca88fc

Change-Id: I4ee8cf2cf84daf7af3300e6f80671375232fcf02

3 years agoMerge "Fixes: #5289"
mike bayer [Wed, 15 Sep 2021 20:56:38 +0000 (20:56 +0000)] 
Merge "Fixes: #5289"

3 years agoMerge "Fixes: #6930"
mike bayer [Wed, 15 Sep 2021 20:54:25 +0000 (20:54 +0000)] 
Merge "Fixes: #6930"

3 years agoMerge "Fixes: #5596 replace `assert` with ValueError, as assert is optimized away...
mike bayer [Wed, 15 Sep 2021 13:10:22 +0000 (13:10 +0000)] 
Merge "Fixes: #5596 replace `assert` with ValueError, as assert is optimized away by cpython"

3 years agoMerge "Add scalars method to connection and session classes"
mike bayer [Wed, 15 Sep 2021 13:09:41 +0000 (13:09 +0000)] 
Merge "Add scalars method to connection and session classes"

3 years agoFixes: #5596
jonathan vanasco [Wed, 8 Sep 2021 18:19:24 +0000 (14:19 -0400)] 
Fixes: #5596
replace `assert` with ValueError, as assert is optimized away by cpython

Change-Id: I963ec962ee0b03935b4cda76abcf82f71274aba8

3 years agoAdd scalars method to connection and session classes
Miguel Grinberg [Mon, 13 Sep 2021 18:41:13 +0000 (14:41 -0400)] 
Add scalars method to connection and session classes

Added new methods :meth:`_orm.Session.scalars`,
:meth:`_engine.Connection.scalars`, :meth:`_asyncio.AsyncSession.scalars`
and :meth:`_asyncio.AsyncSession.stream_scalars`, which provide a short cut
to the use case of receiving a row-oriented :class:`_result.Result` object
and converting it to a :class:`_result.ScalarResult` object via the
:meth:`_engine.Result.scalars` method, to return a list of values rather
than a list of rows. The new methods are analogous to the long existing
:meth:`_orm.Session.scalar` and :meth:`_engine.Connection.scalar` methods
used to return a single value from the first row only. Pull request
courtesy Miguel Grinberg.

Fixes: #6990
Closes: #6991
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6991
Pull-request-sha: b3e0bb3042c55b0cc5af6a25cb3f31b929f88a47

Change-Id: Ia445775e24ca964b0162c2c8e5ca67dd1e39199f

3 years agoMerge "replace "in" operator with "==" + "or" for greenlet platforms"
mike bayer [Tue, 14 Sep 2021 16:43:01 +0000 (16:43 +0000)] 
Merge "replace "in" operator with "==" + "or" for greenlet platforms"

3 years agoMerge "Ensure str is callect on the URL password."
mike bayer [Tue, 14 Sep 2021 16:42:00 +0000 (16:42 +0000)] 
Merge "Ensure str is callect on the URL password."

3 years agoEnsure str is callect on the URL password.
Federico Caselli [Wed, 8 Sep 2021 20:25:12 +0000 (22:25 +0200)] 
Ensure str is callect on the URL password.

Ensure that ``str()`` is called on the an ``URL.password`` argument,
allowing usage of objects that implement the ``__str__()`` method
as password attributes.
Also clarified that one such object is not appropriate to dynamically
change the password.

Fixes: #6958
Change-Id: Id0690990a64b9e0935537b7b8f5a73efe6a9e3dc

3 years agoreplace "in" operator with "==" + "or" for greenlet platforms
Mike Bayer [Mon, 13 Sep 2021 18:38:02 +0000 (14:38 -0400)] 
replace "in" operator with "==" + "or" for greenlet platforms

Further adjusted the "greenlet" package specifier in setup.cfg to use a
long chain of "or" expressions, so that the comparison of
``platform_machine`` to a specific identifier matches only the complete
string.

Fixes: #7024
Change-Id: I1cd40f5e14c62c21bd2e530ca8e38a5a3d50d353

3 years agotest_update_delete - fix the fixed comment (#7020)
Daniel Black [Sun, 12 Sep 2021 18:46:48 +0000 (04:46 +1000)] 
test_update_delete - fix the fixed comment (#7020)

Spelling Criteria right.

Fixes 3ea321ce22438c5b7450e027d087437474eb4498

Also makes it PEP8 compatible again to be under 80
characters.

3 years agoFix various lib / test / examples typos (#7017)
Kevin Kirsche [Sat, 11 Sep 2021 20:26:59 +0000 (16:26 -0400)] 
Fix various lib / test / examples typos (#7017)

* fix: lib/sqlalchemy/sql/lambdas.py

* fix: lib/sqlalchemy/sql/compiler.py

* fix: lib/sqlalchemy/sql/selectable.py

* fix: lib/sqlalchemy/orm/relationships.py

* fix: lib/sqlalchemy/dialects/mssql/base.py

* fix: lib/sql/test_compiler.py

* fix: lib/sqlalchemy/testing/requirements.py

* fix: lib/sqlalchemy/orm/path_registry.py

* fix: lib/sqlalchemy/dialects/postgresql/psycopg2.py

* fix: lib/sqlalchemy/cextension/immutabledict.c

* fix: lib/sqlalchemy/cextension/resultproxy.c

* fix: ./lib/sqlalchemy/dialects/oracle/cx_oracle.py

* fix: examples/versioned_rows/versioned_rows_w_versionid.py

* fix: examples/elementtree/optimized_al.py

* fix: test/orm/test_attribute.py

* fix: test/sql/test_compare.py

* fix: test/sql/test_type_expression.py

* fix: capitalization in test/dialect/mysql/test_compiler.py

* fix: typos in test/dialect/postgresql/test_reflection.py

* fix: typo in tox.ini comment

* fix: typo in /lib/sqlalchemy/orm/decl_api.py

* fix: typo in test/orm/test_update_delete.py

* fix: self-induced typo

* fix: typo in test/orm/test_query.py

* fix: typos in test/dialect/mssql/test_types.py

* fix: typo in test/sql/test_types.py

3 years agoREADME.unittest container edits mainly mariadb/mysql (#7014)
Daniel Black [Sat, 11 Sep 2021 20:22:47 +0000 (06:22 +1000)] 
README.unittest container edits mainly mariadb/mysql (#7014)

Simplify it a bit:

* test_schema2 isn't needed in MySQL/MariaDB test.
* Only permissions on test_schema are needed.
* User without qualification defaults to user@'%'.
* Use MARIADB_* names with MariaDB container that has
  been there most of this year in releases.
* We don't need to specify a database on connection
  when creating users/databases.
* On all containers - docker will always pull image
  if not available. Also postgres image didn't match
  container initialization.
* Remove container versions, just use latest

3 years agoFix documentation mistake (#7018)
owgreen [Sat, 11 Sep 2021 20:04:31 +0000 (05:04 +0900)] 
Fix documentation mistake (#7018)

3 years agoMerge "ignore and warn for native_enum=False with pg.ENUM datatype"
mike bayer [Fri, 10 Sep 2021 15:58:43 +0000 (15:58 +0000)] 
Merge "ignore and warn for native_enum=False with pg.ENUM datatype"

3 years agoignore and warn for native_enum=False with pg.ENUM datatype
Mike Bayer [Tue, 30 Mar 2021 19:22:01 +0000 (15:22 -0400)] 
ignore and warn for native_enum=False with pg.ENUM datatype

any UPPERCASE datatype refers to that exact type name rendered
on the database.   So PG's ENUM must render "ENUM" and is
"native" by definition.  warn if this flag is passed.

The :class:`_postgresql.ENUM` datatype is PostgreSQL-native and therefore
should not be used with the ``native_enum=False`` flag. This flag is now
ignored if passed to the :class:`_postgresql.ENUM` datatype and a warning
is emitted; previously the flag would cause the type object to fail to
function correctly.

Fixes: #6106
Change-Id: I08e0ec6fcfafd068e1eaf6aec13c8010f09ce94a

3 years agoMerge "Modernize tests - remaining DML"
mike bayer [Fri, 10 Sep 2021 14:22:05 +0000 (14:22 +0000)] 
Merge "Modernize tests - remaining DML"

3 years agoMerge "turn off deduping for col expressions"
mike bayer [Fri, 10 Sep 2021 14:21:42 +0000 (14:21 +0000)] 
Merge "turn off deduping for col expressions"

3 years agobulk_save->return_defaults does not populate server defaults
Mike Bayer [Fri, 10 Sep 2021 14:07:15 +0000 (10:07 -0400)] 
bulk_save->return_defaults does not populate server defaults

it fetches them but doesn't put them on the objects, which
is likely a bug, however i have no intention of working
on the bulk methods.   Add more documentation to strongly
discourage these methods in favor of more explicit bulk
approaches, e.g. using an insert() construct directly.

Fixes: #6273
Change-Id: I83eac9319f4e35111302cc81471ecaf19514ce86

3 years agofix mysql-connector-python dep
Mike Bayer [Fri, 10 Sep 2021 13:47:37 +0000 (09:47 -0400)] 
fix mysql-connector-python dep

Fixes: #7012
Change-Id: Ie4e32a9c0f084bfeb10dbecf021db0b70208379a

3 years agodocument placement of declarative init method
Mike Bayer [Fri, 10 Sep 2021 13:42:11 +0000 (09:42 -0400)] 
document placement of declarative init method

Fixes: #7013
Fixes: #7015
Change-Id: Iba7eb8aeb37cec08e1bd1edcf28e05b02004afe7

3 years agoFix typo (#6994)
Yutian Li [Wed, 8 Sep 2021 19:16:22 +0000 (15:16 -0400)] 
Fix typo (#6994)

3 years agofix: typos in doc/build/tutorial (#7005)
Kevin Kirsche [Wed, 8 Sep 2021 19:14:56 +0000 (15:14 -0400)] 
fix: typos in doc/build/tutorial (#7005)

3 years agofix: typos in doc/build/changelog (#7004)
Kevin Kirsche [Wed, 8 Sep 2021 19:14:50 +0000 (15:14 -0400)] 
fix: typos in doc/build/changelog (#7004)

3 years agofix: typos in doc/build/core and doc/build/errors (#7006)
Kevin Kirsche [Wed, 8 Sep 2021 19:14:43 +0000 (15:14 -0400)] 
fix: typos in doc/build/core and doc/build/errors (#7006)

3 years agofix: typos in doc/build/orm (#7003)
Kevin Kirsche [Wed, 8 Sep 2021 19:14:31 +0000 (15:14 -0400)] 
fix: typos in doc/build/orm (#7003)

* fix: typos in doc/build/orm

* though -> through

Change-Id: I785336056497a4ac17f2d494f6d9cf913c12b024

Co-authored-by: Federico Caselli <cfederico87@gmail.com>
3 years agoReferences: #5831
jonathan vanasco [Wed, 8 Sep 2021 17:27:20 +0000 (13:27 -0400)] 
References: #5831

Add a note to docs regarding future session under asyncio

Change-Id: Ib152be833dcb8ea46217e761a715f639859133c6

3 years agoFixes: #5289
jonathan vanasco [Wed, 8 Sep 2021 16:50:10 +0000 (12:50 -0400)] 
Fixes: #5289
Clarify Foreign Key support on SQLite must be enabled before `MetaData.create_all`

Change-Id: Ic41b86f736be21dd6fc890a915a2ffd572df73a4

3 years agoFixes: #6930
jonathan vanasco [Wed, 8 Sep 2021 16:39:02 +0000 (12:39 -0400)] 
Fixes: #6930
Note in docstrings that ignored kwargs are required for API conformance.

Change-Id: Icc9a8c63c0936a7c5255841ef49d10a83496763a