]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
4 years agoearler -> earlier 6110/head
mgjo5899 [Sun, 21 Mar 2021 20:40:44 +0000 (15:40 -0500)] 
earler -> earlier

4 years agoMerge "fix __all__"
mike bayer [Sun, 21 Mar 2021 16:50:48 +0000 (16:50 +0000)] 
Merge "fix __all__"

4 years agofix __all__
Mike Bayer [Sat, 20 Mar 2021 18:34:10 +0000 (14:34 -0400)] 
fix __all__

sqlalchemy.engine had an oddly restrictive __all__ for some reason.
Add missing symbols to session.__all__

Change-Id: I017fa1c2a93f559f2ccc366f88660266c50e9ca6

4 years agoVersion 1.4.3 placeholder
Mike Bayer [Fri, 19 Mar 2021 23:10:55 +0000 (19:10 -0400)] 
Version 1.4.3 placeholder

4 years ago- 1.4.2 rel_1_4_2
Mike Bayer [Fri, 19 Mar 2021 22:59:47 +0000 (18:59 -0400)] 
- 1.4.2

4 years agoMerge "Import inspector in engine init"
mike bayer [Fri, 19 Mar 2021 22:58:39 +0000 (22:58 +0000)] 
Merge "Import inspector in engine init"

4 years agoImport inspector in engine init
Federico Caselli [Fri, 19 Mar 2021 21:37:07 +0000 (22:37 +0100)] 
Import inspector in engine init

Change-Id: I7e57c472869fdf68e2313ed5642272fc700390c9

4 years agoempty deferred mapper configs at start of deferred reflection test
Mike Bayer [Fri, 19 Mar 2021 21:57:58 +0000 (17:57 -0400)] 
empty deferred mapper configs at start of deferred reflection test

Change-Id: I905899281c478cbb7b73e1b31e97716372498157

4 years agoMerge "Add documentation for connecting to Azure SQL instances with managed identities"
mike bayer [Fri, 19 Mar 2021 20:13:15 +0000 (20:13 +0000)] 
Merge "Add documentation for connecting to Azure SQL instances with managed identities"

4 years agoUse tuple for function package names
Mike Bayer [Fri, 19 Mar 2021 18:52:59 +0000 (14:52 -0400)] 
Use tuple for function package names

Fixed issue where using a ``func`` that includes dotted packagenames would
fail to be cacheable by the SQL caching system due to a Python list of
names that needed to be a tuple.

Fixes: #6101
Change-Id: I1d4bb5bf230b83596c59b6a04aa498f18ecd9613

4 years agoMerge "support callable mapped attributes in dataclass mixins"
mike bayer [Fri, 19 Mar 2021 18:46:01 +0000 (18:46 +0000)] 
Merge "support callable mapped attributes in dataclass mixins"

4 years agosupport callable mapped attributes in dataclass mixins
Mike Bayer [Fri, 19 Mar 2021 16:55:43 +0000 (12:55 -0400)] 
support callable mapped attributes in dataclass mixins

Added support for the :class:`_orm.declared_attr` object to work in the
context of dataclass fields.

Fixes: #6100
Change-Id: Ifaf4a6482c866d6cfee99d8bc2c6294d923460d7

4 years agoCorrect for coercion from list args to positional for case
Mike Bayer [Fri, 19 Mar 2021 14:34:31 +0000 (10:34 -0400)] 
Correct for coercion from list args to positional for case

Fixed regression in the :func:`_sql.case` construct, where the "dictionary"
form of argument specification failed to work correctly if it were passed
positionally, rather than as a "whens" keyword argument.

Fixes: #6097
Change-Id: I4138f54309a08c8e4e63cfafc211176e0b9a76c7

4 years agoMerge "Deannoate functions before matching .__class__"
mike bayer [Fri, 19 Mar 2021 12:23:48 +0000 (12:23 +0000)] 
Merge "Deannoate functions before matching .__class__"

4 years agoMerge "Ensure ClauseAdapter treats FunctionElement as a ColumnElement"
mike bayer [Fri, 19 Mar 2021 05:23:26 +0000 (05:23 +0000)] 
Merge "Ensure ClauseAdapter treats FunctionElement as a ColumnElement"

4 years agoDeannoate functions before matching .__class__
Mike Bayer [Fri, 19 Mar 2021 05:18:06 +0000 (01:18 -0400)] 
Deannoate functions before matching .__class__

Fixed regression where the SQL compilation of a :class:`.Function` would
not work correctly if the object had been "annotated", which is an internal
memoization process used mostly by the ORM. In particular it could affect
ORM lazy loads which make greater use of this feature in 1.4.

Fixes: #6095
Change-Id: I7a6527df651f440a04d911ba78ee0b0dd4436dcd

4 years agoEnsure ClauseAdapter treats FunctionElement as a ColumnElement
Mike Bayer [Thu, 18 Mar 2021 23:34:32 +0000 (19:34 -0400)] 
Ensure ClauseAdapter treats FunctionElement as a ColumnElement

Fixed regression where use of an unnamed SQL expression such as a SQL
function would raise a column targeting error if the query itself were
using joinedload for an entity and was also being wrapped in a subquery by
the joinedload eager loading process.

Fixes: #6086
Change-Id: I22cf4d6974685267c4f903bd7639be8271c6c1ef

4 years agoMerge "repair legacy_last_joined_entity for no onclause"
mike bayer [Fri, 19 Mar 2021 01:45:31 +0000 (01:45 +0000)] 
Merge "repair legacy_last_joined_entity for no onclause"

4 years agorepair legacy_last_joined_entity for no onclause
Mike Bayer [Thu, 18 Mar 2021 21:46:24 +0000 (17:46 -0400)] 
repair legacy_last_joined_entity for no onclause

Fixed regression where the :meth:`_orm.Query.filter_by` method would fail
to locate the correct source entity if the :meth:`_orm.Query.join` method
had been used targeting an entity without any kind of ON clause.

Fixes: #6092
Change-Id: I38d9099844f842f314c6673bd922467242409cdb

4 years agoMerge "check for MemberExpr looking for column argument"
mike bayer [Thu, 18 Mar 2021 21:14:53 +0000 (21:14 +0000)] 
Merge "check for MemberExpr looking for column argument"

4 years agocheck for MemberExpr looking for column argument
Mike Bayer [Thu, 18 Mar 2021 19:26:05 +0000 (15:26 -0400)] 
check for MemberExpr looking for column argument

Fixed issue in MyPy extension which crashed on detecting the type of a
:class:`.Column` if the type were given with a module prefix like
``sa.Integer()``.

Fixes: sqlalchemy/sqlalchemy2-stubs/#2
Change-Id: I71f53a6ced501ae144e28ce255cf3f50ea2b2e84

4 years agoMerge "Adjust dataclass rules to account for field w/ default"
mike bayer [Thu, 18 Mar 2021 19:47:02 +0000 (19:47 +0000)] 
Merge "Adjust dataclass rules to account for field w/ default"

4 years agoAdjust dataclass rules to account for field w/ default
Mike Bayer [Thu, 18 Mar 2021 19:07:03 +0000 (15:07 -0400)] 
Adjust dataclass rules to account for field w/ default

Fixed issue in new ORM dataclasses functionality where dataclass fields on
an abstract base or mixin that contained column or other mapping constructs
would not be mapped if they also included a "default" key within the
dataclasses.field() object.

Fixes: #6093
Change-Id: I628086ceb48ab1dd0702f239cd12be74074f58f1

4 years agoMerge "Raise at Core / ORM concrete inh level for label overlap"
mike bayer [Thu, 18 Mar 2021 18:44:24 +0000 (18:44 +0000)] 
Merge "Raise at Core / ORM concrete inh level for label overlap"

4 years agoAdd documentation for connecting to Azure SQL instances with managed identities
Alex Lowe [Mon, 15 Mar 2021 18:50:45 +0000 (14:50 -0400)] 
Add documentation for connecting to Azure SQL instances with managed identities

Fixes: #6031
Closes: #6032
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6032
Pull-request-sha: 00abfffd198a4c0e81bb5d15219dd4e40670ce94

Change-Id: Id67b21e6d2cc93f88d78e291e3bc8f87463377a6

4 years agoRaise at Core / ORM concrete inh level for label overlap
Mike Bayer [Thu, 18 Mar 2021 15:59:16 +0000 (11:59 -0400)] 
Raise at Core / ORM concrete inh level for label overlap

Fixed regression where the :class:`.ConcreteBase` would fail to map at all
when a mapped column name overlapped with the discriminator column name,
producing an assertion error. The use case here did not function correctly
in 1.3 as the polymorphic union would produce a query that ignored the
discriminator column entirely, while emitting duplicate column warnings. As
1.4's architecture cannot easily reproduce this essentially broken behavior
of 1.3 at the ``select()`` level right now, the use case now raises an
informative error message instructing the user to use the
``.ConcreteBase._concrete_discriminator_name`` attribute to resolve the
conflict. To assist with this configuration,
``.ConcreteBase._concrete_discriminator_name`` may be placed on the base
class only where it will be automatically used by subclasses; previously
this was not the case.

Fixes: #6090
Change-Id: I8b7d01e4c9ea0dc97f30b8cd658b3505b24312a7

4 years agoMerge "Restore Query.selectable"
mike bayer [Thu, 18 Mar 2021 16:04:45 +0000 (16:04 +0000)] 
Merge "Restore Query.selectable"

4 years agoRestore Query.selectable
Mike Bayer [Thu, 18 Mar 2021 14:27:28 +0000 (10:27 -0400)] 
Restore Query.selectable

Fixes: #6088
Change-Id: Id014fbd081c0659d1939d059779780798cc8c1dd

4 years agoRename column name that used a reserved word
Federico Caselli [Wed, 17 Mar 2021 20:28:44 +0000 (21:28 +0100)] 
Rename column name that used a reserved word

Rename column name used by a reflection query that used
a reserved word in some postgresql compatible databases.

Fixes: #6082
Change-Id: Ie81983316b72601a2e34543fa5ee95371e68aaf5

4 years agofix typo
Mike Bayer [Wed, 17 Mar 2021 19:07:50 +0000 (15:07 -0400)] 
fix typo

Change-Id: I7afb81cfa4f8041181c24666bb9acd71ff45692b

4 years agoVersion 1.4.2 placeholder
Mike Bayer [Wed, 17 Mar 2021 18:59:43 +0000 (14:59 -0400)] 
Version 1.4.2 placeholder

4 years ago- 1.4.1 rel_1_4_1
Mike Bayer [Wed, 17 Mar 2021 18:52:41 +0000 (14:52 -0400)] 
- 1.4.1

4 years agochangelog updates
Mike Bayer [Wed, 17 Mar 2021 18:50:27 +0000 (14:50 -0400)] 
changelog updates

Change-Id: I16aa216023b295501c675de420a722178b2121fb

4 years agoMerge remote-tracking branch 'origin/pr/6078'
Mike Bayer [Wed, 17 Mar 2021 18:32:21 +0000 (14:32 -0400)] 
Merge remote-tracking branch 'origin/pr/6078'

Change-Id: Ie02f8201f712b3fe673d4f15c5d82cab8395a87b

4 years agoMerge "Use explicit names for mapper _get_clause parameters"
mike bayer [Wed, 17 Mar 2021 18:28:30 +0000 (18:28 +0000)] 
Merge "Use explicit names for mapper _get_clause parameters"

4 years agoUse explicit names for mapper _get_clause parameters
Mike Bayer [Wed, 17 Mar 2021 15:04:58 +0000 (11:04 -0400)] 
Use explicit names for mapper _get_clause parameters

Fixed a critical regression in the relationship lazy loader where the SQL
criteria used to fetch a related many-to-one object could go stale in
relation to other memoized structures within the loader if the mapper had
configuration changes, such as can occur when mappers are late configured
or configured on demand, producing a comparison to None and returning no
object. Huge thanks to Alan Hamlett for their help tracking this down late
into the night.

The primary change is that mapper._get_clause() uses a fixed name
for its bound parameters, which is memoized under a lambda statement
in the case of many-to-one lazy loading.  This has implications for some other
logic namely the .compare() used by loader strategies to determine
use_get needed to be adjusted.

This change also repairs the lambda module's behavior of removing
the "required" flag from bound parameters, which caused this issue
to also fail silently rather than issuing an error for a required
bind parameter.

Fixes: #6055
Change-Id: I19e1aba9207a049873e0f13c19bad7541e223cfd

4 years agoMerge "Provide special row proxies for count and index"
mike bayer [Wed, 17 Mar 2021 17:02:21 +0000 (17:02 +0000)] 
Merge "Provide special row proxies for count and index"

4 years agowork around formatting issue with the :param: tag
Mike Bayer [Wed, 17 Mar 2021 16:39:27 +0000 (12:39 -0400)] 
work around formatting issue with the :param: tag

Fixes: #6075
Change-Id: Ia3f6109e3a038ddcf513d3e887b4cad0f776f0a6

4 years agoMerge "Ensure entity or None returned from _entity_from_pre_ent_zero()"
mike bayer [Wed, 17 Mar 2021 16:31:19 +0000 (16:31 +0000)] 
Merge "Ensure entity or None returned from _entity_from_pre_ent_zero()"

4 years agoProvide special row proxies for count and index
Mike Bayer [Wed, 17 Mar 2021 12:39:45 +0000 (08:39 -0400)] 
Provide special row proxies for count and index

The Python ``namedtuple()`` has the behavior such that the names ``count``
and ``index`` will be served as tuple values if the named tuple includes
those names; if they are absent, then their behavior as methods of
``collections.abc.Sequence`` is maintained. Therefore the
:class:`_result.Row` and :class:`_result.LegacyRow` classes have been fixed
so that they work in this same way, maintaining the expected behavior for
database rows that have columns named "index" or "count".

Fixes: #6074
Change-Id: I49a093da02f33f231d22ed5999c09fcaa3a68601

4 years agoFix typo in sqlalchemy2-stubs pypi link 6078/head
Charles-Axel Dein [Wed, 17 Mar 2021 13:26:24 +0000 (14:26 +0100)] 
Fix typo in sqlalchemy2-stubs pypi link

4 years agoEnsure entity or None returned from _entity_from_pre_ent_zero()
Mike Bayer [Wed, 17 Mar 2021 12:59:09 +0000 (08:59 -0400)] 
Ensure entity or None returned from _entity_from_pre_ent_zero()

Fixed regression where the :meth:`_orm.Query.exists` method would fail to
create an expression if the entity list of the :class:`_orm.Query` were
an arbitrary SQL column expression.

Fixes: #6076
Change-Id: I292dd5f527b2cbc1b76ca765b4ea321ef8535709

4 years agoMerge "Fix typo in Session.identity_key"
mike bayer [Wed, 17 Mar 2021 03:21:58 +0000 (03:21 +0000)] 
Merge "Fix typo in Session.identity_key"

4 years agoAdded back ``items`` and ``values`` to ``ColumnCollection`` class.
Federico Caselli [Tue, 16 Mar 2021 22:56:28 +0000 (23:56 +0100)] 
Added back ``items`` and ``values`` to ``ColumnCollection`` class.

Fixes: #6068
Change-Id: Idb42c864e17c02d7b89cffa667dcf853ec93e5c2

4 years agoMerge "turn off eager configure_mappers() outside of Query, Load"
mike bayer [Tue, 16 Mar 2021 22:38:45 +0000 (22:38 +0000)] 
Merge "turn off eager configure_mappers() outside of Query, Load"

4 years agoFix typo in Session.identity_key
Mike Bayer [Tue, 16 Mar 2021 22:32:30 +0000 (18:32 -0400)] 
Fix typo in Session.identity_key

Fixed regression in :meth:`_orm.Session.identity_key`, including that the
method and related methods were not covered by any unit test as well as
that the method contained a typo preventing it from functioning correctly.

Fixes: #6067
Change-Id: I1a84f9ed095c4226d57eef1c46996601dc2f1eaa

4 years agoRemove unneeded import
Mike Bayer [Tue, 16 Mar 2021 22:16:17 +0000 (18:16 -0400)] 
Remove unneeded import

this import forgot to get removed from
Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad , removing it
in post-production.

We will need "enum" soon enough when we go to Python 3 only.

Change-Id: I28297c2ed9f87fd0841076b861b8eeb610754dc3

4 years agoMerge "CAST the elements in ARRAYs when using psycopg2"
mike bayer [Tue, 16 Mar 2021 22:14:38 +0000 (22:14 +0000)] 
Merge "CAST the elements in ARRAYs when using psycopg2"

4 years agoturn off eager configure_mappers() outside of Query, Load
Mike Bayer [Tue, 16 Mar 2021 21:59:44 +0000 (17:59 -0400)] 
turn off eager configure_mappers() outside of Query, Load

Fixed regression where producing a Core expression construct such as
:func:`_sql.select` using ORM entities would eagerly configure the mappers,
in an effort to maintain compatibility with the :class:`_orm.Query` object
which necessarily does this to support many backref-related legacy cases.
However, core :func:`_sql.select` constructs are also used in mapper
configurations and such, and to that degree this eager configuration is
more of an inconvenience, so eager configure has been disabled for the
:func:`_sql.select` and other Core constructs in the absence of ORM loading
types of functions such as :class:`_orm.Load`.

The change maintains the behavior of :class:`_orm.Query` so that backwards
compatibility is maintained. However, when using a :func:`_sql.select` in
conjunction with ORM entities, a "backref" that isn't explicitly placed on
one of the classes until mapper configure time won't be available unless
:func:`_orm.configure_mappers` or the newer :func:`_orm.registry.configure`
has been called elsewhere. Prefer using
:paramref:`_orm.relationship.back_populates` for more explicit relationship
configuration which does not have the eager configure requirement.

Fixes: #6066
Change-Id: I7a953ddcc189471fbac63c97c51ab8956f64012e

4 years agoMerge "Turn off pyodbc setinputsizes() by default"
mike bayer [Tue, 16 Mar 2021 20:39:30 +0000 (20:39 +0000)] 
Merge "Turn off pyodbc setinputsizes() by default"

4 years agoMerge "Early-assign Base.registry to a private name"
mike bayer [Tue, 16 Mar 2021 20:38:48 +0000 (20:38 +0000)] 
Merge "Early-assign Base.registry to a private name"

4 years agoReword deprecation message for Connection.run_callable()
Mike Bayer [Tue, 16 Mar 2021 19:32:22 +0000 (15:32 -0400)] 
Reword deprecation message for Connection.run_callable()

based on feedback at
https://github.com/sqlalchemy/sqlalchemy/commit/00b5c10846e800304caa86549ab9da373b42fa5d#r48321551

Change-Id: Ibdf4b4fb86af0b8f282a7866883837915ea2934e

4 years agoEarly-assign Base.registry to a private name
Mike Bayer [Tue, 16 Mar 2021 19:03:22 +0000 (15:03 -0400)] 
Early-assign Base.registry to a private name

Fixed bug where user-mapped classes that contained an attribute named
"registry" would cause conflicts with the new registry-based mapping system
when using :class:`.DeclarativeMeta`. While the attribute remains
something that can be set explicitly on a declarative base to be
consumed by the metaclass, once located it is placed under a private
class variable so it does not conflict with future subclasses that use
the same name for other purposes.

Fixes: #6054
Change-Id: I1f2e04b0d74c493e7e90eadead4e861d8960a794

4 years agoTurn off pyodbc setinputsizes() by default
Mike Bayer [Tue, 16 Mar 2021 15:23:07 +0000 (11:23 -0400)] 
Turn off pyodbc setinputsizes() by default

Fixed regression where a new setinputsizes() API that's available for
pyodbc was enabled, which is apparently incompatible with pyodbc's
fast_executemany() mode in the absence of more accurate typing information,
which as of yet is not fully implemented or tested. The pyodbc dialect and
connector has been modified so that setinputsizes() is not used at all
unless the parameter ``use_setinputsizes`` is passed to the dialect, e.g.
via :func:`_sa.create_engine`, at which point its behavior can be
customized using the :meth:`.DialectEvents.do_setinputsizes` hook.

Fixes: #6058
Change-Id: I99c2be3a5cd76fc3e490d10865292ed85ffc23ae

4 years agoAdd missing changelog file
Mike Bayer [Tue, 16 Mar 2021 15:26:52 +0000 (11:26 -0400)] 
Add missing changelog file

This file was missing for #6052

Fixes: #6052
Change-Id: Ic0543e633a9f9dfbae08f1636437c543e2e0cd40

4 years agofix 1.4 migration notes about sqlite implementation of regexp_match() 6057/head
Sebastian Bank [Tue, 16 Mar 2021 08:18:02 +0000 (09:18 +0100)] 
fix 1.4 migration notes about sqlite implementation of regexp_match()

- follow-up ec264a5a2c810394ee4ebd7a78f83fc0ea785c1f

4 years agoCAST the elements in ARRAYs when using psycopg2
Federico Caselli [Wed, 10 Mar 2021 22:54:52 +0000 (23:54 +0100)] 
CAST the elements in ARRAYs when using psycopg2

Adjusted the psycopg2 dialect to emit an explicit PostgreSQL-style cast for
bound parameters that contain ARRAY elements. This allows the full range of
datatypes to function correctly within arrays. The asyncpg dialect already
generated these internal casts in the final statement. This also includes
support for array slice updates as well as the PostgreSQL-specific
:meth:`_postgresql.ARRAY.contains` method.

Fixes: #6023
Change-Id: Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad

4 years agoMove enable_eagerloads(False) out of _from_self() into count()
Mike Bayer [Tue, 16 Mar 2021 00:01:23 +0000 (20:01 -0400)] 
Move enable_eagerloads(False) out of _from_self() into count()

Fixed regression where calling upon :meth:`_orm.Query.count` in conjunction
with a loader option such as :func:`_orm.joinedload` would fail to ignore
the loader option. This is a behavior that has always been very specific to
the :meth:`_orm.Query.count` method; an error is normally raised if a given
:class:`_orm.Query` has options that don't apply to what it is returning.

Specifically, the call to enable_eagerloads(False) inside of
_from_self() is not needed as loader options are now not invoked
for subqueries.  Instead, set enable_eagerloads(False) in the
count() method itself, so that these options won't be considered
in this specific case.

Fixes: #6052
Change-Id: I0059ed3fb06156ef4116fd015cbef6f89808e8ef

4 years agoClarify LegacyRow / Row verbiage
Mike Bayer [Mon, 15 Mar 2021 23:34:49 +0000 (19:34 -0400)] 
Clarify LegacyRow / Row verbiage

Change-Id: I40db17216f09757ff49e87297ff9dd8aae18ed97
References: #6051

4 years agoVersion 1.4.1 placeholder
Mike Bayer [Mon, 15 Mar 2021 16:59:35 +0000 (12:59 -0400)] 
Version 1.4.1 placeholder

4 years ago- 1.4.0 rel_1_4_0
Mike Bayer [Mon, 15 Mar 2021 15:58:11 +0000 (11:58 -0400)] 
- 1.4.0

4 years agodocumentation updates
Mike Bayer [Mon, 15 Mar 2021 14:15:48 +0000 (10:15 -0400)] 
documentation updates

Change-Id: I43d0e8de1f90abcff4b278637808d1ebc8fd6c97

4 years agoMerge "Implement Mypy plugin"
mike bayer [Sun, 14 Mar 2021 21:31:08 +0000 (21:31 +0000)] 
Merge "Implement Mypy plugin"

4 years agoDocument NestedTransaction
Mike Bayer [Sun, 14 Mar 2021 16:28:46 +0000 (12:28 -0400)] 
Document NestedTransaction

Fixes: #3550
Change-Id: Ic2ff36ea434923590d2adbd101580025da319f66

4 years agoImplement Mypy plugin
Mike Bayer [Tue, 16 Feb 2021 23:36:50 +0000 (18:36 -0500)] 
Implement Mypy plugin

Rudimentary and experimental support for Mypy has been added in the form of
a new plugin, which itself depends on new typing stubs for SQLAlchemy. The
plugin allows declarative mappings in their standard form to both be
compatible with Mypy as well as to provide typing support for mapped
classes and instances.

Fixes: #4609
Change-Id: Ia035978c02ad3a5c0e5b3c6c30044dd5a3155170

4 years agotypo
Mike Bayer [Sat, 13 Mar 2021 02:21:39 +0000 (21:21 -0500)] 
typo

Change-Id: Ifaf3f708aa3ce73e365385ab7858eef3e4b8f3d3

4 years agoClarify ORM server side results
Mike Bayer [Fri, 12 Mar 2021 03:13:52 +0000 (22:13 -0500)] 
Clarify ORM server side results

the docs here implied that the buffering scheme used by
BufferedRowCursorFetchStrategy is also used by the ORM, however
this is not currently the case.  The ORM strictly uses the
"yield_per" option, which is either set explcitly, or passed
at result time via the fetchmany() / partitions() / yield_per()
methods.

Change-Id: I146595752dc227c97875de3c09ef9fc6f0fc836f

4 years agoMerge "Apply percent sign escaping to op(), custom_op()"
mike bayer [Tue, 9 Mar 2021 19:44:18 +0000 (19:44 +0000)] 
Merge "Apply percent sign escaping to op(), custom_op()"

4 years agoMerge remote-tracking branch 'origin/pr/6015'
Mike Bayer [Tue, 9 Mar 2021 18:45:38 +0000 (13:45 -0500)] 
Merge remote-tracking branch 'origin/pr/6015'

Change-Id: I9b8691cfe6d9ff6ffcef99c03d955e4002a596e8

4 years agoMerge remote-tracking branch 'origin/pr/6017'
Mike Bayer [Tue, 9 Mar 2021 18:44:39 +0000 (13:44 -0500)] 
Merge remote-tracking branch 'origin/pr/6017'

Change-Id: Ia99bc8990ac1072ad87a245b686196bd94029493

4 years agoApply percent sign escaping to op(), custom_op()
Mike Bayer [Tue, 9 Mar 2021 18:36:34 +0000 (13:36 -0500)] 
Apply percent sign escaping to op(), custom_op()

Fixed bug where the "percent escaping" feature that occurs with dialects
that use the "format" or "pyformat" bound parameter styles was not enabled
for the :meth:`.Operations.op` and :meth:`.Operations.custom_op` methods,
for custom operators that use percent signs. The percent sign will now be
automatically doubled based on the paramstyle as necessary.

Fixes: #6016
Change-Id: I285c5fc082481c2ee989edf1b02a83a6087ea26a

4 years agoLink to state, not object, for mutable extension
Mike Bayer [Tue, 9 Mar 2021 15:48:59 +0000 (10:48 -0500)] 
Link to state, not object, for mutable extension

The ``sqlalchemy.ext.mutable`` extension now tracks the "parents"
collection using the :class:`.InstanceState` associated with objects,
rather than the object itself. The latter approach required that the object
be hashable so that it can be inside of a ``WeakKeyDictionary``, which goes
against the behavioral contract of the ORM overall which is that ORM mapped
objects do not need to provide any particular kind of ``__hash__()`` method
and that unhashable objects are supported.

Fixes: #6020
Change-Id: I414c8861bc5691f5f320dac3eb696f4b8c37d347

4 years agoAdded import of synonym in example code in Synonym portion of docs 6017/head
Andres Torres [Tue, 9 Mar 2021 06:20:04 +0000 (22:20 -0800)] 
Added import of synonym in example code in Synonym portion of docs

4 years agoFix typo in docs 6015/head
Vasilis Gerakaris [Mon, 8 Mar 2021 15:38:46 +0000 (17:38 +0200)] 
Fix typo in docs

4 years agoFix typo in docs 6013/head
michaeltoohig [Mon, 8 Mar 2021 04:32:07 +0000 (15:32 +1100)] 
Fix typo in docs

4 years agoMerge "Add supported database version for internal dialects"
mike bayer [Sun, 7 Mar 2021 18:11:41 +0000 (18:11 +0000)] 
Merge "Add supported database version for internal dialects"

4 years agoAdd supported database version for internal dialects
Federico Caselli [Sat, 13 Feb 2021 20:20:58 +0000 (21:20 +0100)] 
Add supported database version for internal dialects

Change-Id: I08d150f1780a0f3a848c0edcd40013b5593d18f0

4 years agoMerge "Ignore flake8 F401 on specific files"
mike bayer [Sun, 7 Mar 2021 16:33:40 +0000 (16:33 +0000)] 
Merge "Ignore flake8 F401 on specific files"

4 years agoMerge "Ensure all Query statements compile w/ orm, fix test harness"
mike bayer [Sun, 7 Mar 2021 16:32:19 +0000 (16:32 +0000)] 
Merge "Ensure all Query statements compile w/ orm, fix test harness"

4 years agoMerge "Fix named CHECK constraint name omitted on repeated creates"
mike bayer [Sun, 7 Mar 2021 16:30:34 +0000 (16:30 +0000)] 
Merge "Fix named CHECK constraint name omitted on repeated creates"

4 years agoMerge "Replace reset_agent with direct call from connection"
mike bayer [Sun, 7 Mar 2021 16:27:56 +0000 (16:27 +0000)] 
Merge "Replace reset_agent with direct call from connection"

4 years agoReplace reset_agent with direct call from connection
Mike Bayer [Fri, 5 Mar 2021 22:34:10 +0000 (17:34 -0500)] 
Replace reset_agent with direct call from connection

Fixed a regression where the "reset agent" of the connection pool wasn't
really being utilized by the :class:`_engine.Connection` when it were
closed, and also leading to a double-rollback scenario that was somewhat
wasteful.   The newer architecture of the engine has been updated so that
the connection pool "reset-on-return" logic will be skipped when the
:class:`_engine.Connection` explicitly closes out the transaction before
returning the pool to the connection.

Fixes: #6004
Change-Id: I5d2ac16cac71aa45a00b4b7481d7268bd828a168

4 years agoFix named CHECK constraint name omitted on repeated creates
Gord Thompson [Sat, 6 Mar 2021 19:19:13 +0000 (12:19 -0700)] 
Fix named CHECK constraint name omitted on repeated creates

Fixed issue where the CHECK constraint generated by :class:`_types.Boolean`
or :class:`_types.Enum` would fail to render the naming convention
correctly after the first compilation, due to an unintended change of state
within the name given to the constraint. This issue was first introduced in
0.9 in the fix for issue #3067, and the fix revises the approach taken at
that time which appears to have been more involved than what was needed.

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

4 years agoimprove targeting and labeling for unary() in columns clause
Mike Bayer [Sat, 6 Mar 2021 02:52:03 +0000 (21:52 -0500)] 
improve targeting and labeling for unary() in columns clause

Fixed regression where usage of the standalone :func:`_sql.distinct()` used
in the form of being directly SELECTed would fail to be locatable in the
result set by column identity, which is how the ORM locates columns. While
standalone :func:`_sql.distinct()` is not oriented towards being directly
SELECTed (use :meth:`_sql.select.distinct` for a regular
``SELECT DISTINCT..``) , it was usable to a limited extent in this way
previously (but wouldn't work in subqueries, for example). The column
targeting for unary expressions such as "DISTINCT <col>" has been improved
so that this case works again, and an additional improvement has been made
so that usage of this form in a subquery at least generates valid SQL which
was not the case previously.

The change additionally enhances the ability to target elements in
``row._mapping`` based on SQL expression objects in ORM-enabled
SELECT statements, including whether the statement was invoked by
``connection.execute()`` or ``session.execute()``.

Fixes: #6008
Change-Id: I5cfa39435f5418861d70a7db8f52ab4ced6a792e

4 years agoMerge "Clarify COMMIT/ROLLBACK logging when autocommit is turned on"
mike bayer [Fri, 5 Mar 2021 21:21:59 +0000 (21:21 +0000)] 
Merge "Clarify COMMIT/ROLLBACK logging when autocommit is turned on"

4 years agoEnsure all Query statements compile w/ orm, fix test harness
Mike Bayer [Fri, 5 Mar 2021 21:02:38 +0000 (16:02 -0500)] 
Ensure all Query statements compile w/ orm, fix test harness

Fixed regression where :meth:`_orm.Query.join` would produce no effect if
the query itself as well as the join target were against a
:class:`_schema.Table` object, rather than a mapped class. This was part of
a more systemic issue where the legacy ORM query compiler would not be
correctly used from a :class:`_orm.Query` if the statement produced had not
ORM entities present within it.

Also repair the assert_compile() method, which was using
Query._compile_state() which was bypassing the bug.   A handful
of ORM tests with Query objects and Core-only objects were actually
failing if the default compilation path were used.

Fixes: #6003
Change-Id: I97478b2d06bf6c01fe1f09ee118e1f2ac4c849bc

4 years agoClarify COMMIT/ROLLBACK logging when autocommit is turned on
Mike Bayer [Fri, 5 Mar 2021 17:27:09 +0000 (12:27 -0500)] 
Clarify COMMIT/ROLLBACK logging when autocommit is turned on

Improved engine logging to note ROLLBACK and COMMIT which is logged while
the DBAPI driver is in AUTOCOMMIT mode. These ROLLBACK/COMMIT are library
level and do not have any effect when AUTOCOMMIT is in effect, however it's
still worthwhile to log as these indicate where SQLAlchemy sees the
"transaction" demarcation.

Fixes: #6002
Change-Id: I723636515193e0addc86dd0a3132bc23deadb81b

4 years agoreduce confusion over "one choice" verbiage
Mike Bayer [Fri, 5 Mar 2021 17:45:11 +0000 (12:45 -0500)] 
reduce confusion over "one choice" verbiage

I was trying to be funny with the "one and a half" choices
but this has been misleading some users, so clarify what
is meant.

Change-Id: I5451aa992ba870e0435e9b49eabb0e35b9976d59

4 years agoensure composite refresh handler synced w/ mutable composite
Mike Bayer [Fri, 5 Mar 2021 04:38:34 +0000 (23:38 -0500)] 
ensure composite refresh handler synced w/ mutable composite

Fixed issue where the :class:`_mutable.MutableComposite` construct could be
placed into an invalid state when the parent object was already loaded, and
then covered by a subsequent query, due to the composite properties'
refresh handler replacing the object with a new one not handled by the
mutable extension.

Fixes: #6001
Change-Id: Ieebd8e6afe6b65f8902cc12dec1efb968f5438ef

4 years agoMerge "Fix aggregate_order_by issue"
mike bayer [Thu, 4 Mar 2021 19:11:52 +0000 (19:11 +0000)] 
Merge "Fix aggregate_order_by issue"

4 years agouse zimports 0.3
Mike Bayer [Thu, 4 Mar 2021 16:11:48 +0000 (11:11 -0500)] 
use zimports 0.3

Change-Id: Ice8b9f9c1ef1446b6813e5bc9332f1323234cb5f

4 years agoFix aggregate_order_by issue
Gord Thompson [Thu, 4 Mar 2021 13:55:53 +0000 (06:55 -0700)] 
Fix aggregate_order_by issue

Fixes: #5989
Using array_agg() with aggregate_order_by() in
postgresql would sometimes return ARRAY(NullType)
instead of ARRAY(actual_type).

Change-Id: I05a0b2b7ea59291e3c04575578adcc337296e5a8

4 years agoIgnore flake8 F401 on specific files
Federico Caselli [Mon, 8 Feb 2021 21:12:06 +0000 (22:12 +0100)] 
Ignore flake8 F401 on specific files

Uses the flake8 option per-file-ignores that was introduced in a recent
version of flake8 (3.7.+) to avoid having lots of "noqa" in import
only files

Change-Id: Ib4871d63bad7e578165615df139cbf6093479201

4 years agoRemove passive_deletes warning for many-to-one
Mike Bayer [Tue, 2 Mar 2021 23:48:08 +0000 (18:48 -0500)] 
Remove passive_deletes warning for many-to-one

Removed very old warning that states that passive_deletes is not intended
for many-to-one relationships. While it is likely that in many cases
placing this parameter on a many-to-one relationship is not what was
intended, there are use cases where delete cascade may want to be
disallowed following from such a relationship.

Change-Id: I07adb726633f73f26296add4ec70376d5dcf8817
References: #5983

4 years agoadd missing copyright to asyncio files
Mike Bayer [Tue, 2 Mar 2021 21:25:09 +0000 (16:25 -0500)] 
add missing copyright to asyncio files

Change-Id: I6028b70bba76d6d9e1042762423d61f83644c085

4 years agoconvert AsyncSession.delete into awaitable
Mike Bayer [Tue, 2 Mar 2021 16:16:49 +0000 (11:16 -0500)] 
convert AsyncSession.delete into awaitable

The API for :meth:`_asyncio.AsyncSession.delete` is now an awaitable;
this method cascades along relationships which must be loaded in a
similar manner as the :meth:`_asyncio.AsyncSession.merge` method.

Fixes: #5998
Change-Id: Iae001efe99a1dcc47598b4a2491d17c4157fbbfa

4 years agoMerge remote-tracking branch 'origin/pr/5972'
Mike Bayer [Mon, 1 Mar 2021 14:04:54 +0000 (09:04 -0500)] 
Merge remote-tracking branch 'origin/pr/5972'

Change-Id: I754960d6fb68ef8413734f0dd6c17236f6dea16e

4 years agoMerge "disable all raiseload within the unit of work process."
mike bayer [Mon, 1 Mar 2021 12:38:11 +0000 (12:38 +0000)] 
Merge "disable all raiseload within the unit of work process."

4 years agodoc clarification re: schema translate
Mike Bayer [Mon, 1 Mar 2021 12:33:13 +0000 (07:33 -0500)] 
doc clarification re: schema translate

add tip that ORM session should use an option engine for schema
translate

Change-Id: I5807b486275cac72087be5217fff7c878783435f
References: #5978

4 years agodisable all raiseload within the unit of work process.
Mike Bayer [Fri, 26 Feb 2021 04:20:05 +0000 (23:20 -0500)] 
disable all raiseload within the unit of work process.

The unit of work process now turns off all "lazy='raise'" behavior
altogether when a flush is proceeding.  While there are areas where the UOW
is sometimes loading things that aren't ultimately needed, the lazy="raise"
strategy is not helpful here as the user often does not have much control
or visibility into the flush process.

Fixes: #5984
Change-Id: I23f2e332a5faa5c7c29823c9be9434d129676a5a