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

4 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"

4 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

4 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

4 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

4 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"

4 years agoEnable tests of fetch/offset for mariadb>=10.6
Federico Caselli [Mon, 4 Oct 2021 15:59:42 +0000 (17:59 +0200)] 
Enable tests of fetch/offset for mariadb>=10.6

Fixes: #6999
Change-Id: I29cf3908a6c872611409a3e7256296314c81dea1

4 years agoMerge "Add autocommit documentation for Azure SQL DW"
mike bayer [Wed, 6 Oct 2021 15:08:19 +0000 (15:08 +0000)] 
Merge "Add autocommit documentation for Azure SQL DW"

4 years agoMerge "Bugfix: MySQL expression: may be bindparam or other expression"
mike bayer [Tue, 5 Oct 2021 23:37:30 +0000 (23:37 +0000)] 
Merge "Bugfix: MySQL  expression:  may be bindparam or other expression"

4 years agoMerge "fix(6435): support `MemberExpr` for enum column declaration"
mike bayer [Tue, 5 Oct 2021 22:46:16 +0000 (22:46 +0000)] 
Merge "fix(6435): support `MemberExpr` for enum column declaration"

4 years agoMerge "Handle SSL SYSCALL error: Bad Address in postgresql/pyscopg2"
mike bayer [Tue, 5 Oct 2021 22:45:29 +0000 (22:45 +0000)] 
Merge "Handle SSL SYSCALL error: Bad Address in postgresql/pyscopg2"

4 years agoBugfix: MySQL expression: may be bindparam or other expression
Anton Kovalevich [Tue, 5 Oct 2021 22:16:02 +0000 (18:16 -0400)] 
Bugfix: MySQL  expression:  may be bindparam or other expression

Fixed issue in MySQL :func:`_mysql.match` construct where passing a clause
expression such as :func:`_sql.bindparam` or other SQL expression for the
"against" parameter would fail. Pull request courtesy Anton Kovalevich.

Fixes: #7144
Closes: #7145
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7145
Pull-request-sha: 3757ffa51a3ff5919278165aaf906c8d2f9940c0

Change-Id: I7bb95f338afe3a17296a7b60e8c973f93b4f5e62

4 years agofix paragraphs that didn't get completed
Mike Bayer [Tue, 5 Oct 2021 22:31:12 +0000 (18:31 -0400)] 
fix paragraphs that didn't get completed

Change-Id: I6190f579b021f5476632ed1f471aa612ae1aec1a

4 years agofix(6435): support `MemberExpr` for enum column declaration
Hiroshi Ogawa [Fri, 1 Oct 2021 22:59:22 +0000 (18:59 -0400)] 
fix(6435): support `MemberExpr` for enum column declaration

Fixed issue in mypy plugin to improve upon some issues detecting ``Enum()``
SQL types containing custom Python enumeration classes. Pull request
courtesy Hiroshi Ogawa.

Fixes: #6435
Closes: #7048
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7048
Pull-request-sha: 59f5c89688792f6af3b07488d5cf97f8f2e964dc

Change-Id: I05adbec74ceac1ecfdc5a242bfe7aa4b2eb805e4

4 years agoHandle SSL SYSCALL error: Bad Address in postgresql/pyscopg2
Zeke Brechtel [Sat, 25 Sep 2021 18:43:28 +0000 (14:43 -0400)] 
Handle SSL SYSCALL error: Bad Address in postgresql/pyscopg2

Added a "disconnect" condition for the "SSL SYSCALL error: Bad address"
error message as reported by psycopg2. Pull request courtesy Zeke Brechtel.

Fixes: #5387
Closes: #7087
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7087
Pull-request-sha: 66af76a107a22d9119edc8edcacc1e4ef66dc50d

Change-Id: Ia4afc9683b8175a8ca282e07e0f83c65657544ab

4 years agoAdd new section clarifying DBAPI autocommit more fully
Mike Bayer [Tue, 5 Oct 2021 15:46:54 +0000 (11:46 -0400)] 
Add new section clarifying DBAPI autocommit more fully

Make sure it's documented that autocommit isolation level
is not a connection-level setting, and does not interact with
the connection's notion of a transaction.

Fixes: #7141
Change-Id: Iefc580798551d74022ee2cfe102c22440b7d2f98

4 years agoMerge "disallow adding to identity map that's been discarded"
mike bayer [Mon, 4 Oct 2021 22:11:28 +0000 (22:11 +0000)] 
Merge "disallow adding to identity map that's been discarded"

4 years agoMerge "Warn when trying to execute a query object with a session."
mike bayer [Mon, 4 Oct 2021 22:10:36 +0000 (22:10 +0000)] 
Merge "Warn when trying to execute a query object with a session."

4 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`

4 years agodisallow adding to identity map that's been discarded
Mike Bayer [Fri, 1 Oct 2021 22:04:46 +0000 (18:04 -0400)] 
disallow adding to identity map that's been discarded

Fixed bug where iterating a :class:`.Result` from a :class:`_orm.Session`
after that :class:`_orm.Session` were closed would partially attach objects
to that session in an essentially invalid state.   It now raises an exception
with a link to new documentation if an **un-buffered** result is iterated
from a :class:`_orm.Session` that was closed or otherwise had the
:meth:`_orm.Session.expunge_all` method called after that :class:`.Result`
was generated.  The "prebuffer_rows" execution option, as is used by the
asyncio extension, may be used to produce a :class:`.Result` where the ORM
objects are prebuffered, and in this case iterating the result will produce
a series of detached objects.

Fixes: #7128
Change-Id: I59f0ae32a83a64587937741b80f31ff825bbb574

4 years agoWarn when trying to execute a query object with a session.
Federico Caselli [Fri, 1 Oct 2021 20:16:14 +0000 (22:16 +0200)] 
Warn when trying to execute a query object with a session.

Passing a :class:`.Query` object to :meth:`_orm.Session.execute` is not
the intended use of this object, and will now raise a deprecation warning.

Fixes: #6284
Change-Id: I30a406d5a72335f9405f10f0a2030a32ccda41b9

4 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

4 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

4 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"

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

4 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."

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

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

4 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

4 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

4 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"

4 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

4 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

4 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

4 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

4 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

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

4 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

4 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

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

Change-Id: Ie529ceb3551adedf0df873c22e65f8615cd1c9ef

4 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

4 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

4 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

4 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"

4 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

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

4 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

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

4 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

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

4 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

4 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

4 years agoAdd autocommit documentation for Azure SQL DW
Gord Thompson [Fri, 24 Sep 2021 15:10:55 +0000 (09:10 -0600)] 
Add autocommit documentation for Azure SQL DW

Fixes: #7065
Change-Id: I3666e16f9a8c47f9784ea11f38972cda6b08c146

4 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

4 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

4 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

4 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

4 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

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

4 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

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

Change-Id: I8227dd30b037b405872c7fb4959c225e47fe0be1

4 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

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

4 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

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

Change-Id: Iafb50de7e28626d9cee755db9c05ac7189b4d963

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

4 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"

4 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"

4 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

4 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

4 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.

4 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

4 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"

4 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

4 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

4 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

4 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

4 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"

4 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"

4 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

4 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

4 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

4 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

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

4 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

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

4 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"

4 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"

4 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

4 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

4 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"

4 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

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