summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative/api.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove some legacy dead code from the declared_attr logicpr/315Pierre Jaury2016-10-161-3/+0
| | | | | The second 'if' condition was never called because the original condition always returns.
* - some documentation hitsMike Bayer2016-10-011-0/+9
| | | | Change-Id: I468fe70168804b08cf0d5e8b57e235bca904b1ff
* Remove extra "return" statement in orm.ext.declared_attr.cascading examplesDmitry Bogun2016-10-011-8/+5
| | | | | | | Also improves some naming in the examples. Change-Id: I51e5b1d9a730885aed10e5e6ade2123f5e736359 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/306
* Add docstring to declarative_baseFrazer McLean2016-08-061-0/+6
| | | | | Change-Id: I5ad44362515908592f1e8b1e6254a5270d43234a Pull-request: https://github.com/zzzeek/sqlalchemy/pull/295
* Fix reference to _declarative_constructor in docstringMichael Williamson2016-07-251-1/+1
|
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - cross link for concrete helper classesMike Bayer2016-01-201-0/+16
| | | | | - remove redundant concrete helper docs from declarative docs, two places is enough
* - Fixed bug in :class:`.AbstractConcreteBase` extension whereMike Bayer2015-07-131-1/+12
| | | | | | | | | 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-13/+8
| | | | | | | | | | | | | | | | | 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
* - Loosened some restrictions that were added to ``@declared_attr``Mike Bayer2015-03-181-9/+6
| | | | | | | | | | | | | 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
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - Fixed "'NoneType' object has no attribute 'concrete'" errorMike Bayer2014-10-061-1/+1
| | | | | | when using :class:`.AbstractConcreteBase` in conjunction with a subclass that declares ``__abstract__``. fixes #3185
* - refactor of declarative, break up into indiviudal methodsMike Bayer2014-09-251-16/+167
| | | | | | | | | | | | | | | | | | | | | | | 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-14/+17
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - use an OrderedDict here so that tests are more deterministicMike Bayer2014-02-141-2/+2
|
* - Fixed bug where :class:`.AbstractConcreteBase` would fail to beMike Bayer2014-02-111-3/+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.
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - Fixed an extremely unlikely memory issue where when usingMike Bayer2014-01-031-12/+15
| | | | | | | | | | :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.
* - The :class:`.DeferredReflection` class has been enhanced to provideMike Bayer2013-12-031-1/+23
| | | | | | | | | | | | | | | | automatic reflection support for the "secondary" table referred to by a :func:`.relationship`. "secondary", when specified either as a string table name, or as a :class:`.Table` object with only a name and :class:`.MetaData` object will also be included in the reflection process when :meth:`.DeferredReflection.prepare` is called. [ticket:2865] - clsregistry._resolver() now uses a stateful _class_resolver() class in order to handle the work of mapping strings to objects. This is to provide for simpler extensibility, namely a ._resolvers collection of ad-hoc name resolution functions; the DeferredReflection class adds its own resolver here in order to handle relationship(secondary) names which generate new Table objects.
* Fixed a syntax error in example code.Hyunjun Kim2013-11-291-1/+1
|
* Fix cross referencesVraj Mohan2013-11-171-7/+7
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-1/+2
| | | | | | | | | - 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
* tpoMike Bayer2013-07-201-9/+9
|
* - Improved the examples in ``examples/generic_associations``, includingMike Bayer2013-07-191-0/+40
| | | | | | | | | | | | | | | that ``discriminator_on_association.py`` makes use of single table inheritance do the work with the "discriminator". Also added a true "generic foreign key" example, which works similarly to other popular frameworks in that it uses an open-ended integer to point to any other table, foregoing traditional referential integrity. While we don't recommend this pattern, information wants to be free. Also in 0.8.3. - Added a convenience class decorator :func:`.as_declarative`, is a wrapper for :func:`.declarative_base` which allows an existing base class to be applied using a nifty class-decorated approach. Also in 0.8.3.
* - fixing AbstractConcreteBase import in docstring, [ticket:2717]Diana Clarke2013-05-261-1/+1
|
* Fixed indirect regression regarding :func:`.has_inherited_table`,Mike Bayer2013-04-091-1/+1
| | | | | | | | | | | where since it considers the current class' ``__table__``, was sensitive to when it was called. This is 0.7's behavior also, but in 0.7 things tended to "work out" within events like ``__mapper_args__()``. :func:`.has_inherited_table` now only considers superclasses, so should return the same answer regarding the current class no matter when it's called (obviously assuming the state of the superclass). [ticket:2656]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/ext/declarativeDiana Clarke2012-11-191-2/+12
|
* - fix declarative __init__Mike Bayer2012-10-041-4/+2
|
* - [feature] declared_attr can now be used withMike Bayer2012-08-271-5/+6
| | | | | | 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/+3
| | | | | | | 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]
* - reorganization of declarative such that file sizes are managable again.Mike Bayer2012-08-051-0/+436
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.