]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoMerge "Fix typo in _warn_for_legacy_exec_format"
mike bayer [Thu, 24 Jun 2021 16:08:33 +0000 (16:08 +0000)] 
Merge "Fix typo in _warn_for_legacy_exec_format"

4 years agoMerge "Use Py_TPFLAGS_HAVE_GC for Row"
mike bayer [Thu, 24 Jun 2021 15:11:26 +0000 (15:11 +0000)] 
Merge "Use Py_TPFLAGS_HAVE_GC for Row"

4 years agoFix typo in _warn_for_legacy_exec_format
gordthompson [Thu, 24 Jun 2021 13:44:21 +0000 (07:44 -0600)] 
Fix typo in _warn_for_legacy_exec_format

Change-Id: Idc24b5ab4b5a25fcfb7115c5d7be4c2ece520674

4 years agoMerge "Add Executable to DefaultGenerator"
mike bayer [Thu, 24 Jun 2021 13:17:15 +0000 (13:17 +0000)] 
Merge "Add Executable to DefaultGenerator"

4 years agoUse Py_TPFLAGS_HAVE_GC for Row
Mike Bayer [Thu, 24 Jun 2021 13:12:31 +0000 (09:12 -0400)] 
Use Py_TPFLAGS_HAVE_GC for Row

Fixed an issue in the C extension for the :class:`_result.Row` class which
could lead to a memory leak in the unlikely case of a :class:`_result.Row`
object which referred to an ORM object that then was mutated to refer back
to the ``Row`` itself, creating a cycle. The Python C APIs for tracking GC
cycles has been added to the native :class:`_result.Row` implementation to
accommodate for this case.

Fixes: #5348
Change-Id: I3ac32012f29fbb59f8921cf2a124fa3a7ac5f0d1

4 years agoAdd Executable to DefaultGenerator
Mike Bayer [Wed, 23 Jun 2021 20:34:05 +0000 (16:34 -0400)] 
Add Executable to DefaultGenerator

Fixed the class hierarchy for the :class:`_schema.Sequence` and the more
general :class:`_schema.DefaultGenerator` base, as these are "executable"
as statements they need to include :class:`_sql.Executable` in their
hierarchy, not just :class:`_roles.StatementRole` as was applied
arbitrarily to :class:`_schema.Sequence` previously. The fix allows
:class:`_schema.Sequence` to work in all ``.execute()`` methods including
with :meth:`_orm.Session.execute` which was not working in the case that a
``do_orm_execute()`` handler was also established.

Fixes: #6668
Change-Id: I0d192258c7cbd1bce2552f9e748e8fdd680dc45f

4 years agoMerge "consider "*" col as textual ordered"
mike bayer [Wed, 23 Jun 2021 18:08:56 +0000 (18:08 +0000)] 
Merge "consider "*" col as textual ordered"

4 years agoconsider "*" col as textual ordered
Mike Bayer [Wed, 23 Jun 2021 12:50:48 +0000 (08:50 -0400)] 
consider "*" col as textual ordered

Fixed old issue where a :func:`_sql.select()` made against the token "*",
which then yielded exactly one column, would fail to correctly organize the
``cursor.description`` column name into the keys of the result object.

Fixes: #6665
Change-Id: Ie8c00f62998972ad4a19a750d2642d00fde006f6

4 years agoVersion 1.4.20 placeholder
Mike Bayer [Wed, 23 Jun 2021 01:30:40 +0000 (21:30 -0400)] 
Version 1.4.20 placeholder

4 years ago- 1.4.19 rel_1_4_19
Mike Bayer [Wed, 23 Jun 2021 01:22:33 +0000 (21:22 -0400)] 
- 1.4.19

4 years agorefer to undefer here
Mike Bayer [Wed, 23 Jun 2021 01:21:16 +0000 (21:21 -0400)] 
refer to undefer here

this is the option one might want to use to undefer
a deferred column into a subquery; the message here explains
that is not applicable in 1.4.

Change-Id: Iea6c48f69c540e11ff5c3f6c8c56cc5cf2bf257b

4 years agoMerge "apply render_schema_translates to identity insert directives"
mike bayer [Wed, 23 Jun 2021 01:02:48 +0000 (01:02 +0000)] 
Merge "apply render_schema_translates to identity insert directives"

4 years agoMerge "Add impl property to PostgreSQL / Oracle INTERVAL class"
mike bayer [Tue, 22 Jun 2021 22:49:52 +0000 (22:49 +0000)] 
Merge "Add impl property to PostgreSQL / Oracle INTERVAL class"

4 years agoMerge "Export deferred columns but not col props; fix CTE labeling"
mike bayer [Tue, 22 Jun 2021 22:05:35 +0000 (22:05 +0000)] 
Merge "Export deferred columns but not col props; fix CTE labeling"

4 years agoAdd impl property to PostgreSQL / Oracle INTERVAL class
MajorDallas [Tue, 22 Jun 2021 19:34:09 +0000 (15:34 -0400)] 
Add impl property to PostgreSQL / Oracle INTERVAL class

Fixed issue where the ``INTERVAL`` datatype on PostgreSQL and Oracle would
produce an ``AttributeError`` when used in the context of a comparison
operation against a ``timedelta()`` object. Pull request courtesy
MajorDallas.

Fixes: #6649
Closes: #6650
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6650
Pull-request-sha: dd217a975e5f0d3157e81c731791225b6a32889f

Change-Id: I773caf2673294fdb3c92b42895ad714e944d1bf8

4 years agoExport deferred columns but not col props; fix CTE labeling
Mike Bayer [Tue, 22 Jun 2021 17:27:18 +0000 (13:27 -0400)] 
Export deferred columns but not col props; fix CTE labeling

Refined the behavior of ORM subquery rendering with regards to deferred
columns and column properties to be more compatible with that of 1.3 while
also providing for 1.4's newer features. As a subquery in 1.4 does not make
use of loader options, including :func:`_orm.deferred`, a subquery that is
against an ORM entity with deferred attributes will now render those
deferred attributes that refer directly to mapped table columns, as these
are needed in the outer SELECT if that outer SELECT makes use of these
columns; however a deferred attribute that refers to a composed SQL
expression as we normally do with :func:`_orm.column_property` will not be
part of the subquery, as these can be selected explicitly if needed in the
subquery. If the entity is being SELECTed from this subquery, the column
expression can still render on "the outside" in terms of the derived
subquery columns. This produces essentially the same behavior as when
working with 1.3. However in this case the fix has to also make sure that
the ``.selected_columns`` collection of an ORM-enabled :func:`_sql.select`
also follows these rules, which in particular allows recursive CTEs to
render correctly in this scenario, which were previously failing to render
correctly due to this issue.

As part of this change the _exported_columns_iterator() method has been
removed and logic simplified to use ._all_selected_columns from any
SelectBase object where _exported_columns_iterator() was used before.
Additionally sets up UpdateBase to include ReturnsRows in its hierarchy;
the literal point of ReturnsRows was to be a common base for UpdateBase
and SelectBase so it was kind of weird it wasn't there.

Fixes: #6661
Fixed issue in CTE constructs mostly relevant to ORM use cases where a
recursive CTE against "anonymous" labels such as those seen in ORM
``column_property()`` mappings would render in the
``WITH RECURSIVE xyz(...)`` section as their raw internal label and not a
cleanly anonymized name.

Fixes: #6663
Change-Id: I26219d4d8e6c0915b641426e9885540f74fae4d2

4 years agoImprove regexp used by pymssql to parse db version
Federico Caselli [Mon, 21 Jun 2021 19:01:57 +0000 (21:01 +0200)] 
Improve regexp used by pymssql to parse db version

Made improvements to the server version regexp used by the pymssql
dialect to prevent a regexp overflow in case of an invalid version
string.

Fixes: #5557
Change-Id: Ia3e95a9f11f5a121d84474c97f6b122cf8d9c9cf

4 years agoMerge "Implement MySQL-specific MATCH"
mike bayer [Mon, 21 Jun 2021 22:30:31 +0000 (22:30 +0000)] 
Merge "Implement MySQL-specific MATCH"

4 years agoMerge "adjust patchfile from 6ca7c2eb"
mike bayer [Mon, 21 Jun 2021 22:30:06 +0000 (22:30 +0000)] 
Merge "adjust patchfile from 6ca7c2eb"

4 years agoapply render_schema_translates to identity insert directives
Mike Bayer [Mon, 21 Jun 2021 22:13:55 +0000 (18:13 -0400)] 
apply render_schema_translates to identity insert directives

Fixed bug where the "schema_translate_map" feature would fail to function
correctly in conjunction with an INSERT into a table that has an IDENTITY
column, where the value of the IDENTITY column were specified in the values
of the INSERT thus triggering SQLAlchemy's feature of setting IDENTITY
INSERT to "on"; it's in this directive where the schema translate map would
fail to be honored.

Fixes: #6658
Change-Id: I8235aa639dd465d038a2ad48e7a669f3e5c5c37c

4 years agoImplement MySQL-specific MATCH
Anton Kovalevich [Fri, 18 Jun 2021 14:33:48 +0000 (10:33 -0400)] 
Implement MySQL-specific MATCH

Added new construct :class:`_mysql.match`, which provides for the full
range of MySQL's MATCH operator including multiple column support and
modifiers. Pull request courtesy Anton Kovalevich.

Fixes: #6132
Closes: #6133
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6133
Pull-request-sha: dc6842f13688849a848e2ecbb81600e6edf8b3a9

Change-Id: I66bbfd7947aa2e43a031772e9b5ae238d94e5223

4 years agofurther fixes to test_options_entities_three
Mike Bayer [Mon, 21 Jun 2021 20:39:11 +0000 (16:39 -0400)] 
further fixes to test_options_entities_three

this needs to be on default dialect for consistent
rendering of "JOIN"

Change-Id: I0bd16d8ef8161e2deef7e9aff61f9ad02106f30d

4 years agoadjust patchfile from 6ca7c2eb
Mike Bayer [Mon, 21 Jun 2021 20:34:16 +0000 (16:34 -0400)] 
adjust patchfile from 6ca7c2eb

code formatting modified table.py such that the patchfile
would no longer apply and this was missed in review.

Change-Id: I0af91cf92baa79f196b4d9f3af1bab3bb0984a23

4 years agoMerge "accommodate no cls info found in _scan_declarative"
mike bayer [Mon, 21 Jun 2021 19:20:27 +0000 (19:20 +0000)] 
Merge "accommodate no cls info found in _scan_declarative"

4 years agoensure test has deterministic FROM rendering
Mike Bayer [Mon, 21 Jun 2021 17:08:59 +0000 (13:08 -0400)] 
ensure test has deterministic FROM rendering

test_options_entities_replaced_with_equivs_three did not
have deterministic FROM ordering, so adding an inner
join from user->address should ensure there's a single
FROM element that is a series of joins.

Change-Id: Ic78e14959699c8d2ae7b3c278f4d8ee1e3a2b590

4 years agoaccommodate no cls info found in _scan_declarative
Mike Bayer [Mon, 21 Jun 2021 16:52:42 +0000 (12:52 -0400)] 
accommodate no cls info found in _scan_declarative

Fixed issue in mypy plugin where class info for a custom declarative base
would not be handled correctly on a cached mypy pass, leading to an
AssertionError being raised.

Fixes: #6476
Change-Id: If78340673e6a4d16d8f7cf787ce3bdb02c8bd47b

4 years agoMerge "ensure greenlet_spawn propagates BaseException"
mike bayer [Sat, 19 Jun 2021 04:11:29 +0000 (04:11 +0000)] 
Merge "ensure greenlet_spawn propagates BaseException"

4 years agoMerge "Added netezza in external dialects in documentation"
mike bayer [Sat, 19 Jun 2021 03:46:07 +0000 (03:46 +0000)] 
Merge "Added netezza in external dialects in documentation"

4 years agoensure greenlet_spawn propagates BaseException
Mike Bayer [Fri, 18 Jun 2021 21:42:53 +0000 (17:42 -0400)] 
ensure greenlet_spawn propagates BaseException

Fixed bug in asyncio implementation where the greenlet adaptation system
failed to propagate ``BaseException`` subclasses, most notably including
``asyncio.CancelledError``, to the exception handling logic used by the
engine to invalidate and clean up the connection, thus preventing
connections from being correctly disposed when a task was cancelled.

Fixes: #6652
Change-Id: Id3809e6c9e7bced46a7a3b5a0d1906c4168dc4fc

4 years agoAdded netezza in external dialects in documentation
Abhishek Jog [Wed, 16 Jun 2021 19:15:24 +0000 (15:15 -0400)] 
Added netezza in external dialects in documentation

### Description
IBM Netezza Performance Server (aka Netezza, NPS) now has fully function SQLAlchemy dialect. Need to add it in SQLAlchemy 1.3 documentation.
This PR fixes https://github.com/sqlalchemy/sqlalchemy/issues/6609

### 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:

- [x] 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!**

Fixes: #6610
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6610
Pull-request-sha: 2de51ff3887048e7df39e71b30b0e1824cfa0f56

Change-Id: I3a3f49981a4aaca0874bc2765cd782da61a258ef
(cherry picked from commit 86b64dddd46c3985f3d844dc8afb8d009a0aad1e)

4 years agoMerge "memoize current options and joins w with_entities/with_only_cols"
mike bayer [Fri, 18 Jun 2021 14:38:12 +0000 (14:38 +0000)] 
Merge "memoize current options and joins w with_entities/with_only_cols"

4 years agoFix typos in "Working with Related Objects" docs (#6651)
Samuel Cattini-Schultz [Thu, 17 Jun 2021 18:51:38 +0000 (04:51 +1000)] 
Fix typos in "Working with Related Objects" docs (#6651)

* Fix typo in "Working with Related Objects" docs

* Fix typo in "Working with Related Objects" docs

4 years agomemoize current options and joins w with_entities/with_only_cols
Mike Bayer [Tue, 15 Jun 2021 19:13:34 +0000 (15:13 -0400)] 
memoize current options and joins w with_entities/with_only_cols

Fixed further regressions in the same area as that of :ticket:`6052` where
loader options as well as invocations of methods like
:meth:`_orm.Query.join` would fail if the left side of the statement for
which the option/join depends upon were replaced by using the
:meth:`_orm.Query.with_entities` method, or when using 2.0 style queries
when using the :meth:`_sql.Select.with_only_columns` method. A new set of
state has been added to the objects which tracks the "left" entities that
the options / join were made against which is memoized when the lead
entities are changed.

Fixes: #6503
Fixes: #6253
Change-Id: I211b2af98b0b20d1263fb15dc513884dcc5de6a4

4 years agopin async scoping tests at python 3.7
Mike Bayer [Wed, 16 Jun 2021 17:15:16 +0000 (13:15 -0400)] 
pin async scoping tests at python 3.7

as it relies upon asyncio.current_task that's not in 3.6

Change-Id: I2b09295bf736811f260640102214a531c9b9e816

4 years agoImplement async_scoped_session
jason3gb [Wed, 16 Jun 2021 14:18:08 +0000 (10:18 -0400)] 
Implement async_scoped_session

Implemented :class:`_asyncio.async_scoped_session` to address some
asyncio-related incompatibilities between :class:`_orm.scoped_session` and
:class:`_asyncio.AsyncSession`, in which some methods (notably the
:meth:`_asyncio.async_scoped_session.remove` method) should be used with
the ``await`` keyword.

Fixes: #6583
Closes: #6603
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6603
Pull-request-sha: 0e8ef87dc824dcd83dca01641441afc453c8e07a

Change-Id: I9bfe56f8670302ff0015d9dc56c1e3ac5b92b118

4 years agoMerge "set autocommit for psycopg2 pre-ping"
mike bayer [Tue, 15 Jun 2021 18:49:39 +0000 (18:49 +0000)] 
Merge "set autocommit for psycopg2 pre-ping"

4 years agopg 13 is in CI
Mike Bayer [Tue, 15 Jun 2021 13:24:20 +0000 (09:24 -0400)] 
pg 13 is in CI

Change-Id: I9fc638995a7c49a3ca3bf3c439428cae95d3c7b9
References: #6637

4 years agoclarify one-to-one examples
Mike Bayer [Mon, 14 Jun 2021 14:33:14 +0000 (10:33 -0400)] 
clarify one-to-one examples

Fixes: #6580
Change-Id: I804cee4c8f8cdb2a4d79beda73c74eccd32b457f

4 years agoclarify relationship to aliased class criteria
Mike Bayer [Mon, 14 Jun 2021 14:26:28 +0000 (10:26 -0400)] 
clarify relationship to aliased class criteria

the AC itself has to be used in additional WHERE/ORDER BY
etc, not the original class.

Change-Id: I66a0086349257cb281940e743c0f45e6c2e9e282

4 years agodocument missing ColumnCollection methods
Mike Bayer [Mon, 14 Jun 2021 01:08:24 +0000 (21:08 -0400)] 
document missing ColumnCollection methods

add additional notes regarding the methods that are on this
object.

Fixes: #6629
Change-Id: I68446cb16cbfcef9af9c2998687b3b536607cf0d

4 years agoset autocommit for psycopg2 pre-ping
Mike Bayer [Fri, 11 Jun 2021 14:23:51 +0000 (10:23 -0400)] 
set autocommit for psycopg2 pre-ping

Fixed issue where the pool "pre ping" feature would implicitly start a
transaction, which would then interfere with custom transactional flags
such as PostgreSQL's "read only" mode when used with the psycopg2 driver.

Fixes: #6621
Change-Id: I29117c393e50c090cc2587efcccfe1e986738928

4 years agoVersion 1.4.19 placeholder
Mike Bayer [Thu, 10 Jun 2021 18:20:38 +0000 (14:20 -0400)] 
Version 1.4.19 placeholder

4 years ago- 1.4.18 rel_1_4_18
Mike Bayer [Thu, 10 Jun 2021 18:13:44 +0000 (14:13 -0400)] 
- 1.4.18

4 years agochangelog updates
Mike Bayer [Thu, 10 Jun 2021 18:13:07 +0000 (14:13 -0400)] 
changelog updates

Change-Id: I250e3e084ddb75b535913f9e0d7c219d64e35695

4 years agofix typo
Mike Bayer [Thu, 10 Jun 2021 14:18:11 +0000 (10:18 -0400)] 
fix typo

Change-Id: I3f5fcb1928051a1c2ac5e51917c95af086fb0380

4 years agoMerge "simplify relationship caching options"
mike bayer [Wed, 9 Jun 2021 14:02:04 +0000 (14:02 +0000)] 
Merge "simplify relationship caching options"

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 "Propagate asyncio flag from the dialect to selected pool classes"
mike bayer [Wed, 9 Jun 2021 13:55:06 +0000 (13:55 +0000)] 
Merge "Propagate asyncio flag from the dialect to selected pool classes"

4 years agoPropagate asyncio flag from the dialect to selected pool classes
Federico Caselli [Thu, 3 Jun 2021 20:38:15 +0000 (22:38 +0200)] 
Propagate asyncio flag from the dialect to selected pool classes

Fixed an issue that presented itself when using the :class:`_pool.NullPool`
or the :class:`_pool.StaticPool` with an async engine. This mostly affected
the aiosqlite dialect.

Fixes: #6575
Change-Id: Ic1e27d99ffcb20ed4de82ea78f430a0f3b629d86

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