summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative.py
Commit message (Collapse)AuthorAgeFilesLines
* - reorganization of declarative such that file sizes are managable again.Mike Bayer2012-08-051-1940/+0
| | | | | | | | | | | | | | | | | | | | | 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.
* pep8 stuffMike Bayer2012-08-051-11/+9
|
* - move ext to relative importsMike Bayer2012-07-171-9/+9
|
* - express most of the orm.util functions in terms of the inspection systemMike Bayer2012-07-161-101/+101
| | | | | | | | | | | | | | - modify inspection system: 1. raise a new exception for any case where the inspection context can't be returned. this supersedes the "not mapped" errors. 2. don't configure mappers on a mapper inspection. this allows the inspectors to be used during mapper config time. instead, the mapper configures on "with_polymorphic_selectable" now, which is needed for all queries - add a bunch of new "is_XYZ" attributes to inspectors - finish making the name change of "compile" -> "configure", for some reason this was only done partially
* - [feature] The registry of classesMike Bayer2012-07-141-2/+2
| | | | | | | | | in declarative_base() is now a WeakValueDictionary. So subclasses of "Base" that are dereferenced will be garbage collected, *if they are not referred to by any other mappers/superclass mappers*. [ticket:2526]
* remove ambiguous languageMike Bayer2012-06-181-2/+7
|
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-10/+17
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.
* - [bug] Fixed bug in declarativeMike Bayer2012-05-241-6/+3
| | | | | | | | | | | | | | whereby the precedence of columns in a joined-table, composite column (typically for id) would fail to be correct if the columns contained names distinct from their attribute names. This would cause things like primaryjoin conditions made against the entity attributes to be incorrect. Related to [ticket:1892] as this was supposed to be part of that, this is [ticket:2491]. Also in 0.7.8.
* looks like I finally stepped on someone elses dunders...will have to figure outMike Bayer2012-05-201-3/+3
| | | | how to make a public API for this anyway
* - reorganize the usage of __mapper_args__ so that it's onlyMike Bayer2012-05-181-106/+142
| | | | | called after the __prepare__() step, if any, so that everything to do with the mapping occurs after the table is reflected.
* - [feature] The "deferred declarativeMike Bayer2012-05-171-8/+11
| | | | | | | | | | | | | | | | reflection" system has been moved into the declarative extension itself, using the new DeferredReflection class. This class is now tested with both single and joined table inheritance use cases. [ticket:2485] - [bug] The autoload_replace flag on Table, when False, will cause any reflected foreign key constraints which refer to already-declared columns to be skipped, assuming that the in-Python declared column will take over the task of specifying in-Python ForeignKey or ForeignKeyConstraint declarations.
* - add DeferredReflection to declarative itselfMike Bayer2012-05-171-24/+113
| | | | - split out test_declarative into four separate modules
* clean this up some more. __mapper__ isn't even set up.Mike Bayer2012-05-151-14/+11
|
* implement support for __prepare__ declarative method. this signals thatMike Bayer2012-05-151-10/+51
| | | | | | | | the mapping should not be constructed immediately; instead, the info for the mapping is placed into an interm object _MapperThingy which serves as the mapper for the purposes of figuring out inheritance, etc. Later, the prepare_deferred_mapping() function can be called given a base which will invoke __prepare__ for each mapped class.
* - merged #1401 branch from bitbucketMike Bayer2012-04-221-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - resolved some serious speed hits I missed, we need to ensure only deannotated columns are used in the local/remote collections and soforth so that hash lookups against mapped columns don't dig into __eq__() - fix some other parity mismatches regarding stuff from [ticket:2453], including finding another case where _deep_annotate() was doing the wrong thing, new tests. - [feature] Major rewrite of relationship() internals now allow join conditions which include columns pointing to themselves within composite foreign keys. A new API for very specialized primaryjoin conditions is added, allowing conditions based on SQL functions, CAST, etc. to be handled by placing the annotation functions remote() and foreign() inline within the expression when necessary. Previous recipes using the semi-private _local_remote_pairs approach can be upgraded to this new approach. [ticket:1401]
| * - move create_lazy_clause() to relationshipsMike Bayer2012-04-011-1/+5
| | | | | | | | - add foreign, remote annotations to declarative
* | - add __table_cls__ option to declarative, not publicized yet, is for the momentMike Bayer2012-03-121-1/+7
|/ | | | | | | | | | | | | | for the benefit of the test.lib.schema package. - use test.lib.schema.Table for the table within test.lib.fixtures.DeclarativeMappedTest - [bug] Removed the check for number of rows affected when doing a multi-delete against mapped objects. If an ON DELETE CASCADE exists between two rows, we can't get an accurate rowcount from the DBAPI; this particular count is not supported on most DBAPIs in any case, MySQLdb is the notable case where it is. [ticket:2403]
* declarative reflection exampleMike Bayer2012-01-281-1/+34
|
* add examples for multi metadata under __abstract__, custom vertical partitioningMike Bayer2012-01-111-0/+21
|
* happy new yearMike Bayer2012-01-041-1/+1
|
* document that strings are accepted with declarative/secondaryMike Bayer2011-12-291-0/+9
|
* - [feature] Added "class_registry" argument toMike Bayer2011-12-281-1/+12
| | | | | declarative_base(). Allows two or more declarative bases to share the same registry of class names.
* fix a whole bunch of note:: / warning:: that were inline,Mike Bayer2011-12-251-3/+5
| | | | no longer compatible with docutils 0.8
* - [bug] __table_args__ can now be passed asMike Bayer2011-12-041-9/+9
| | | | | | an empty tuple as well as an empty dict. [ticket:2339]. Thanks to Fayaz Yusuf Khan for the patch.
* - [bug] Fixed bug whereby a subclass of a subclassMike Bayer2011-10-281-11/+18
| | | | | | | | | | | | | | using concrete inheritance in conjunction with the new ConcreteBase or AbstractConcreteBase would fail to apply the subclasses deeper than one level to the "polymorphic loader" of each base [ticket:2312] - [bug] Fixed bug whereby a subclass of a subclass using the new AbstractConcreteBase would fail to acquire the correct "base_mapper" attribute when the "base" mapper was generated, thereby causing failures later on. [ticket:2312]
* plus a period. seriously. should i just watch TV today instead of ↵Mike Bayer2011-10-171-1/+1
| | | | screwing more things up
* and i screwed it upMike Bayer2011-10-171-1/+6
|
* updated conventions on mixinsMike Bayer2011-10-171-17/+26
|
* link to declarative concrete helper docrel_0_7_3Mike Bayer2011-10-161-0/+2
|
* fix typos [ticket:2294] [ticket:2300]. these are both due to reworkings of ↵Mike Bayer2011-10-151-3/+0
| | | | 0.6 docs that don't have these typos
* warn when a subclass' base uses @declared_attr for a regular column -Mike Bayer2011-09-261-0/+6
| | | | does not propagate to subclasses. [ticket:2283]
* fix sentenceMike Bayer2011-09-101-1/+1
|
* - New event hook, MapperEvents.after_configured().Mike Bayer2011-09-101-6/+205
| | | | | | | | | | | | | | | | | | | | | | | | Called after a configure() step has completed and mappers were in fact affected. Theoretically this event is called once per application, unless new mappings are constructed after existing ones have been used already. - New declarative features: - __declare_last__() method, establishes an event listener for the class method that will be called when mappers are completed with the final "configure" step. - __abstract__ flag. The class will not be mapped at all when this flag is present on the class. - New helper classes ConcreteBase, AbstractConcreteBase. Allow concrete mappings using declarative which automatically set up the "polymorphic_union" when the "configure" mapper step is invoked. - The mapper itself has semi-private methods that allow the "with_polymorphic" selectable to be assigned to the mapper after it has already been configured. [ticket:2239]
* declarify the mapper config docsMike Bayer2011-08-071-50/+2
|
* - rework tutorial to be all declarative, all the timeMike Bayer2011-08-061-11/+54
| | | | - add detail to declarative docs about base classes
* - Added an informative error message whenMike Bayer2011-07-211-2/+0
| | | | | | | | | ForeignKeyConstraint refers to a column name in the parent that is not found. Also in 0.6.9. - add tests for [ticket:2226], as if we hit each @declared_attr directly with obj.__get__(obj, name) instead of using getattr(cls, name). Basic inheritance mechanics are improperly used in this case, so 2226 is invalid.
* - add doc to schema docs linking to declarative usage of __table__Mike Bayer2011-07-011-0/+35
| | | | | - add more examples to __table__ such as that asked on a recent stackoverflow question.
* - remove NamingConventions as an example here since it doesn't applyMike Bayer2011-06-141-4/+8
| | | | - add link to the concrete declarative thing
* - Fixed declarative bug where a class inheritingMike Bayer2011-06-141-2/+1
| | | | | | from a superclass of the same name would fail due to an unnecessary lookup of the name in the _decl_class_registry. [ticket:2194]
* - mapper() will ignore non-configured foreign keysMike Bayer2011-05-071-8/+0
| | | | | | | | to unrelated tables when determining inherit condition between parent and child class. This is equivalent to behavior already applied to declarative. [ticket:2153] Also in 0.6.8.
* - some doc reorgMike Bayer2011-03-171-7/+7
| | | | | | | | | | - change engine.Connection to _connection_cls so sphinx doesn't get upset - globally add "." to all :class:`Foo` - start naming sections that are mostly docstrings "API Documentation - blah blah" - move some ad-hoc docstrings into "API" sections, there is some inconsistency here and it may be that we just have to leave it that way - add "internals" rsts to core, orm, I'm not super thrilled how these look but they are targeted by some of the public api docs, users typically become aware of these anyway
* - Arguments in __mapper_args__ that aren't "hashable"Mike Bayer2011-03-141-4/+6
| | | | | aren't mistaken for always-hashable, possibly-column arguments. [ticket:2091]
* - Fix error message referencing old @classpropertyMike Bayer2011-02-191-2/+2
| | | | name to reference @declared_attr [ticket:2061]
* - the dictionary at the end of the __table_args__Mike Bayer2011-02-171-14/+16
| | | | tuple is now optional. [ticket:1468]
* - Fixed regression whereby composite() withMike Bayer2011-02-141-4/+6
| | | | | | | | Column objects placed inline would fail to initialize. The Column objects can now be inline with the composite() or external and pulled in via name or object ref. [ticket:2058]
* - Added an explicit check for the case that the nameMike Bayer2011-02-121-14/+20
| | | | | 'metadata' is used for a column attribute on a declarative class. [ticket:2050]
* - tests for hybridMike Bayer2011-01-171-61/+0
| | | | | - documentation for hybrid - rewrite descriptor, synonym, comparable_property documentation
* - The Index() construct can be created inline with a TableMike Bayer2011-01-041-1/+20
| | | | | definition, using strings as column names, as an alternative to the creation of the index outside of the Table.
* - sorry, I really don't want metaclass recipes in the main documentation. ↵Mike Bayer2011-01-041-74/+0
| | | | | | | Don't want people using them, thinking they're needed in the general case, confused, etc. The two sections here are moved to the wiki for now.
* - whitespace removal bonanzaMike Bayer2011-01-021-73/+73
|