summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative/base.py
Commit message (Collapse)AuthorAgeFilesLines
* Mention the correct way of adding multiple attributes which refer to the ↵pr/257Eoghan Murray2016-04-071-1/+2
| | | | same column
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - Fixed bug in :class:`.AbstractConcreteBase` extension whereMike Bayer2015-07-131-1/+0
| | | | | | | | | 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
* - Fixed a regression regarding the :meth:`.MapperEvents.instrument_class`Mike Bayer2015-04-261-5/+5
| | | | | | | | | | | | | | | | | 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
* - add the "strict" version of this lookup for __abstract__ as well,Mike Bayer2015-04-241-2/+2
| | | | fixes #3383
* - Fixed regression regarding the declarative ``__declare_first__``Mike Bayer2015-04-241-9/+11
| | | | | | and ``__declare_last__`` accessors where these would no longer be called on the superclass of the declarative base. fixes #3383
* - Fixed bug where using an ``__abstract__`` mixin in the middleMike Bayer2015-03-101-0/+21
| | | | | | | 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
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - repair issue in declared_attr.cascading such that within aMike Bayer2015-02-241-0/+2
| | | | | | | | | 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.
* Maul the evaulate & friends typoPriit Laes2014-12-191-1/+1
|
* commentsMike Bayer2014-09-261-3/+8
|
* - refactor of declarative, break up into indiviudal methodsMike Bayer2014-09-251-299/+393
| | | | | | | | | | | | | | | | | | | | | | | 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
* PEP8 style fixesBrian Jarrett2014-07-131-57/+55
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - Fixed bug when the declarative ``__abstract__`` flag was not beingMike Bayer2014-06-251-1/+1
| | | | | | | 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
* - The ``__mapper_args__`` dictionary is copied from a declarativeMike Bayer2014-05-301-1/+4
| | | | | | | | | 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
* - Fixed bug where :class:`.AbstractConcreteBase` would fail to beMike Bayer2014-02-111-0/+4
| | | | | | | | | | | | | | | | | | | | | fully usable within declarative relationship configuration, as its string classname would not be available in the registry of classnames at mapper configuration time. The class now explicitly adds itself to the class regsitry, and additionally both :class:`.AbstractConcreteBase` as well as :class:`.ConcreteBase` set themselves up *before* mappers are configured within the :func:`.configure_mappers` setup, using the new :meth:`.MapperEvents.before_configured` event. [ticket:2950] - Added new :meth:`.MapperEvents.before_configured` event which allows an event at the start of :func:`.configure_mappers`, as well as ``__declare_first__()`` hook within declarative to complement ``__declare_last__()``. - modified how after_configured is invoked; we just make a dispatch() not actually connected to any mapper. this makes it easier to also invoke before_configured correctly. - improved the ComparableEntity fixture to handle collections that are sets.
* - Fixed bug where the :class:`.AutomapBase` class of theMike Bayer2014-02-081-3/+25
| | | | | | | new automap extension would fail if classes were pre-arranged in single or potentially joined inheritance patterns. The repaired joined inheritance issue could also potentially apply when using :class:`.DeferredReflection` as well.
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - Fixed an extremely unlikely memory issue where when usingMike Bayer2014-01-031-7/+48
| | | | | | | | | | :class:`.DeferredReflection` to define classes pending for reflection, if some subset of those classes were discarded before the :meth:`.DeferredReflection.prepare` method were called to reflect and map the class, a strong reference to the class would remain held within the declarative internals. This internal collection of "classes to map" now uses weak references against the classes themselves.
* - A quasi-regression where apparently in 0.8 you can set a class-levelMike Bayer2014-01-021-1/+20
| | | | | | | | | | | attribute on declarative to simply refer directly to an :class:`.InstrumentedAttribute` on a superclass or on the class itself, and it acts more or less like a synonym; in 0.9, this fails to set up enough bookkeeping to keep up with the more liberalized backref logic from :ticket:`2789`. Even though this use case was never directly considered, it is now detected by declarative at the "setattr()" level as well as when setting up a subclass, and the mirrored/renamed attribute is now set up as a :func:`.synonym` instead. [ticket:2900]
* - Declarative does an extra check to detect if the sameMike Bayer2013-12-271-1/+14
| | | | | | | :class:`.Column` is mapped multiple times under different properties (which typically should be a :func:`.synonym` instead) or if two or more :class:`.Column` objects are given the same name, raising a warning if this condition is detected. [ticket:2828]
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-1/+1
| | | | | | | | | - rework the event system so that event modules load after their targets, dependencies are reversed - create an improved strategy lookup system for the ORM - rework the ORM to have very few import cycles - move out "importlater" to just util.dependency - other tricks to cross-populate modules in as clear a way as possible
* - fix a dict while iterate mutationMike Bayer2013-05-271-1/+1
| | | | | - illustrate how OrderedDict can catch these, but commented out to save function overhead
* a pass where we try to squash down as many list()/keys() combinationsMike Bayer2013-05-261-2/+2
| | | | as possible
* - the raw 2to3 runMike Bayer2013-04-271-4/+4
| | | | - went through examples/ and cleaned out excess list() calls
* this step is not neededMike Bayer2013-02-251-3/+0
|
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/ext/declarativeDiana Clarke2012-11-191-7/+13
|
* - [bug] Fixed a disconnect that slowly evolvedMike Bayer2012-09-141-2/+6
| | | | | | | | | | | between a @declared_attr Column and a directly-defined Column on a mixin. In both cases, the Column will be applied to the declared class' table, but not to that of a joined inheritance subclass. Previously, the directly-defined Column would be placed on both the base and the sub table, which isn't typically what's desired. [ticket:2565]
* - [feature] declared_attr can now be used withMike Bayer2012-08-271-1/+4
| | | | | | attributes that are not Column or MapperProperty; including any user-defined value as well as association proxy objects. [ticket:2517]
* - [feature] Conflicts between columns onMike Bayer2012-08-271-2/+2
| | | | | | | single-inheritance declarative subclasses, with or without using a mixin, can be resolved using a new @declared_attr usage described in the documentation. [ticket:2472]
* - [bug] Declarative can now propagate a columnMike Bayer2012-08-151-0/+5
| | | | | | | | declared on a single-table inheritance subclass up to the parent class' table, when the parent class is itself mapped to a join() or select() statement, directly or via joined inheritane, and not just a Table. [ticket:2549]
* - reorganization of declarative such that file sizes are managable again.Mike Bayer2012-08-051-0/+418
the vast majority of file lines are spent on documentation, which moves into package __init__. The core declarative idea lives in base and is back down to its originally low size of under 500 lines. The various helpers and such move into api.py, and the full span of string lookup moves into a new module clsregistry. the rest of declarative only refers to two functions in clsregistry in three places inside of base. - [feature] Declarative now maintains a registry of classes by string name as well as by full module-qualified name. Multiple classes with the same name can now be looked up based on a module-qualified string within relationship(). Simple class name lookups where more than one class shares the same name now raises an informative error message. [ticket:2338] - lots of tests to ensure the new weak referencing memory management is maintained by the new class registry system. this ticket was served very well by waiting to do #2526 first, else this would have needed to be rewritten anyway.