summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/mapper.py
Commit message (Collapse)AuthorAgeFilesLines
* - add cross-linking for passive_deletes / passive_updatesMike Bayer2014-02-161-2/+2
|
* - Fixed bug where :class:`.AbstractConcreteBase` would fail to beMike Bayer2014-02-111-4/+3
| | | | | | | | | | | | | | | | | | | | | 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.
* - Support is improved for supplying a :func:`.join` construct as theMike Bayer2014-01-221-2/+6
| | | | | | | | | | target of :paramref:`.relationship.secondary` for the purposes of creating very complex :func:`.relationship` join conditions. The change includes adjustments to query joining, joined eager loading to not render a SELECT subquery, changes to lazy loading such that the "secondary" target is properly included in the SELECT, and changes to declarative to better support specification of a join() object with classes as targets.
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - call it 0.9.0Mike Bayer2013-12-301-1/+1
|
* - Fixed bug when using joined table inheritance from a table to aMike Bayer2013-12-161-1/+3
| | | | | | | select/alias on the base, where the PK columns were also not same named; the persistence system would fail to copy primary key values from the base table to the inherited table upon INSERT. [ticket:2885]
* - documentation cleanup in ORM including [ticket:2816]Mike Bayer2013-12-071-29/+45
|
* - Added new argument ``include_backrefs=True`` to theMike Bayer2013-12-021-4/+18
| | | | | | | :func:`.validates` function; when set to False, a validation event will not be triggered if the event was initated as a backref to an attribute operation from the other side. [ticket:1535] - break out validation tests into an updated module test_validators
* Fix indentation and escape *args and **kwargsVraj Mohan2013-11-131-1/+1
|
* - modify what we did in [ticket:2793] so that we can also set theMike Bayer2013-09-061-2/+3
| | | | | version id programmatically outside of the generator. using this system, we can also leave the version id alone.
* - The ``version_id_generator`` parameter of ``Mapper`` can now be specifiedMike Bayer2013-08-251-33/+72
| | | | | | | | | | | | | | | | | | | | | to rely upon server generated version identifiers, using triggers or other database-provided versioning features, by passing the value ``False``. The ORM will use RETURNING when available to immediately load the new version identifier, else it will emit a second SELECT. [ticket:2793] - The ``eager_defaults`` flag of :class:`.Mapper` will now allow the newly generated default values to be fetched using an inline RETURNING clause, rather than a second SELECT statement, for backends that support RETURNING. - Added a new variant to :meth:`.ValuesBase.returning` called :meth:`.ValuesBase.return_defaults`; this allows arbitrary columns to be added to the RETURNING clause of the statement without interfering with the compilers usual "implicit returning" feature, which is used to efficiently fetch newly generated primary key values. For supporting backends, a dictionary of all fetched values is present at :attr:`.ResultProxy.returned_defaults`. - add a glossary entry for RETURNING - add documentation for version id generation, [ticket:867]
* fix typospr/23Hyunjun Kim2013-08-251-1/+1
|
* - use newly fixed WeakSequence (#2794) to not have to rely on class name for ↵Mike Bayer2013-08-181-5/+4
| | | | sorting in #2779
* formattingMike Bayer2013-08-181-1/+2
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-49/+377
| | | | | | | | | - 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
* - A large refactoring of the ``sqlalchemy.sql`` package has reorganizedMike Bayer2013-08-121-6/+6
| | | | | | | | | | | | | | | | | | | | | | the import structure of many core modules. ``sqlalchemy.schema`` and ``sqlalchemy.types`` remain in the top-level package, but are now just lists of names that pull from within ``sqlalchemy.sql``. Their implementations are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``, ``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``, ``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``. Most of the "factory" functions used to create SQL expression objects have been moved to classmethods or constructors, which are exposed in ``sqlalchemy.sql.expression`` using a programmatic system. Care has been taken such that all the original import namespaces remain intact and there should be no impact on any existing applications. The rationale here was to break out these very large modules into smaller ones, provide more manageable lists of function names, to greatly reduce "import cycles" and clarify the up-front importing of names, and to remove the need for redundant functions and documentation throughout the expression package.
* - additional fix for [ticket:2750] where on an update, we make sure theMike Bayer2013-06-301-1/+2
| | | | value is present
* A warning is emitted when trying to flush an object of an inheritedMike Bayer2013-06-301-1/+32
| | | | | mapped class where the polymorphic discriminator has been assigned to a value that is invalid for the class. [ticket:2750]
* dial back the default "flatness" a bit, it will be there for joinedload and ↵Mike Bayer2013-06-061-1/+1
| | | | | | | query.join(), but if you're dealing with aliased() or with_polymorphic() you need to say "flat=True". Just the one flag though, "flat" implies "aliased".
* repair py3kisms in key ORM modulesMike Bayer2013-05-261-6/+6
|
* import of "sqlalchemy" and "sqlalchemy.orm" works.Mike Bayer2013-04-271-2/+3
|
* - the raw 2to3 runMike Bayer2013-04-271-14/+14
| | | | - went through examples/ and cleaned out excess list() calls
* Improved the behavior of instance management regardingMike Bayer2013-04-201-1/+2
| | | | | | | | | | | | | | the creation of strong references within the Session; an object will no longer have an internal reference cycle created if it's in the transient state or moves into the detached state - the strong ref is created only when the object is attached to a Session and is removed when the object is detached. This makes it somewhat safer for an object to have a `__del__()` method, even though this is not recommended, as relationships with backrefs produce cycles too. A warning has been added when a class with a `__del__()` method is mapped. [ticket:2708]
* Fixed bug whereby ORM would run the wrong kind ofMike Bayer2013-04-111-0/+2
| | | | | | | | | query when refreshing an inheritance-mapped class where the superclass was mapped to a non-Table object, like a custom join() or a select(), running a query that assumed a hierarchy that's mapped to individual Table-per-class. [ticket:2697]
* - Fixed bug in unit of work whereby a joined-inheritanceMike Bayer2013-04-011-2/+14
| | | | | | | | | | | subclass could insert the row for the "sub" table before the parent table, if the two tables had no ForeignKey constraints set up between them. Also in 0.7.11. [ticket:2689] - fix a glitch in the assertsql.CompiledSQL fixture regarding when a multiparam compiledSQL is used within an AllOf - add a new utility function randomize_unitofwork() which does the function of --reversetop
* - remove all compat items that are pre-2.5 (hooray)Mike Bayer2013-03-091-1/+1
| | | | | | - other cleanup - don't need compat.decimal, that approach never panned out. hopefully outside libs aren't pulling it in, they shouldn't be
* - Improved checking for an existing backref name conflict duringMike Bayer2013-03-031-1/+11
| | | | | | | | | | | | | | | | | | | | mapper configuration; will now test for name conflicts on superclasses and subclasses, in addition to the current mapper, as these conflicts break things just as much. This is new for 0.8, but see below for a warning that will also be triggered in 0.7.11. - Improved the error message emitted when a "backref loop" is detected, that is when an attribute event triggers a bidirectional assignment between two other attributes with no end. This condition can occur not just when an object of the wrong type is assigned, but also when an attribute is mis-configured to backref into an existing backref pair. Also in 0.7.11. - A warning is emitted when a MapperProperty is assigned to a mapper that replaces an existing property, if the properties in question aren't plain column-based properties. Replacement of relationship properties is rarely (ever?) what is intended and usually refers to a mapper mis-configuration. Also in 0.7.11. [ticket:2674]
* the consideration of a pending object asMike Bayer2013-01-241-7/+18
| | | | | | | | | | | an "orphan" has been modified to more closely match the behavior as that of persistent objects, which is that the object is expunged from the :class:`.Session` as soon as it is de-associated from any of its orphan-enabled parents. Previously, the pending object would be expunged only if de-associated from all of its orphan-enabled parents. The new flag ``legacy_is_orphan`` is added to :func:`.orm.mapper` which re-establishes the legacy behavior. [ticket:2655]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* Extended the :doc:`/core/inspection` system so that all Python descriptorsMike Bayer2012-12-291-0/+37
| | | | | | | | associated with the ORM or its extensions can be retrieved. This fulfills the common request of being able to inspect all :class:`.QueryableAttribute` descriptors in addition to extension types such as :class:`.hybrid_property` and :class:`.AssociationProxy`. See :attr:`.Mapper.all_orm_descriptors`.
* - refactor of pathing mechanics, to address #2614, #2617Mike Bayer2012-12-011-3/+3
| | | | | | | | | | | | | | | | | | | - paths now store Mapper + MapperProperty now instead of string key, so that the parent mapper for the property is known, supports same-named properties on multiple subclasses - the Mapper within the path is now always relevant to the property to the right of it. PathRegistry does the translation now, instead of having all the outside users of PathRegistry worry about it, to produce a path that is much more consistent. Paths are now consistent with mappings in all cases. Special logic to get at "with_polymorphic" structures and such added also. - AliasedClass now has two modes, "use_mapper_path" and regular; "use_mapper_path" is for all those situations where we put an AliasedClass in for a plain class internally, and want it to "path" with the plain mapper. - The AliasedInsp is now the first class "entity" for an AliasedClass, and is passed around internally and used as attr._parententity and such. it is the AliasedClass analogue for Mapper.
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-6/+8
|
* - [feature] Improvements to event listening forMike Bayer2012-10-121-4/+1
| | | | | | | | | | | | | | | | | | | mapped classes allows that unmapped classes can be specified for instance- and mapper-events. The established events will be automatically set up on subclasses of that class when the propagate=True flag is passed, and the events will be set up for that class itself if and when it is ultimately mapped. [ticket:2585] - [bug] The instrumentation events class_instrument(), class_uninstrument(), and attribute_instrument() will now fire off only for descendant classes of the class assigned to listen(). Previously, an event listener would be assigned to listen for all classes in all cases regardless of the "target" argument passed. [ticket:2590]
* - rename .attr to .attrs on mapper, instance state, [ticket:2569]Mike Bayer2012-09-221-6/+6
|
* - [feature] Conflicts between columns onMike Bayer2012-08-271-3/+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]
* - update engine docstrings due to moveMike Bayer2012-08-131-1/+1
| | | | - struggle with Operators class autodoc
* - more fixes to py 3.3 tests, [ticket:2542]Mike Bayer2012-08-111-1/+1
|
* - [feature] Can now provide class-bound attributesMike Bayer2012-08-041-12/+6
| | | | | | that override columns which are of any non-ORM type, not just descriptors. [ticket:2535]
* - [bug] with_polymorphic() produces JOINsMike Bayer2012-08-011-2/+9
| | | | | | | in the correct order and with correct inheriting tables in the case of sending multi-level subclasses in an arbitrary order or with intermediary classes missing. [ticket:1900]
* - with InstanceState more public, underscore all its methodsMike Bayer2012-07-181-2/+80
| | | | | that change object state as these aren't intended for public use.
* this can be any expressionMike Bayer2012-07-181-3/+5
|
* - a big renaming of all the _Underscore classes to haveMike Bayer2012-07-171-4/+4
| | | | | | plain names. The old names are still defined for backwards compatibility. - _BindParamClause renamed to BindParameter
* - totally remove _entity_info and _extended_entity_info, replacing all usageMike Bayer2012-07-161-7/+18
| | | | with inspect()
* - express most of the orm.util functions in terms of the inspection systemMike Bayer2012-07-161-14/+46
| | | | | | | | | | | | | | - 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
* - [bug] Fixed bug mostly local to newMike Bayer2012-07-141-1/+6
| | | | | | | | | | | | | AbstractConcreteBase helper where the "type" attribute from the superclass would not be overridden on the subclass to produce the "reserved for base" error message, instead placing a do-nothing attribute there. This was inconsistent vs. using ConcreteBase as well as all the behavior of classical concrete mappings, where the "type" column from the polymorphic base would be explicitly disabled on subclasses, unless overridden explicitly.
* - [feature] *Very limited* support forMike Bayer2012-07-141-6/+7
| | | | | | | | | | | | | | inheriting mappers to be GC'ed when the class itself is deferenced. The mapper must not have its own table (i.e. single table inh only) without polymorphic attributes in place. This allows for the use case of creating a temporary subclass of a declarative mapped class, with no table or mapping directives of its own, to be garbage collected when dereferenced by a unit test. [ticket:2526]
* - break up configure_propertyMike Bayer2012-07-141-109/+131
| | | | - fix this test for 2.5
* move mapper-level UOW functionality straight into unitofwork also. there'sMike Bayer2012-07-141-31/+4
| | | | | | no need for this to be per-mapper. can't move dependency init off of property though as this init needs to happen up front, added a test to prove it.
* - move load_scalar_attributes out to loading.pyMike Bayer2012-07-141-83/+24
|
* - [bug] ORM will perform extra effort to determineMike Bayer2012-07-051-106/+128
| | | | | | | | | that an FK dependency between two tables is not significant during flush if the tables are related via joined inheritance and the FK dependency is not part of the inherit_condition, saves the user a use_alter directive. [ticket:2527]