]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agosimplify relationship caching options
Mike Bayer [Tue, 8 Jun 2021 19:43:13 +0000 (15:43 -0400)] 
simplify relationship caching options

Clarified the current purpose of the
:paramref:`_orm.relationship.bake_queries` flag, which in 1.4 is to enable
or disable "lambda caching" of statements within the "lazyload" and
"selectinload" loader strategies; this is separate from the more
foundational SQL query cache that is used for most statements.
Additionally, the lazy loader no longer uses its own cache for many-to-one
SQL queries, which was an implementation quirk that doesn't exist for any
other loader scenario. Finally, the "lru cache" warning that the lazyloader
and selectinloader strategies could emit when handling a wide array of
class/relationship combinations has been removed; based on analysis of some
end-user cases, this warning doesn't suggest any significant issue. While
setting ``bake_queries=False`` for such a relationship will remove this
cache from being used, there's no particular performance gain in this case
as using no caching vs. using a cache that needs to refresh often likely
still wins out on the caching being used side.

Fixes: #6072
Fixes: #6487
Change-Id: Ida61f09b837d3acdafa07344d7d747d7f3ab226a

4 years agoMerge "restore adapter logic in ORM loading"
mike bayer [Tue, 8 Jun 2021 18:00:44 +0000 (18:00 +0000)] 
Merge "restore adapter logic in ORM loading"

4 years agorestore adapter logic in ORM loading
Mike Bayer [Mon, 7 Jun 2021 22:49:04 +0000 (18:49 -0400)] 
restore adapter logic in ORM loading

Fixed regression involving how the ORM would resolve a given mapped column
to a result row, where under cases such as joined eager loading, a slightly
more expensive "fallback" could take place to set up this resolution due to
some logic that was removed since 1.3. The issue could also cause
deprecation warnings involving column resolution to be emitted when using a
1.4 style query with joined eager loading.

In order to ensure we don't look up columns by string name in the ORM,
we've turned on future_result=True in all cases, which I thought was
already the assumption here, but apparently not.    That in turn
led to the issue that Session autocommit relies on close_with_result=True,
which is legacy result only.   This was also hard to figure out.
So a new exception is raised if one tries to use future_result=True
along with close_with_result, and the Session now has an explicit path
for "autocommit" that sets these flags to their legacy values.

This does leave the possibility of some of these fallback cases
emitting warnings for users using session in autocommit along with
joined inheritance and column properties, as this patch identifies
that joined inheritance + column properties produce the fallback
logic when looking up in the result via the adapted column, which
in those tests is actually a Label object that doesn't adapt
nicely.

Fixes: #6596
Change-Id: I107a47e873ae05ab50853bb00a9ea0e1a88d5aee

4 years agoMerge "Add note regarding encryption-related pragmas passed in the url in pysqlcipher."
mike bayer [Tue, 8 Jun 2021 13:12:52 +0000 (13:12 +0000)] 
Merge "Add note regarding encryption-related pragmas passed in the url in pysqlcipher."

4 years agoMerge "repair Join.is_derived_from() to not rely on simple identity"
mike bayer [Tue, 8 Jun 2021 13:07:19 +0000 (13:07 +0000)] 
Merge "repair Join.is_derived_from() to not rely on simple identity"

4 years agorepair Join.is_derived_from() to not rely on simple identity
Mike Bayer [Mon, 7 Jun 2021 21:47:07 +0000 (17:47 -0400)] 
repair Join.is_derived_from() to not rely on simple identity

Fixed issue where query production for joinedload against a complex left
hand side involving joined-table inheritance could fail to produce a
correct query, due to a clause adaption issue.

Fixes: #6595
Change-Id: Id4b839d52447cdc103b392dd8946c4cfa7a829e1

4 years agoAdd note regarding encryption-related pragmas
Federico Caselli [Mon, 7 Jun 2021 19:14:05 +0000 (21:14 +0200)] 
Add note regarding encryption-related pragmas
passed in the url in pysqlcipher.

Fixes: #6589
Change-Id: I86f93f84ef2bd374c4832a70e26e4901d024ed4b

4 years agoAdd asyncio.TimeoutError as an exit exception
Mike Bayer [Mon, 7 Jun 2021 15:28:49 +0000 (11:28 -0400)] 
Add asyncio.TimeoutError as an exit exception

Added ``asyncio.exceptions.TimeoutError``,
``asyncio.exceptions.CancelledError`` as so-called "exit exceptions", a
class of exceptions that include things like ``GreenletExit`` and
``KeyboardInterrupt``, which are considered to be events that warrant
considering a DBAPI connection to be in an unusable state where it should
be recycled.

Fixes: #6592
Change-Id: Idcfa7aaa2d7660838b907388db9c6457afa6edbd

4 years agoinit extra_criteria_entities in fromstatement w/ DML
Mike Bayer [Mon, 7 Jun 2021 13:21:25 +0000 (09:21 -0400)] 
init extra_criteria_entities in fromstatement w/ DML

Fixed issue in experimental "select ORM objects from INSERT/UPDATE" use
case where an error was raised if the statement were against a
single-table-inheritance subclass.

Additionally makes some adjustments in the SQL assertion
fixture to test a FromStatement w/ DML.

Fixes: #6591
Change-Id: I53a627ab18a01dc6d9b5037e28312a1177891327

4 years agoMerge "Pass URL object, not the string, to on_connect_url"
mike bayer [Sun, 6 Jun 2021 15:15:56 +0000 (15:15 +0000)] 
Merge "Pass URL object, not the string, to on_connect_url"

4 years agoPass URL object, not the string, to on_connect_url
Mike Bayer [Sun, 6 Jun 2021 14:12:05 +0000 (10:12 -0400)] 
Pass URL object, not the string, to on_connect_url

The fix for pysqlcipher released in version 1.4.3 :ticket:`5848` was
unfortunately non-working, in that the new ``on_connect_url`` hook was
erroneously not receiving a ``URL`` object under normal usage of
:func:`_sa.create_engine` and instead received a string that was unhandled;
the test suite failed to fully set up the actual conditions under which
this hook is called. This has been fixed.

Fixes: #6586
Change-Id: I3bf738daec35877a10fdad740f08dca9e7420829

4 years agodon't enable "fast insert executemany" for ON CONFLICT etc
Mike Bayer [Fri, 4 Jun 2021 23:45:45 +0000 (19:45 -0400)] 
don't enable "fast insert executemany" for ON CONFLICT etc

Fixed issue where using the PostgreSQL "INSERT..ON CONFLICT" structure
would fail to work with the psycopg2 driver if it were used in an
"executemany" context along with bound parameters in the "SET" clause, due
to the implicit use of the psycopg2 fast execution helpers which are not
appropriate for this style of INSERT statement. Additional checks to
exclude this kind of statement from that particular extension have been
added.

Fixes: #6581
Change-Id: I3d6169e7e188dc087d1d1bfba9a42162db183265

4 years agoAdd missing method :meth:`_engine.Row._asdict`.
Federico Caselli [Fri, 4 Jun 2021 19:53:25 +0000 (21:53 +0200)] 
Add missing method :meth:`_engine.Row._asdict`.

Fixes: #6582
Change-Id: I3267bfa3c22b822dc2f2b7d06e7cb1a5ddc6cdc9

4 years agoAdjust create_proxy_methods() to use kw arguments
Mike Bayer [Thu, 3 Jun 2021 13:37:27 +0000 (09:37 -0400)] 
Adjust create_proxy_methods() to use kw arguments

Adjusted the means by which classes such as :class:`_orm.scoped_session`
and :class:`_asyncio.AsyncSession` are generated from the base
:class:`_orm.Session` class, such that custom :class:`_orm.Session`
subclasses such as that used by Flask-SQLAlchemy don't need to implement
positional arguments when they call into the superclass method, and can
continue using the same argument styles as in previous releases.

Fixes: #6285
References: https://github.com/pallets/flask-sqlalchemy/issues/953
Change-Id: I8612ab33743625e70eb158efceb0636d783c92a5

4 years agoMerge "Implement proxy back reference system for asyncio"
mike bayer [Thu, 3 Jun 2021 13:19:40 +0000 (13:19 +0000)] 
Merge "Implement proxy back reference system for asyncio"

4 years agodelete exception traceback in _expect_raises
Mike Bayer [Thu, 3 Jun 2021 03:07:28 +0000 (23:07 -0400)] 
delete exception traceback in _expect_raises

a new segfault is observed in python 3.10.0b2 in conjunction
with asyncio and possibly greenlet.   Ensuring the
traceback object is deleted from scope here, which is a
good idea anyway, apparently seems to resolve the issue.

Change-Id: Ia83bafb088ef19853044f1d436db259cbfd1e5f4
References: https://github.com/python-greenlet/greenlet/issues/242

4 years agotemporarily disable test_no_attach_to_event_loop
Mike Bayer [Wed, 2 Jun 2021 22:24:43 +0000 (18:24 -0400)] 
temporarily disable test_no_attach_to_event_loop

this test currently causes the test suite to hang; it previously
was not actually running the worker thread
as the testing_engine() fixture
was rejecting the "transfer_staticpool" keyword argument.

as we seem to have a greenlet-related segfault in 3.10.0b2 I am
going to have to get the greenlet devs to run the test suite
so i want to get anything not totally smooth out of it for the
moment.

Change-Id: Ib453d0bc23ca013598bc80ff29e5da496771d5b1

4 years agoImplement proxy back reference system for asyncio
Mike Bayer [Wed, 2 Jun 2021 16:23:31 +0000 (12:23 -0400)] 
Implement proxy back reference system for asyncio

Implemented a new registry architecture that allows the ``Async`` version
of an object, like ``AsyncSession``, ``AsyncConnection``, etc., to be
locatable given the proxied "sync" object, i.e. ``Session``,
``Connection``. Previously, to the degree such lookup functions were used,
an ``Async`` object would be re-created each time, which was less than
ideal as the identity and state of the "async" object would not be
preserved across calls.

From there, new helper functions :func:`_asyncio.async_object_session`,
:func:`_asyncio.async_session` as well as a new :class:`_orm.InstanceState`
attribute :attr:`_orm.InstanceState.asyncio_session` have been added, which
are used to retrieve the original :class:`_asyncio.AsyncSession` associated
with an ORM mapped object, a :class:`_orm.Session` associated with an
:class:`_asyncio.AsyncSession`, and an :class:`_asyncio.AsyncSession`
associated with an :class:`_orm.InstanceState`, respectively.

This patch also implements new methods
:meth:`_asyncio.AsyncSession.in_nested_transaction`,
:meth:`_asyncio.AsyncSession.get_transaction`,
:meth:`_asyncio.AsyncSession.get_nested_transaction`.

Fixes: #6319
Change-Id: Ia452a7e7ce9bad3ff8846c7dea8d45c839ac9fac

4 years agoapply sorting to overlaps message
Mike Bayer [Wed, 2 Jun 2021 19:56:15 +0000 (15:56 -0400)] 
apply sorting to overlaps message

so that string comparison tests are deterministic

Change-Id: Ia072f225fb906ea43c451eb4217856f144932fd2

4 years agoremoving unavailable parameters from documentation 6571/head
Calli Rogers [Wed, 2 Jun 2021 14:26:50 +0000 (10:26 -0400)] 
removing unavailable parameters from documentation

4 years agoMerge "improve "overlaps" warning; test for m2m"
mike bayer [Tue, 1 Jun 2021 21:40:27 +0000 (21:40 +0000)] 
Merge "improve "overlaps" warning; test for m2m"

4 years agoClarify connection arg usage for postgresql
Gord Thompson [Sun, 30 May 2021 20:43:36 +0000 (14:43 -0600)] 
Clarify connection arg usage for postgresql

Change-Id: I417b4d19c2c17a73ba9c95d59f1562ad5dab2d35

4 years agoimprove "overlaps" warning; test for m2m
Mike Bayer [Tue, 1 Jun 2021 20:03:52 +0000 (16:03 -0400)] 
improve "overlaps" warning; test for m2m

The warning that's emitted for :func:`_orm.relationship` when multiple
relationships would overlap with each other as far as foreign key
attributes written towards, now includes the specific "overlaps" argument
to use for each warning in order to silence the warning without changing
the mapping.

Fixes: #6400
Change-Id: I43c04f8018dda4e0f83ae58b8c7fd95084d9e95d

4 years agoVersion 1.4.18 placeholder
Mike Bayer [Sat, 29 May 2021 20:23:02 +0000 (16:23 -0400)] 
Version 1.4.18 placeholder

4 years ago- 1.4.17 rel_1_4_17
Mike Bayer [Sat, 29 May 2021 20:14:52 +0000 (16:14 -0400)] 
- 1.4.17

4 years agoMerge "Remove pytest warning filter"
mike bayer [Sat, 29 May 2021 18:50:12 +0000 (18:50 +0000)] 
Merge "Remove pytest warning filter"

4 years agoskip dupe order by test on mssql
Mike Bayer [Sat, 29 May 2021 15:05:25 +0000 (11:05 -0400)] 
skip dupe order by test on mssql

SQL Server wants to complain if ORDER BY specifies the same
expression more than once, so just skip this test added in
aaba0650d7410f579b2c14f8f1b0680a1d1852c4 as this only needs
to test ORM functionality.

Change-Id: I857746771ed9c661043d7a8661efe9f47449c466

4 years agoEnsure propagate_attrs available on PropComparator
Mike Bayer [Sat, 29 May 2021 14:05:20 +0000 (10:05 -0400)] 
Ensure propagate_attrs available on PropComparator

Fixed regression caused by just-released performance fix mentioned in #6550
where a query.join() to a relationship could produce an AttributeError if
the query were made against non-ORM structures only, a fairly unusual
calling pattern.

In this fix, since we are no longer going through the production
of ``__clause_element__()`` for Cls.some_relationship, I assumed we
just throw this object away completely but I missed the one little
bit where we might be getting ``_propagate_attrs`` from it.
So we implement ``_propagate_attrs`` on ``PropComparator`` as well,
since this is easy to define.

Fixes: #6558
Change-Id: If781bf844e7e3d3b0841aff1c3668e9d6af9f097

4 years agoRemove pytest warning filter
Federico Caselli [Fri, 28 May 2021 19:18:51 +0000 (21:18 +0200)] 
Remove pytest warning filter

Change-Id: Ie18b66e4a8d59be12ee549347bd508036282c1c9

4 years agoVersion 1.4.17 placeholder
Mike Bayer [Fri, 28 May 2021 17:17:17 +0000 (13:17 -0400)] 
Version 1.4.17 placeholder

4 years ago- 1.4.16 rel_1_4_16
Mike Bayer [Fri, 28 May 2021 17:05:23 +0000 (13:05 -0400)] 
- 1.4.16

4 years agoMerge "Fix adaption in AnnotatedLabel; repair needless expense in coercion"
mike bayer [Fri, 28 May 2021 16:38:50 +0000 (16:38 +0000)] 
Merge "Fix adaption in AnnotatedLabel; repair needless expense in coercion"

4 years agoMerge "Test some complex update cases in the pg dialect"
mike bayer [Fri, 28 May 2021 14:57:40 +0000 (14:57 +0000)] 
Merge "Test some complex update cases in the pg dialect"

4 years agoMerge "Make other loop test compatible with py3.10"
mike bayer [Fri, 28 May 2021 14:57:18 +0000 (14:57 +0000)] 
Merge "Make other loop test compatible with py3.10"

4 years agoFix adaption in AnnotatedLabel; repair needless expense in coercion
Mike Bayer [Fri, 28 May 2021 12:29:24 +0000 (08:29 -0400)] 
Fix adaption in AnnotatedLabel; repair needless expense in coercion

Fixed regression involving clause adaption of labeled ORM compound
elements, such as single-table inheritance discriminator expressions with
conditionals or CASE expressions, which could cause aliased expressions
such as those used in ORM join / joinedload operations to not be adapted
correctly, such as referring to the wrong table in the ON clause in a join.

This change also improves a performance bump that was located within the
process of invoking :meth:`_sql.Select.join` given an ORM attribute
as a target.

Fixes: #6550
Change-Id: I98906476f0cce6f41ea00b77c789baa818e9d167

4 years agoensure relationship.order_by stored as a tuple; check in dynamic also
Mike Bayer [Fri, 28 May 2021 01:15:01 +0000 (21:15 -0400)] 
ensure relationship.order_by stored as a tuple; check in dynamic also

Fixed regression in dynamic loader strategy and :func:`_orm.relationship`
overall where the :paramref:`_orm.relationship.order_by` parameter were
stored as a mutable list, which could then be mutated when combined with
additional "order_by" methods used against the dynamic query object,
causing the ORDER BY criteria to continue to grow repetitively.

Fixes: #6549
Change-Id: I9f4c9a723aa0923f115cbe39bfaaa9cac62153b1

4 years agoMake other loop test compatible with py3.10
Federico Caselli [Thu, 27 May 2021 20:51:40 +0000 (22:51 +0200)] 
Make other loop test compatible with py3.10

Python 3.10 fixes the issue where the loop would bind to a queue
on instantiation. Now an object binds to the loop only when first
needs it. I've looked at queues, but I'm assuming locks behave
the same,

Change-Id: Ibb8d263cdea230e9c85709528c21da31d0df2e65

4 years agoAdd python 3.10 to github pipeline
Federico Caselli [Thu, 13 May 2021 19:59:12 +0000 (21:59 +0200)] 
Add python 3.10 to github pipeline

Change-Id: Iaa5c3ec2ad2bf70da412cc79871d22b7ea3bf9a6

4 years agoTest some complex update cases in the pg dialect
Federico Caselli [Tue, 25 May 2021 20:48:54 +0000 (22:48 +0200)] 
Test some complex update cases in the pg dialect

Change-Id: I2323e155e78aa8e1e00359b103974fb8d27d80eb

4 years agoget tests to pass on python 3.10
Mike Bayer [Wed, 26 May 2021 17:46:36 +0000 (13:46 -0400)] 
get tests to pass on python 3.10

Resolved various deprecation warnings which were appearing as of Python
version 3.10.0b1.

block aiomysql on python 3.10 as they are using the "loop" argument
that's removed

sqlcipher-binary has no builds on 3.10, block it for 3.10

Fixes: #6540
Fixes: #6543
Change-Id: Iec1e3881fb289878881ae043b1a18c3ecdf5f077

4 years agocx_oracle has changed main branch to "main"
Mike Bayer [Wed, 26 May 2021 16:55:41 +0000 (12:55 -0400)] 
cx_oracle has changed main branch to "main"

Change-Id: Idabb86665182af6c3d2cfb7b5c4ebd2cbc99c565

4 years agoremove outdated integrityerror example
Mike Bayer [Wed, 26 May 2021 16:13:30 +0000 (12:13 -0400)] 
remove outdated integrityerror example

Fixes: #5372
Change-Id: Ibf7c9969be543e38cd0c4773c413f085a57d94ab

4 years agoMerge "Removed automap deprecation warning"
Federico Caselli [Wed, 26 May 2021 06:07:50 +0000 (06:07 +0000)] 
Merge "Removed automap deprecation warning"

4 years agoRemoved automap deprecation warning
jason3gb [Tue, 25 May 2021 19:40:48 +0000 (15:40 -0400)] 
Removed automap deprecation warning

Fixed a deprecation warning that was emitted when using
:func:`_automap.automap_base` without passing an existing
``Base``.

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

### Description
Fixed the automap's declarative import from sqlalchemy.orm instead from the deprecated ext.declarative package

### 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: #6533
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6533
Pull-request-sha: 46d40005eae51fd7423da66f6ad4072f65744c1c

Change-Id: I432df70d4221873ca229076d5d3ac20b2870c13b

4 years agofix typo in"Connecting to databases with access tokens" (#6432)
Katsuyuki Sakai [Tue, 25 May 2021 19:51:53 +0000 (04:51 +0900)] 
fix typo in"Connecting to databases with access tokens" (#6432)

4 years agoFix minor glitches in the visitors.py docstrings (#6522)
Lele Gaifax [Tue, 25 May 2021 19:51:44 +0000 (21:51 +0200)] 
Fix minor glitches in the visitors.py docstrings (#6522)

* Fix docstring typo

* Capitalize first sentence word

* Properly markup class name

This is just for consistency with nearby references: the HasCacheKey class has no docstring so
it does not appear in the documentation, moreover it's in the traversals module, so Sphinx
cannot render it as a link anyway.

4 years agoAdd a template for use case
Mike Bayer [Tue, 25 May 2021 18:37:12 +0000 (14:37 -0400)] 
Add a template for use case

These are distinct from features.

Change-Id: I97caa25c94bdd71a3dd227614d03c3891cea5e87

4 years agoput bug guidelines in html comment
Mike Bayer [Tue, 25 May 2021 18:32:45 +0000 (14:32 -0400)] 
put bug guidelines in html comment

Change-Id: I3659b20f93a5059029176cc16c2ae4a3fde7c72e

4 years agoMerge "Provide primary key values for data in tests that aren't about primary keys."
mike bayer [Mon, 24 May 2021 18:17:11 +0000 (18:17 +0000)] 
Merge "Provide primary key values for data in tests that aren't about primary keys."

4 years agoMerge "URL parsing fixes"
mike bayer [Mon, 24 May 2021 18:16:01 +0000 (18:16 +0000)] 
Merge "URL parsing fixes"

4 years agoMerge "Add SSL connection info for psycopg2 and pg8000"
mike bayer [Mon, 24 May 2021 17:36:00 +0000 (17:36 +0000)] 
Merge "Add SSL connection info for psycopg2 and pg8000"

4 years agoProvide primary key values for data in tests that aren't about primary keys.
Jim Fulton [Tue, 18 May 2021 18:09:07 +0000 (14:09 -0400)] 
Provide primary key values for data in tests that aren't about primary keys.

(message written by Mike) some backends such as BigQuery have no
autoincrement mechanism at all.
while we would like to pursue a strategy where provisioning.py could
provide for an in-Python sequence generator, at least remove
the need for autoincrement in suite tests that don't need it.

Fixes: #6469
Closes: #6504
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6504
Pull-request-sha: c075014ef7de33e6eb3f389d24251ba184655e0b

Change-Id: I98e237a38417b68c87d0201717205d7655b1f44e

4 years agoURL parsing fixes
Mike Bayer [Mon, 24 May 2021 15:12:11 +0000 (11:12 -0400)] 
URL parsing fixes

Fixed a long-standing issue with :class:`.URL` where query parameters
following the question mark would not be parsed correctly if the URL did
not contain a database portion with a backslash.

Fixed issue where an ``@`` sign in the database portion of a URL would not
be interpreted correctly if the URL also had a username:password section.

Fixes: #6329
Fixes: #6482
Change-Id: I6cb6478affa49b618335b947a74e64090657a98c

4 years agoClarify close for sync / async session
Mike Bayer [Mon, 24 May 2021 13:59:17 +0000 (09:59 -0400)] 
Clarify close for sync / async session

Add seealso links from Session.close() and AsyncSession.close()
 to narrative description, clarify in both places what the method
does and does not do.

Change-Id: Ib804753a86b4761e5f198c52121e8433c851cbc4
References: #6528

4 years agoAdd SSL connection info for psycopg2 and pg8000
Gord Thompson [Sun, 23 May 2021 23:44:13 +0000 (17:44 -0600)] 
Add SSL connection info for psycopg2 and pg8000

Change-Id: I8ead04dd572f0c0020c226254543eb7d93876ee4

4 years agoMerge "Detect back_populates referring to non-relationship"
mike bayer [Fri, 21 May 2021 15:18:15 +0000 (15:18 +0000)] 
Merge "Detect back_populates referring to non-relationship"

4 years agoDetect back_populates referring to non-relationship
Federico Caselli [Wed, 12 May 2021 19:09:41 +0000 (21:09 +0200)] 
Detect back_populates referring to non-relationship

Change-Id: Ic26d5d6d230d8d3209e6e42ff7752b59b8cb7b28

4 years agoEnsure extended instrumentation is fully disposed
Mike Bayer [Thu, 20 May 2021 15:28:03 +0000 (11:28 -0400)] 
Ensure extended instrumentation is fully disposed

Fixed regression in the ``sqlalchemy.ext.instrumentation`` extension that
prevented instrumentation disposal from working completely. This fix
includes both a 1.4 regression fix as well as a fix for a related issue
that existed in 1.3 also.   As part of this change, the
:class:`sqlalchemy.ext.instrumentation.InstrumentationManager` class now
has a new method ``unregister()``, which replaces the previous method
``dispose()``, which was not called as of version 1.4.

Fixes: #6390
Change-Id: I1b7a0f190b56d31b93b5ba11f67dc9f73889958b

4 years agoMerge "Suggest ``literal_column`` instead of ``text`` for column elements"
mike bayer [Tue, 18 May 2021 12:37:00 +0000 (12:37 +0000)] 
Merge "Suggest ``literal_column`` instead of ``text`` for column elements"

4 years agoMerge "Remove pep484 type comments from the code"
mike bayer [Tue, 18 May 2021 02:15:26 +0000 (02:15 +0000)] 
Merge "Remove pep484 type comments from the code"

4 years agoSuggest ``literal_column`` instead of ``text`` for column elements
Federico Caselli [Thu, 22 Apr 2021 20:12:10 +0000 (22:12 +0200)] 
Suggest ``literal_column`` instead of ``text`` for column elements

the next section in the tutorial discusses literal_column()
already so this paragraph will just add some additional
encouragement to read on.

References: #6343
Change-Id: Iadaf84d80071e73eb2d0b7421a60e1790ecd0862

4 years agoMerge "docs: fix back_populates parameter reference"
mike bayer [Tue, 18 May 2021 02:04:27 +0000 (02:04 +0000)] 
Merge "docs: fix back_populates parameter reference"

4 years agoMerge "Use type_ when creating literals in _LiteralRoundTripFixture"
mike bayer [Tue, 18 May 2021 02:03:39 +0000 (02:03 +0000)] 
Merge "Use type_ when creating literals in _LiteralRoundTripFixture"

4 years agoRun SelectState from obj normalize ahead of calcing ORM joins
Mike Bayer [Mon, 17 May 2021 15:20:10 +0000 (11:20 -0400)] 
Run SelectState from obj normalize ahead of calcing ORM joins

Fixed regression where the full combination of joined inheritance, global
with_polymorphic, self-referential relationship and joined loading would
fail to be able to produce a query with the scope of lazy loads and object
refresh operations that also attempted to render the joined loader.

Fixes: #6495
Change-Id: If74a744c237069e3a89617498096c18b9b6e5dde

4 years agoUse type_ when creating literals in _LiteralRoundTripFixture
Jim Fulton [Mon, 17 May 2021 15:29:54 +0000 (11:29 -0400)] 
Use type_ when creating literals in _LiteralRoundTripFixture

Fixes #6496 by passing the `type_` argument passed to `run` to `literal`.

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: #6497
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6497
Pull-request-sha: 5f82408b2c25c7593f7202533dde4e29f045de5d

Change-Id: Ieed822c157f91d95fe3a07ea4482a36777539c35

4 years agoadd missing config.yml from previous commit
Mike Bayer [Sun, 16 May 2021 16:47:40 +0000 (12:47 -0400)] 
add missing config.yml from previous commit

Change-Id: Ia23ca00c548bde416ee8282d470dd835f6d07f45

4 years agorework issue template
Mike Bayer [Sun, 16 May 2021 16:45:59 +0000 (12:45 -0400)] 
rework issue template

only bug reports are encouraged through "issues"

all other questions / features go through discussions

links to external help resources

Change-Id: I6ac2dc460a3bf9fbdaf63c1269e9ba7a5501f181

4 years agoRemove pep484 type comments from the code
Federico Caselli [Thu, 13 May 2021 19:20:51 +0000 (21:20 +0200)] 
Remove pep484 type comments from the code

Current effort is around the stub package, and having typing in
two places makes thing worse, since the types here are usually
outdated compared to the version in the stubs.

Once v2 gets under way we can start consolidating the types
here.

Fixes: #6461
Change-Id: I7132a444bd7138123074bf5bc664b4bb119a85ce

4 years agoConsult plugin_subject for non-ORM enabled stmts in get_bind()
Mike Bayer [Fri, 14 May 2021 14:29:55 +0000 (10:29 -0400)] 
Consult plugin_subject for non-ORM enabled stmts in get_bind()

Enhanced the bind resolution rules for :meth:`_orm.Session.execute` so that
when a non-ORM statement such as an :func:`_sql.insert` construct
nonetheless is built against ORM objects, to the greatest degree possible
the ORM entity will be used to resolve the bind, such as for a
:class:`_orm.Session` that has a bind map set up on a common superclass
without specific mappers or tables named in the map.

Fixes: #6484
Change-Id: Iaa711b7f2c7451377b50af63029f37c4375a6f7e

4 years agoreformat URL attributes
Mike Bayer [Wed, 12 May 2021 22:13:06 +0000 (18:13 -0400)] 
reformat URL attributes

these were using :var: which seems to not work now,
not sure if this broke due to sphinx 1.4 or if this was
broken anyway, but these are not even refs that can be picked
up by zzzeeksphinx now.

Change-Id: I24ae968ae5d870ec949b2b07dbad2afa6969a189

4 years agoFix documentation type in URL class
Federico Caselli [Wed, 12 May 2021 21:59:09 +0000 (23:59 +0200)] 
Fix documentation type in URL class

Change-Id: I16a24718ee322efeffbf5a268d995ff53c23b696

4 years agoUpdate black flak8 and zimports
Federico Caselli [Wed, 12 May 2021 20:01:45 +0000 (22:01 +0200)] 
Update black flak8 and zimports

Change-Id: I488c9557eda390e4a88319affd4c8813ee274f80

4 years agoCreate new event for collection add w/o mutation
Mike Bayer [Wed, 12 May 2021 13:26:03 +0000 (09:26 -0400)] 
Create new event for collection add w/o mutation

Fixed issue when using :paramref:`_orm.relationship.cascade_backrefs`
parameter set to ``False``, which per :ref:`change_5150` is set to become
the standard behavior in SQLAlchemy 2.0, where adding the item to a
collection that uniquifies, such as ``set`` or ``dict`` would fail to fire
a cascade event if the object were already associated in that collection
via the backref. This fix represents a fundamental change in the collection
mechanics by introducing a new event state which can fire off for a
collection mutation even if there is no net change on the collection; the
action is now suited using a new event hook
:meth:`_orm.AttributeEvents.append_wo_mutation`.

Fixes: #6471
Change-Id: Ic50413f7e62440dad33ab84838098ea62ff4e815

4 years agoMerge "allow CTE to be direct DML target"
mike bayer [Tue, 11 May 2021 18:09:36 +0000 (18:09 +0000)] 
Merge "allow CTE to be direct DML target"

4 years agoallow CTE to be direct DML target
Mike Bayer [Tue, 11 May 2021 12:39:24 +0000 (08:39 -0400)] 
allow CTE to be direct DML target

Implemented support for a :class:`_sql.CTE` construct to be used directly
as the target of a :func:`_sql.delete` construct, i.e. "WITH ... AS cte
DELETE FROM cte". This appears to be a useful feature of SQL Server.

The CTE is now generally usable as a DML target table however
it's not clear if this syntax is valid beyond the use case of
DELETE itself.

Fixes: #6464
Change-Id: I3aac6fae2a1abb39bc0ffa87a044f5eb4f90f026

4 years agoVersion 1.4.16 placeholder
Mike Bayer [Tue, 11 May 2021 04:38:50 +0000 (00:38 -0400)] 
Version 1.4.16 placeholder

4 years ago- 1.4.15 rel_1_4_15
Mike Bayer [Tue, 11 May 2021 04:26:13 +0000 (00:26 -0400)] 
- 1.4.15

4 years agoMerge "set bindparam.expanding in coercion again"
mike bayer [Tue, 11 May 2021 04:21:03 +0000 (04:21 +0000)] 
Merge "set bindparam.expanding in coercion again"

4 years agoset bindparam.expanding in coercion again
Mike Bayer [Tue, 11 May 2021 02:52:49 +0000 (22:52 -0400)] 
set bindparam.expanding in coercion again

Adjusted the logic added as part of :ticket:`6397` in 1.4.12 so that
internal mutation of the :class:`.BindParameter` object occurs within the
clause construction phase as it did before, rather than in the compilation
phase. In the latter case, the mutation still produced side effects against
the incoming construct and additionally could potentially interfere with
other internal mutation routines.

In order to solve the issue of the correct operator being present
on the BindParameter.expand_op, we necessarily have to expand the
BinaryExpression._negate() routine to flip the operator on the
BindParameter also.

Fixes: #6460
Change-Id: I1e53a9aeee4de4fc11af51d7593431532731561b

4 years agoImprove cascade backrefs warning and add `code` to deprecation warnings
Stephen Rosen [Fri, 7 May 2021 19:45:47 +0000 (15:45 -0400)] 
Improve cascade backrefs warning and add `code` to deprecation warnings

This adds a new description to errors.rst and adds support
for any SQLAlchemy warning to refer to an errors.rst code.

Fixes: #6148
Closes: #6250
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6250
Pull-request-sha: dbcaeb54e31517fe88f6f8c515f1024002675f13

Change-Id: I4303c62ac9b1f13f67a34f825687014f1771c98c

4 years agoMerge "Correct cache key for proxy_owner, with_context_options"
mike bayer [Mon, 10 May 2021 20:04:20 +0000 (20:04 +0000)] 
Merge "Correct cache key for proxy_owner, with_context_options"

4 years agoMerge "calculate warnings stacklevels dynamically"
mike bayer [Mon, 10 May 2021 20:01:01 +0000 (20:01 +0000)] 
Merge "calculate warnings stacklevels dynamically"

4 years agocalculate warnings stacklevels dynamically
Mike Bayer [Fri, 7 May 2021 17:01:40 +0000 (13:01 -0400)] 
calculate warnings stacklevels dynamically

A new approach has been applied to the warnings system in SQLAlchemy to
accurately predict the appropriate stack level for each warning
dynamically. This allows evaluating the source of SQLAlchemy-generated
warnings and deprecation warnings to be more straightforward as the warning
will indicate the source line within end-user code, rather than from an
arbitrary level within SQLAlchemy's own source code.

Fixes: #6241
Change-Id: I9ecf3b3ea77424d15e8d4c0aa47350602c0568d7

4 years agoCorrect cache key for proxy_owner, with_context_options
Mike Bayer [Mon, 10 May 2021 17:19:14 +0000 (13:19 -0400)] 
Correct cache key for proxy_owner, with_context_options

Fixed issue in subquery loader strategy which prevented caching from
working correctly. This would have been seen in the logs as a "generated"
message instead of "cached" for all subqueryload SQL emitted, which by
saturating the cache with new keys would degrade overall performance; it
also would produce "LRU size alert" warnings.

In this issue we also observe that the local LRU cache for lazyloader
and selectinloader will get used for all subsequent loads as well,
which makes it more likely to hit the limit of 30.   However rather than
trying to work this out, it would be better if we removed the
loader-local LRU caches altogether once we are confident these
are working well.

Fixes: #6459
Change-Id: Id953e8f75536bb87f7e3315929cebcd8f84a5a50

4 years agoreset session on new #6449 test for pypy
Mike Bayer [Sun, 9 May 2021 16:42:19 +0000 (12:42 -0400)] 
reset session on new #6449 test for pypy

Change-Id: If1c8c755a7e9c0191c1666a13b9e920effbeb5bc

4 years agoformatting
Mike Bayer [Sun, 9 May 2021 16:14:42 +0000 (12:14 -0400)] 
formatting

Change-Id: I69092dc6c2121bb780aed1b145ccd3eaabb0ff5d

4 years agoMerge "Update SQLAlchemy README.unittests.rst"
mike bayer [Sun, 9 May 2021 16:08:34 +0000 (16:08 +0000)] 
Merge "Update SQLAlchemy README.unittests.rst"

4 years agoremove extra verbiage
Mike Bayer [Sun, 9 May 2021 15:54:15 +0000 (11:54 -0400)] 
remove extra verbiage

having all this verbiage in the template itself means
all the issues will have all this verbiage in them, so
pull it back again.  there is unfortunately no way to
cleanly direct reporters through the guidelines with github.

Change-Id: I9835e412fac244b639d1fe6970e4dab43ab95117

4 years agofix quote.
Mike Bayer [Sun, 9 May 2021 15:52:04 +0000 (11:52 -0400)] 
fix quote.

I really wish there were a way to get the guidelines to be
HTML formatted.

Change-Id: I22de6d40be9940e152c829a7c9a1cfc0eaf2211c

4 years agotrying a different issue template
Mike Bayer [Sun, 9 May 2021 15:19:38 +0000 (11:19 -0400)] 
trying a different issue template

Change-Id: Ibb4fda98f4fdef569ce0bb9435849f0009ff1a82

4 years agoUpdate SQLAlchemy README.unittests.rst
Gord Thompson [Sun, 9 May 2021 13:41:32 +0000 (07:41 -0600)] 
Update SQLAlchemy README.unittests.rst

Change-Id: Ic7af61e68a0828401fb6774f9f301d83fad95367

4 years agoMerge "Ensure propagate_to_loaders honored at the sub-loader level"
mike bayer [Sun, 9 May 2021 02:59:21 +0000 (02:59 +0000)] 
Merge "Ensure propagate_to_loaders honored at the sub-loader level"

4 years agoEnsure propagate_to_loaders honored at the sub-loader level
Mike Bayer [Sun, 9 May 2021 01:21:35 +0000 (21:21 -0400)] 
Ensure propagate_to_loaders honored at the sub-loader level

Fixed additional regression caused by "eager loaders run on unexpire"
feature :ticket:`1763` where the feature would run for a
``contains_eager()`` eagerload option in the case that the
``contains_eager()`` were chained to an additional eager loader option,
which would then produce an incorrect query as the original query-bound
join criteria were no longer present.

The contains_eager() option correctly included
propagate_to_loaders=False however this would not be considered
if the contains_eager() were chained and therefore bundled inside
of an enclosing loader.  We don't want to turn off propagation
completely in that case because we still want the other
loaders inside to be handled individually, so add a check
as each option is moved into the query context.

Fixes: #6449
Change-Id: Icd1d6611095c20ae44ff5d2df734c24770fc8812

4 years agoadd ssl_check_hostname option in mysqldb
Jerry Zhao [Fri, 23 Apr 2021 15:54:04 +0000 (11:54 -0400)] 
add ssl_check_hostname option in mysqldb

Added support for the ``ssl_check_hostname=`` parameter in mysql connection
URIs and updated the mysql dialect documentation regarding secure
connections. Original pull request courtesy of Jerry Zhao.

Fixes: #5397
Closes: #5759
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5759
Pull-request-sha: 75f4bdc68d4b5745c518472e8bc2b02cec0f81e6

Change-Id: I964bfa7a4c15e215a3ad6e2b907cb78f5b3e5036

4 years agoVersion 1.4.15 placeholder
Mike Bayer [Thu, 6 May 2021 21:24:52 +0000 (17:24 -0400)] 
Version 1.4.15 placeholder

4 years ago- 1.4.14 rel_1_4_14
Mike Bayer [Thu, 6 May 2021 21:15:56 +0000 (17:15 -0400)] 
- 1.4.14

4 years agofix absolute import
Mike Bayer [Thu, 6 May 2021 21:13:53 +0000 (17:13 -0400)] 
fix absolute import

Change-Id: I57e7bb8ac8f53c601b2ec5462d7502f8e53f1b0f

4 years agoMerge "don't cache TypeDecorator by default"
mike bayer [Thu, 6 May 2021 21:12:48 +0000 (21:12 +0000)] 
Merge "don't cache TypeDecorator by default"

4 years agoMerge "mypy: fix working directory for mypy_extra_test_paths."
mike bayer [Thu, 6 May 2021 19:56:10 +0000 (19:56 +0000)] 
Merge "mypy: fix working directory for mypy_extra_test_paths."

4 years agodon't cache TypeDecorator by default
Mike Bayer [Thu, 6 May 2021 16:24:00 +0000 (12:24 -0400)] 
don't cache TypeDecorator by default

The :class:`.TypeDecorator` class will now emit a warning when used in SQL
compilation with caching unless the ``.cache_ok`` flag is set to ``True``
or ``False``. ``.cache_ok`` indicates that all the parameters passed to the
object are safe to be used as a cache key, ``False`` means they are not.

Fixes: #6436
Change-Id: Ib1bb7dc4b124e38521d615c2e2e691e4915594fb