| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Change-Id: I0d7f5105f838a0275f3c240441bdcdc9ae7444d0
|
| |
|
|
|
|
|
|
|
|
|
|
| |
A full rewrite of all imports and pep8 formatting using zimports, black,
commits are broken into sections.
Directories included in this commit:
lib/sqlalchemy/ext/
Change-Id: I3dd7aed3f42675e9ada64446ffd2758db7c3bc93
(cherry picked from commit 0716a292e03040ad4f96b890691b9e2c888ec11d)
|
| | |
|
| |
|
|
| |
includes adjustment to setup.py to recognize __version__ correctly
|
| |
|
|
|
|
|
|
|
|
|
|
| |
since "left" is kind of ambiguous, use more explicit terminology
here.
Also update the test to use a positive assertion that the
warning is emitted; quote the attribute name.
Change-Id: Ic2284c200a26b32b2da063cfaf6d59547309d587
References: https://github.com/zzzeek/sqlalchemy/pull/488
(cherry picked from commit eacb31a89fe883edd0ada7f2724239c1f8c5b685)
|
| |
|
|
|
|
|
|
|
|
| |
A warning is emitted in the case that a :func:`.column` object is applied to
a declarative class, as it seems likely this intended to be a
:class:`.Column` object.
Fixes: #4374
Change-Id: I2e617ef65547162e3ba6587c168548ad0cf6203d
(cherry picked from commit 6ec40eca1a03a9156ee82f3ce75850778220b39e)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The column conflict resolution technique discussed at
:ref:`declarative_column_conflicts` is now functional for a :class:`.Column`
that is also a primary key column. Previously, a check for primary key
columns declared on a single-inheritance subclass would occur before the
column copy were allowed to pass.
Fixes: #4352
Change-Id: Id4c025da53c28e58db6b549fe398f25f8a90d355
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/483
(cherry picked from commit 3ed79a5c18c14d842280805d1dae8a9c99ec8f18)
|
| |
|
|
|
|
|
|
|
|
|
| |
Fixed regression caused by :ticket:`4326` in version 1.2.12 where using
:class:`.declared_attr` with a mixin in conjunction with
:func:`.orm.synonym` would fail to map the synonym properly to an inherited
subclass.
Fixes: #4350
Change-Id: Ib2a9b6a125a2ac7c7ff80201746b7f10e5596226
(cherry picked from commit 9335c24d6c98033f4aa1ceafd23a70b88c8ae811)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug where the declarative scan for attributes would receive the
expression proxy delivered by a hybrid attribute at the class level, and
not the hybrid attribute itself, when receiving the descriptor via the
``@declared_attr`` callable on a subclass of an already-mapped class. This
would lead to an attribute that did not report itself as a hybrid when
viewed within :attr:`.Mapper.all_orm_descriptors`.
Fixes: #4326
Change-Id: I582d03f05c3768b3344f93e3791240e9e69b9d1e
(cherry picked from commit 626356842d77d4ec6427b3bfc04bdff93d24d246)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed issue in previously untested use case, allowing a declarative mapped
class to inherit from a classically-mapped class outside of the declarative
base, including that it accommodates for unmapped intermediate classes. An
unmapped intermediate class may specify ``__abstract__``, which is now
interpreted correctly, or the intermediate class can remain unmarked, and
the classically mapped base class will be detected within the hierarchy
regardless. In order to anticipate existing scenarios which may be mixing
in classical mappings into existing declarative hierarchies, an error is
now raised if multiple mapped bases are detected for a given class.
Fixes: #4321
Change-Id: I8604ecfd170d2589d9d1b1c87ba303762071fc30
(cherry picked from commit 4c931b2ec7e0f09ac8c3ebe28c794f5858d54efb)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Removed a warning that would be emitted when calling upon
``__table_args__``, ``__mapper_args__`` as named with a ``@declared_attr``
method, when called from a non-mapped declarative mixin. Calling these
directly is documented as the approach to use when one is overidding one
of these methods on a mapped class. The warning still emits for regular
attribute names.
Change-Id: Iae7ed0bd625a2c163c910aa777cef4779128580a
Fixes: #4221
(cherry picked from commit 37955a52995cdbb66a9d5835c20ee58fb98ddffc)
|
| |
|
|
|
|
|
|
| |
The map_column example was incorrect, and overall the purpose
of this parameter as well as that of synonym_for was not explained;
examples added along with more encouragement to use hybrids.
Change-Id: I20bd286f541f798daa81fa598c0f31db1f5aa6ed
|
| |
|
|
| |
Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A warning is emitted if a subclass attempts to override an attribute
that was declared on a superclass using ``@declared_attr.cascading``
that the overridden attribute will be ignored. This use
case cannot be fully supported down to further subclasses without more
complex development efforts, so for consistency the "cascading" is
honored all the way down regardless of overriding attributes.
A warning is emitted if the ``@declared_attr.cascading`` attribute is
used with a special declarative name such as ``__tablename__``, as this
has no effect.
Ensure that documenation refers to the current inconsistency that
__tablename__ can be overridden by subclasses however
@declared_attr.cascading cannot.
Fixes: #4091
Fixes: #4092
Change-Id: I3aecdb2f99d408e404a1223f5ad86ae3c7fdf036
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
A warning is emitted if the :attr:`.declared_attr.cascading` modifier
is used with a declarative attribute that is itself declared on
a class that is to be mapped, as opposed to a declarative mixin
class or ``__abstract__`` class. The :attr:`.declared_attr.cascading`
modifier currently only applies to mixin/abstract classes.
Also add a test for @declared_attr.cascading when used on an attribute
on __abstract__.
Change-Id: Ib1b9dbe373e8be1cf24eadfed224a8988b3cd95d
Fixes: #3847
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug where using :class:`.declared_attr` on an
:class:`.AbstractConcreteBase` where a particular return value were some
non-mapped symbol, including ``None``, would cause the attribute
to hard-evaluate just once and store the value to the object
dictionary, not allowing it to invoke for subclasses. This behavior
is normal when :class:`.declared_attr` is on a mapped class, and
does not occur on a mixin or abstract class. Since
:class:`.AbstractConcreteBase` is both "abstract" and actually
"mapped", a special exception case is made here so that the
"abstract" behavior takes precedence for :class:`.declared_attr`.
Change-Id: I6160ebb3a52c441d6a4b663c8c9bbac6d37fa417
Fixes: #3848
|
| |
|
|
|
|
|
|
|
|
| |
Protected against testing "None" as a class in the case where
declarative classes are being garbage collected and new
automap prepare() operations are taking place concurrently, very
infrequently hitting a weakref that has not been fully acted upon
after gc.
Change-Id: I32e1dfc5ac46bac4127fe808cfd18368e2fad9dd
|
| |
|
|
|
|
|
|
|
|
| |
Fixed bug where the "automatic exclude" feature of declarative that
ensures a column local to a single table inheritance subclass does
not appear as an attribute on other derivations of the base would
not take effect for multiple levels of subclassing from the base.
Change-Id: Ibf67b631b4870dd1bd159f7d6085549d299fffe0
Fixes: #3895
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
| |
Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
|
| |
|
|
|
| |
The second 'if' condition was never called because the original
condition always returns.
|
| |
|
|
| |
Change-Id: I468fe70168804b08cf0d5e8b57e235bca904b1ff
|
| |
|
|
|
|
|
| |
Also improves some naming in the examples.
Change-Id: I51e5b1d9a730885aed10e5e6ade2123f5e736359
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/306
|
| |
|
|
|
| |
Change-Id: I5ad44362515908592f1e8b1e6254a5270d43234a
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/295
|
| | |
|
| |
|
|
| |
same column
|
| | |
|
| |
|
|
|
| |
- remove redundant concrete helper docs from declarative docs,
two places is enough
|
| |
|
|
|
|
|
|
| |
Fixed bug where in Py2K a unicode literal would not be accepted as the
string name of a class or other argument within declarative using
:func:`.backref` on :func:`.relationship`.
amends commit e6f67f48054d906856f879bc1803ea639aa4b670
|
| |
|
|
|
|
|
|
|
| |
a column setup on the ABC base which had a different attribute
name vs. column name would not be correctly mapped on the final
base class. The failure on 0.9 would be silent whereas on
1.0 it raised an ArgumentError, so may not have been noticed
prior to 1.0.
fixes #3480
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
event where its invocation was moved to be after the class manager's
instrumentation of the class, which is the opposite of what the
documentation for the event explicitly states. The rationale for the
switch was due to Declarative taking the step of setting up
the full "instrumentation manager" for a class before it was mapped
for the purpose of the new ``@declared_attr`` features
described in :ref:`feature_3150`, but the change was also made
against the classical use of :func:`.mapper` for consistency.
However, SQLSoup relies upon the instrumentation event happening
before any instrumentation under classical mapping.
The behavior is reverted in the case of classical and declarative
mapping, the latter implemented by using a simple memoization
without using class manager.
fixes #3388
|
| |
|
|
| |
fixes #3383
|
| |
|
|
|
|
| |
and ``__declare_last__`` accessors where these would no longer be
called on the superclass of the declarative base.
fixes #3383
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
objects, such that they were prevented from being called outside
of the declarative process; this is related to the enhancements
of #3150 which allow ``@declared_attr`` to return a value that is
cached based on the current class as it's being configured.
The exception raise has been removed, and the behavior changed
so that outside of the declarative process, the function decorated by
``@declared_attr`` is called every time just like a regular
``@property``, without using any caching, as none is available
at this stage.
fixes #3331
|
| | |
|
| |
|
|
|
|
|
| |
of a declarative inheritance hierarchy would prevent attributes
and configuration being correctly propagated from the base class
to the inheriting class.
fixes #3219 fixes #3240
|
| | |
|
| |
|
|
|
|
|
|
|
| |
subclass, the value returned by the descriptor is not available
because the superclass is already mapped with the InstrumentedAttribute,
until the subclass is mapped. We add a setattr() to set up that
attribute so that the __mapper_args__ hook and possibly others
have access to the "cascaded" version of the attribute within
the call.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
and extensions into an external library, and also reorganizes most large documentation
pages into many small areas to reduce scrolling and better present the context
into a more fine-grained hierarchy.
|
| |
|
|
|
|
| |
when using :class:`.AbstractConcreteBase` in conjunction with
a subclass that declares ``__abstract__``.
fixes #3185
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that are now affixed to _MapperConfig
- declarative now creates column copies ahead of time
so that they are ready to go for a declared_attr
- overhaul of declared_attr; memoization, cascading modifier
- A relationship set up with :class:`.declared_attr` on
a :class:`.AbstractConcreteBase` base class will now be configured
on the abstract base mapping automatically, in addition to being
set up on descendant concrete classes as usual.
fixes #2670
- The :class:`.declared_attr` construct has newly improved
behaviors and features in conjunction with declarative. The
decorated function will now have access to the final column
copies present on the local mixin when invoked, and will also
be invoked exactly once for each mapped class, the returned result
being memoized. A new modifier :attr:`.declared_attr.cascading`
is added as well. fixes #3150
- the original plan for #3150 has been scaled back; by copying
mixin columns up front and memoizing, we don't actually need
the "map properties later" thing.
- full docs + migration notes
|
| |
|
|
|
|
|
|
| |
setups, where the attempt to check for "duplicate class name" in
declarative would hit upon a not-totally-cleaned-up weak reference
related to some other class being removed; the check here now ensures
the weakref still references an object before calling upon it further.
fixes #3208
|
| | |
|
| |
|
|
| |
to get all flake8 passing
|
| |
|
|
|
|
|
| |
distinguished for when it was actually the value ``False``.
The ``__abstract__`` flag needs to acutally evaluate to a True
value at the level being tested.
fixes #3097
|
| |
|
|
|
|
|
|
|
| |
mixin or abstract class when accessed, so that modifications made
to this dictionary by declarative itself won't conflict with that
of other mappings. The dictionary is modified regarding the
``version_id_col`` and ``polymorphic_on`` arguments, replacing the
column within with the one that is officially mapped to the local
class/table. fixes #3062
|
| |
|
|
| |
Found using: https://github.com/intgr/topy
|