| Commit message (Collapse) | Author | Age | Files | Lines |
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
An :class:`.InvalidRequestError` is raised when a :func:`.synonym`
is used against an attribute that is not against a :class:`.MapperProperty`,
such as an association proxy. Previously, a recursion overflow would
occur trying to locate non-existent attributes.
Change-Id: If2ce38c429a69951df4c94b71b74edbd59d775e3
Fixes: #4067
(cherry picked from commit 130f31ca79c7b40b2cb8aa1a4af7049408074d12)
|
| |/
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed race condition in ORM identity map which would cause objects
to be inappropriately removed during a load operation, causing
duplicate object identities to occur, particularly under joined eager
loading which involves deduplication of objects. The issue is specific
to garbage collection of weak references and is observed only under the
Pypy interpreter.
Change-Id: I9f6ae3fe5b078f26146af82b15d16f3a549a9032
Fixes: #4068
(cherry picked from commit 37c5ed2ed948250d7244d1e6e17da37a27c24698)
|
| |
|
|
|
|
|
|
|
|
|
| |
Fixed bug in :meth:`.Session.merge` where objects in a collection that had
the primary key attribute set to ``None`` for a key that is typically
autoincrementing would be considered to be a database-persisted key for
part of the internal deduplication process, causing only one object to
actually be inserted in the database.
Change-Id: I0a6e00043be0b2979cda33740e1be3b430ecf8c7
Fixes: #4056
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug where an :func:`.undefer_group` option would not be recognized
if it extended from a relationship that was loading using joined eager
loading.
In particular we need to double check the column both in terms of
the given "adapter" as well as without applying the "adapter"
when searching for the column in the result.
As we now avoid redoing the row processor step we also
improve on callcounts in joined eager loading.
Change-Id: I0f48766f12f7299f4626ff41a00bf1f5bfca5f3b
Fixes: #4048
(cherry picked from commit eee9dfd4514801f0c67f71632fc722731171479b)
|
| |
|
|
|
| |
Change-Id: I9fe6c42c097d31b50a479250d39a3cd8ebcbffaf
(cherry picked from commit 41549de9609bce90942ca6afc75978d5254c8fd5)
|
| |
|
|
|
|
|
| |
in mariadb 10.2. more mariadb fixes coming
Change-Id: I6e3a94ae7340772663677b1082506adbb2d84a38
(cherry picked from commit 54cdda032ea59789be15972ed0529f71fd4f0214)
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixed bug involving JSON NULL evaluation logic added in 1.1 as part
of :ticket:`3514` where the logic would not accommodate ORM
mapped attributes named differently from the :class:`.Column`
that was mapped.
Change-Id: I1848afcfb63ad7f074f315d8d3097666069b42be
Fixes: #4031
(cherry picked from commit e2ede596adff3ce584f8c43ba024cafabc509a06)
|
| |/
|
|
|
|
|
|
|
|
|
| |
Fixed issue where adding additional non-entity columns to
a query that includes an entity with subqueryload relationships
would fail, due to an inspection added in 1.1.11 as a result of
:ticket:`4011`.
Change-Id: I8ef082be649125bdc07b428cb9b0a77a65d73671
Fixes: #4033
(cherry picked from commit 3d41ea09a899b06feedd02864a69b8dc833f5a6b)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of checking that the "orig_entity" we receive applies
as a correct FROM element for the subquery we're building,
set the FROM clause of the query to exactly what it already
is based on column_descriptions (assuming there is no FROM
list already), thereby ensuring that the FROM list will remain
intact, regardless of what orig_entity turns out to be and
what the target_cols ultimately refer towards.
Fixed issue with subquery eagerloading which continues on from
the series of issues fixed in :ticket:`2699`, :ticket:`3106`,
:ticket:`3893` involving that the "subquery" contains the correct
FROM clause when beginning from a joined inheritance subclass
and then subquery eager loading onto a relationship from
the base class, while the query also includes criteria against
the subclass. The fix in the previous tickets did not accommodate
for additional subqueryload operations loading more deeply from
the first level, so the fix has been further generalized.
Change-Id: Ic909590814f71e577d8266b1dbc4c393dc48e019
Fixes: #4011
(cherry picked from commit 6d2a03c1ec21cc428c91476c170ad7dbe219926c)
|
| |
|
|
| |
Change-Id: I172999198217b9a09f136664f5a7e38e7e099df6
|
| |
|
|
|
|
| |
which applies to a 1.2 regression
Change-Id: Ic99508dbf48e63b97975cb06fcb84e73135e0f4f
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
membership removal
in issue #3844 we hypotheized that passive_deletes='all' was broken
because it sets to NULL a foreign key attribute when the child
object is removed or replaced. However, not doing the NULL
set means that nothing happens at all and the operation silently
fails.
Change-Id: I11834e7e324349e172dc797bac62731008b6b95a
(cherry picked from commit acf64c4178169b765f3f7ae492b1774955cf541f)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed a (extremely old) bug in cascade_mappers where the
first cascade we do is against the "self" mapper, and not the
one that actually corresponds to the state given. These are
different in the case where we start with a relationship
to a class, and the instance is of a subclass, which itself
can have relationships that aren't on the base mapper.
A pretty severe bug that somehow has avoided the radar
since the beginning.
Change-Id: I512956b9757b07e06f3ca1ccb507a33fb10bed31
Fixes: #3986
(cherry picked from commit 0f8721fa52e335ab2abeb548c8914b99a8c5e1fd)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An :func:`.aliased()` construct can now be passed to the
:meth:`.Query.select_entity_from` method. Entities will be pulled
from the selectable represented by the :func:`.aliased` construct.
This allows special options for :func:`.aliased` such as
:paramref:`.aliased.adapt_on_names` to be used in conjunction with
:meth:`.Query.select_entity_from`.
Additionally rewrote the docstring for :meth:`.Query.select_entity_from`,
including starting with explicit use of :func:`.aliased` as the
usual idiomatic pattern. An example using text().columns() is added
as well as the use case from :ticket:`3933` using name matching.
Change-Id: If7e182965236993064a2a086e3b6d55a4f097ca8
Fixes: #3933
(cherry picked from commit b5577b6fb3decda0293399a630e6601e86e08726)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed two closely related bugs involving the mapper eager_defaults
flag in conjunction with single-table inheritance; one where the
eager defaults logic would inadvertently try to access a column
that's part of the mapper's "exclude_properties" list (used by
Declarative with single table inheritance) during the eager defaults
fetch, and the other where the full load of the row in order to
fetch the defaults would fail to use the correct inheriting mapper.
Fixes: #3908
Change-Id: Ie745174c917d512e2c46d9e3cc14512cde53cc9a
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed a major inefficiency in the "eager_defaults" feature whereby
an unnecessary SELECT would be emitted for column values where the
ORM had explicitly inserted NULL, corresponding to attributes that
were unset on the object but did not have any server default
specified, as well as expired attributes on update that nevertheless
had no server onupdate set up. As these columns are not part of the
RETURNING that eager_defaults tries to use, they should not be
post-SELECTed either.
Change-Id: I0d4f1e9d3d9717d68dcc0592f69456a1f1c36df8
Fixes: #3909
|
| |
|
|
|
|
|
|
| |
tested using pycodestyle version 2.2.0
Fixes: #3885
Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
|
| |
|
|
|
|
|
|
|
|
|
| |
Fixed bug first introduced in 0.9.7 as a result of :ticket:`3106`
which would cause an incorrect query in some forms of multi-level
subqueryload against aliased entities, with an unnecessary extra
FROM entity in the innermost subquery.
Fixes: #3893
Change-Id: Ic4003c2c1c0206bd22a098fd497a7375c2758305
|
| |
|
|
| |
Change-Id: I3f294b4d153979c308532360d03ab7be3c5d994a
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug in subquery loading where an object encountered as an
"existing" row, e.g. already loaded from a different path in the
same query, would not invoke subquery loaders for unloaded attributes
that specified this loading. This issue is in the same area
as that of :ticket:`3431`, :ticket:`3811` which involved
similar issues with joined loading.
Change-Id: If111a76b0812010905b0ac811276a816779d297f
Fixes: #3854
|
| |
|
|
|
|
|
|
|
|
|
| |
Corrects some warnings and adds tox config. Adds DeprecationWarning
to the error category. Large sweep for string literals w/ backslashes
as this is common in docstrings
Co-authored-by: Andrii Soldatenko
Fixes: #3886
Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
|
| |
|
|
|
|
|
|
|
|
| |
Fixed bug involving joined eager loading against multiple entities
when polymorphic inheritance is also in use which would throw
"'NoneType' object has no attribute 'isa'". The issue was introduced
by the fix for :ticket:`3611`.
Change-Id: I296ecda38c01ec8f69dcd843beaebed6949cecfa
Fixes: #3884
|
| |
|
|
|
|
|
|
|
|
| |
The :attr:`.Session.no_autoflush` context manager now ensures that
the autoflush flag is reset within a "finally" block, so that if
an exception is raised within the block, the state still resets
appropriately. Pull request courtesy Emin Arakelian.
Change-Id: Ib19ddf32074b1df82a6a1f1ae14e3a962cd31a5f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/335
|
| |
|
|
| |
Change-Id: I7efcfb56826963e4702d19107db3c9d37c4fcb64
|
| |
|
|
|
|
|
| |
This was using a different connection which could deadlock on
SQL Server.
Change-Id: Ia7953f362c99d9247dd47c3f5c3b0b91c96db1a5
|
| |
|
|
|
|
|
|
|
| |
Fixed bug where the single-table inheritance query criteria would not
be inserted into the query in the case that the :class:`.Bundle`
construct were used as the selection criteria.
Change-Id: Ib7c128ceef5c3220a098cdfd0270c43a2a67716d
Fixes: #3874
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug related to :ticket:`3177`, where a UNION or other set operation
emitted by a :class:`.Query` would apply "single-inheritance" criteria
to the outside of the union (also referencing the wrong selectable),
even though this criteria is now expected to
be already present on the inside subqueries. The single-inheritance
criteria is now omitted once union() or another set operation is
called against :class:`.Query` in the same way as :meth:`.Query.from_self`.
Change-Id: I0fd1331c7ba85a758a1c15e06c271914f2c717f3
Fixes: #3856
|
| |
|
|
|
|
|
|
|
|
| |
the refactor in b606e47ddc54 / ticket:3457 failed
to adjust __getstate__ / __setstate__. need to memoize
a few more things including the class itself so that we
can navigate back to "attr".
Change-Id: I4ece2a616cb8b9dac7b50763ca59e47d0f26cfdf
Fixes: #3852
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug where the :attr:`.Mapper.attrs`,
:attr:`.Mapper.all_orm_descriptors` and other derived attributes would
fail to refresh when mapper properties or other ORM constructs were
added to the mapper/class after these accessors were first called.
(also trying different ways to get the changelog to merge cleanly)
Change-Id: Iaecdb4b3d8c3a3b44302a5880476e60a1f4e27d9
Fixes: #3778
|
| |
|
|
|
|
|
|
|
| |
The version id needs to be part of _changed_dict()
so that the value is present to send to
_emit_update_statements()
Change-Id: Ia85f0ef7714296a75cdc6c88674805afbbe752c8
Fixes: #3781
|
| |
|
|
|
|
|
|
| |
Fixed bug in :meth:`.Session.bulk_update_mappings` where an alternate-named
primary key attribute would not track properly into the UPDATE statement.
Change-Id: I33e9140f45827772768fa548adcfeb4dbfc2208d
Fixes: #3849
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Options like uselist and backref can be determined from
within _register_attribute based on parent_property
given; move this logic inside so that individual strategies
have less responsibility. Also don't require that
_register_attribute consider the "strategy" itself
at all; it would be better if we could no longer require
that Joined/Subquery/etc loaders call upon the "lazy" strategy
in order to initialize attribute instrumentation and
this could be done more generically.
Fixes long-standing bug where the "noload" relationship loading
strategy would cause backrefs and/or back_populates options to be
ignored. There is concern that some application that uses
"noload" might be surprised at a back-populating attribute
appearing suddenly, which may have side effects. However,
"noload" itself must be extremely seldom used since as a
strategy, it already disables loading, population of attributes
is the only behavior that is even supported, so that this issue has existed
for at least through 0.7 four years ago without ever being
reported indicates extremely low use of this option.
Change-Id: Icffb9c83ac5782b76ce882ed1df4361a1efbfba3
Fixes: #3845
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed regression caused by :ticket:`2677` whereby calling
:meth:`.Session.delete` on an object that was already flushed as
deleted in that session would fail to set up the object in the
identity map (or reject the object), causing flush errors as the
object were in a state not accommodated by the unit of work.
The pre-1.1 behavior in this case has been restored, which is that
the object is put back into the identity map so that the DELETE
statement will be attempted again, which emits a warning that the number
of expected rows was not matched (unless the row were restored outside
of the session).
Change-Id: I9a8871f82cb1ebe67a7ad54d888d5ee835a9a40a
Fixes: #3839
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
_ColumnEntity didn't seem to have .mapper present, which
due to the way _mapper_zero() worked didn't tend to come
across it. With :ticket:`3608` _mapper_zero() has
been simplified so make sure this is now present.
Also ensure that _select_from_entity is an entity and
not a mapped class, though this does not seem to matter
at the moment.
Fixes: #3836
Change-Id: Id6dae8e700269b97de3b01562edee95ac1e01f80
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new variant to the "isnew" state within entity loading
for isnew=False, but the load path is new. This is to address
the use case of an entity appearing in multiple places in
the row in a more generalized way than the fixes in [ticket:3431],
[ticket:3811] in that loading.py will be able to tell the
populator that this row is not "isnew" but is a "new" path
for the entity. For the moment, the new information is only
being applied to the use of "quick" populators so that
simple column loads can take place on top of a deferred loader
from elsewhere in the row.
As part of this change, state.load_path() will now always
be populated with the "path" that was in effect when this state
was originally loaded, which for multi-path loads of the
same entity is still non-deterministic. Ideally there'd be some
kind of "here's all the paths that loaded this state and how"
type of data structure though it's not clear if that could be
done while maintaining performance.
Fixes: #3822
Change-Id: Ib915365353dfcca09e15c24001a8581113b97d5e
|
| |
|
|
|
|
|
|
|
| |
Discovered during testing for [ticket:3822], the rule added
for [ticket:1495] will fail if the source object has propagated
options set up, which add elements to query._current_path.
Fixes: #3824
Change-Id: I3d96c96fee5f9b247f739d2136d18681ac61f2fe
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ORM attributes can now be assigned any object that is has a
``__clause_element__()`` attribute, which will result in inline
SQL the way any :class:`.ClauseElement` class does. This covers other
mapped attributes not otherwise transformed by further expression
constructs.
As part of this, it was considered that we could add
__clause_element__() to ClauseElement, however this causes endless loops
in a "while" pattern and this pattern has been identified in third
party libraries. Add a test to ensure we never make that change.
Change-Id: I9e15b3f1c4883fd3909acbf7dc81d034c6e3ce1d
Fixes: #3802
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The "raise_on_sql" option differentiates from "raise" in that
firing a lazy loader is OK as long as it does a simple
get from identity map. Whereas "raise" is more useful
for the case that objects are to be detached.
As part of this, refactors the strategy initiation logic
a bit so that a LoaderStrategy itself knows what "key" was used
to create it, thus allowing variants of a single strategy
based on what the "lazy" argument is. To achieve this we
have to also get rid of _get_strategy_by_cls().
Everything here is internal with the one exception of an apparently
undocumented, but not underscored, "strategy_class" key
on relationship(). Though it's not clear what
"strategy_class" accomplishes; at this point the strategy
system is extensible using Property.strategy_for().
Fixes: #3812
Change-Id: I812ad878ea5cf764e15f6f71cb39eee78a645d88
|
| |/
|
|
|
|
|
|
|
|
|
| |
The change in #3431 still checks that the instance() is
non-None, deferring to other loading schemes if it is.
These columns are dedicated towards the entity however, so if the value
is None, we should set it. If it conflicts, we are detecting that
in any case.
Change-Id: I223768e2898e843f953e910da1f9564b137d95e4
Fixes: #3811
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Add checks in spots where state.obj() might be late-GC'ed before
we get a chance to call the event. There may be more cases
of these which we should address as they come up. The Session
should always be maintaining strong refs to objects that have
pending operations left on them, so for these cases we need
to ensure that ref remains long enough for the event to be called.
Change-Id: I1a7c7bc57130acc11f54ad55924af2e36ac75101
Fixes: #3808
|
| |
|
|
|
|
|
|
|
| |
Fixed bug where joined eager loading would fail for a polymorphically-
loaded mapper, where the polymorphic_on was set to an un-mapped
expression such as a CASE expression.
Change-Id: Iffe68196aaac592165c89684f09f4c06cd78ce54
Fixes: #3800
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are cases where the originating mapper name is not
present in the exception message, such as relationship initialization
against an unmapped class. Ensure the originating mapper is named
in the string output.
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/298
Change-Id: I9f23bfa90b26dde9229ab7ec812eec9ceae48153
|
| |\ \ |
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Removes an unnecessary transfer of modified PK column
value to the params dictionary, so that if the modified PK column
is already present in value_params, this remains in effect. Also
propagate a new flag through to _emit_update_statements() that will
trip "return_defaults()" across the board if a PK col w/ SQL expression
change is present, and pull this PK value in _postfetch as well assuming
we're an UPDATE.
Change-Id: I9ae87f964df9ba8faea8e25e96b8327f968e5d1b
Fixes: #3801
|
| |\ \ |
|