summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/mapper.py
Commit message (Collapse)AuthorAgeFilesLines
* 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]
* - move all of orm to use absolute importsMike Bayer2012-06-231-341/+28
| | | | | | | | - break out key mechanics of loading objects into new "orm.loading" module, removing implementation details from both mapper.py and query.py. is analogous to persistence.py - some other cleanup and old cruft removal
* - [removed] Deprecated identifiers removed:Mike Bayer2012-06-211-18/+6
| | | | | | | | | | | | | | * allow_null_pks mapper() argument (use allow_partial_pks) * _get_col_to_prop() mapper method (use get_property_by_column()) * dont_load argument to Session.merge() (use load=True) * sqlalchemy.orm.shard module (use sqlalchemy.ext.horizontal_shard)
* - [feature] The of_type() construct on attributesMike Bayer2012-06-201-30/+43
| | | | | | | | | | | | | | | | | | | | | | | | now accepts aliased() class constructs as well as with_polymorphic constructs, and works with query.join(), any(), has(), and also eager loaders subqueryload(), joinedload(), contains_eager() [ticket:2438] [ticket:1106] - a rewrite of the query path system to use an object based approach for more succinct usage. the system has been designed carefully to not add an excessive method overhead. - [feature] select() features a correlate_except() method, auto correlates all selectables except those passed. Is needed here for the updated any()/has() functionality. - remove some old cruft from LoaderStrategy, init(),debug_callable() - use a namedtuple for _extended_entity_info. This method should become standard within the orm internals - some tweaks to the memory profile tests, number of runs can be customized to work around pysqlite's very annoying behavior - try to simplify PropertyOption._get_paths(), rename to _process_paths(), returns a single list now. overall works more completely as was needed for of_type() functionality
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-1/+3
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.
* - [feature] New standalone function with_polymorphic()Mike Bayer2012-04-231-1/+2
| | | | | | | | | | | provides the functionality of query.with_polymorphic() in a standalone form. It can be applied to any entity within a query, including as the target of a join in place of the "of_type()" modifier. [ticket:2333] - redo a large portion of the inheritance docs in terms of declarative, new with_polymorphic() function - upgrade examples/inheritance/polymorph, rename to "joined"
* merge patch for [ticket:2208]. This still needs documentation.Mike Bayer2012-04-231-6/+30
|\
| * - the inspect interface is done, needs docs.Mike Bayer2012-04-041-3/+3
| | | | | | | | | | - start dressing up InstanceState for it's coming out, start moving internal things to be underscored within the lib
| * begin implementing inspection system for #2208Mike Bayer2012-04-031-5/+29
| |
* | - [feature] Added new flag to @validatesMike Bayer2012-04-111-2/+10
|/ | | | | | | | include_removes. When True, collection remove and attribute del events will also be sent to the validation function, which accepts an additional argument "is_remove" when this flag is used.
* - [bug] Fixed bug whereby if a method nameMike Bayer2012-02-121-6/+13
| | | | | | | conflicted with a column name, a TypeError would be raised when the mapper tried to inspect the __get__() method on the method object. [ticket:2352]
* break out _save_obj(), _delete_obj(), _post_update() into a new moduleMike Bayer2012-01-301-623/+6
| | | | | | | persistence.py - Mapper loses awareness of how to emit INSERT/UPDATE/DELETE, persistence.py is only used by unitofwork.py. Then break each method out into a top level with almost no logic, calling into _organize_states_for_XYZ(), _collect_XYZ_commands(), _emit_XYZ_statements().