summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/strategies.py
Commit message (Collapse)AuthorAgeFilesLines
* - Added a new directive used within the scope of an attribute "set" operationMike Bayer2014-01-311-1/+3
| | | | | | | | to disable autoflush, in the case that the attribute needs to lazy-load the "old" value, as in when replacing one-to-one values or some kinds of many-to-one. A flush at this point otherwise occurs at the point that the attribute is None and can cause NULL violations. [ticket:2921]
* - Support is improved for supplying a :func:`.join` construct as theMike Bayer2014-01-221-0/+4
| | | | | | | | | | 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
|
* - An adjustment to the :func:`.subqueryload` strategy which ensures thatMike Bayer2013-12-161-8/+32
| | | | | | | the query runs after the loading process has begun; this is so that the subqueryload takes precedence over other loaders that may be hitting the same attribute due to other eager/noload situations at the wrong time. [ticket:2887]
* - Added new argument ``include_backrefs=True`` to theMike Bayer2013-12-021-2/+2
| | | | | | | :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
* - The ``viewonly`` flag on :func:`.relationship` will now preventMike Bayer2013-11-191-0/+1
| | | | | | | | | | attribute history from being written on behalf of the target attribute. This has the effect of the object not being written to the Session.dirty list if it is mutated. Previously, the object would be present in Session.dirty, but no change would take place on behalf of the modified attribute during flush. The attribute still emits events such as backref events and user-defined events and will still receive mutations from backrefs. [ticket:2833]
* - Added new option to :func:`.relationship` ``distinct_target_key``.Mike Bayer2013-10-131-5/+21
| | | | | | | | | | | | | | | This enables the subquery eager loader strategy to apply a DISTINCT to the innermost SELECT subquery, to assist in the case where duplicate rows are generated by the innermost query which corresponds to this relationship (there's not yet a general solution to the issue of dupe rows within subquery eager loading, however, when joins outside of the innermost subquery produce dupes). When the flag is set to ``True``, the DISTINCT is rendered unconditionally, and when it is set to ``None``, DISTINCT is rendered if the innermost relationship targets columns that do not comprise a full primary key. The option defaults to False in 0.8 (e.g. off by default in all cases), None in 0.9 (e.g. automatic by default). Thanks to Alexander Koval for help with this. [ticket:2836]
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-061-166/+121
| | | | | | | | | | | | | - The system of loader options has been entirely rearchitected to build upon a much more comprehensive base, the :class:`.Load` object. This base allows any common loader option like :func:`.joinedload`, :func:`.defer`, etc. to be used in a "chained" style for the purpose of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``. The new system supersedes the usage of dot-separated path names, multiple attributes within options, and the usage of ``_all()`` options. - Added a new load option :func:`.orm.load_only`. This allows a series of column names to be specified as loading "only" those attributes, deferring the rest.
* - modify what we did in [ticket:2793] so that we can also set theMike Bayer2013-09-061-1/+2
| | | | | version id programmatically outside of the generator. using this system, we can also leave the version id alone.
* - spot checking of imports, obsolete functionsMike Bayer2013-08-171-18/+2
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-2/+10
| | | | | | | | | - 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-14/+7
| | | | | | | | | | | | | | | | | | | | | | 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.
* find some more inline imports and move them outMike Bayer2013-08-041-1/+0
|
* A performance fix related to the usage of the :func:`.defer` optionMike Bayer2013-07-131-21/+22
| | | | | | | | | | | | | when loading mapped entities. The function overhead of applying a per-object deferred callable to an instance at load time was significantly higher than that of just loading the data from the row (note that ``defer()`` is meant to reduce DB/network overhead, not necessarily function call count); the function call overhead is now less than that of loading data from the column in all cases. There is also a reduction in the number of "lazy callable" objects created per load from N (total deferred values in the result) to 1 (total number of deferred cols). [ticket:2778]
* dial back the default "flatness" a bit, it will be there for joinedload and ↵Mike Bayer2013-06-061-2/+10
| | | | | | | 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".
* - blow away context._attributesMike Bayer2013-06-021-25/+29
| | | | | - to account for query._attributes/context.attributes, just pass the attributes dict directly to the PathRegistry methods
* The "auto-aliasing" behavior of the :class:`.Query.select_from`Mike Bayer2013-05-301-1/+1
| | | | | | method has been turned off. The specific behavior is now availble via a new method :class:`.Query.select_entity_from`. [ticket:2736]
* a pass where we try to squash down as many list()/keys() combinationsMike Bayer2013-05-261-1/+1
| | | | as possible
* - the raw 2to3 runMike Bayer2013-04-271-4/+4
| | | | - went through examples/ and cleaned out excess list() calls
* cleanupMike Bayer2013-04-251-7/+0
|
* - additional test + correction for [ticket:2699]Mike Bayer2013-04-181-4/+5
|
* Fixed bug when a query of the form:Mike Bayer2013-04-091-2/+5
| | | | | | | | | | | ``query(SubClass).options(subqueryload(Baseclass.attrname))``, where ``SubClass`` is a joined inh of ``BaseClass``, would fail to apply the ``JOIN`` inside the subquery on the attribute load, producing a cartesian product. The populated results still tended to be correct as additional rows are just ignored, so this issue may be present as a performance degradation in applications that are otherwise working correctly. [ticket:2699]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* - refactor of pathing mechanics, to address #2614, #2617Mike Bayer2012-12-011-40/+43
| | | | | | | | | | | | | | | | | | | - 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.
* Added a new exception to detect the case where twoMike Bayer2012-11-241-2/+17
| | | | | | | | | | | subclasses are being loaded using with_polymorphic(), each subclass contains a relationship attribute of the same name, and eager loading is being applied to one or both. This is an ongoing bug which can't be immediately fixed, so since the results are usually wrong in any case it raises an exception for now. 0.7 has the same issue, so an exception raise here probably means the code was returning the wrong data in 0.7. [ticket:2614]
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-7/+7
|
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-29/+51
|
* - remove old hardcoded rule about chained being limited to certain load typesMike Bayer2012-10-081-1/+1
|
* - fix annotation transfer when producing m2m backref, [ticket:2578]Mike Bayer2012-09-281-1/+1
|
* - [bug] Lazy loads emitted within flush eventsMike Bayer2012-08-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | such as before_flush(), before_update(), etc. will now function as they would within non-event code, regarding consideration of the PK/FK values used in the lazy-emitted query. Previously, special flags would be established that would cause lazy loads to load related items based on the "previous" value of the parent PK/FK values specifically when called upon within a flush; the signal to load in this way is now localized to where the unit of work actually needs to load that way. Note that the UOW does sometimes load these collections before the before_update() event is called, so the usage of "passive_updates" or not can affect whether or not a collection will represent the "old" or "new" data, when accessed within a flush event, based on when the lazy load was emitted. The change is backwards incompatible in the exceedingly small chance that user event code depended on the old behavior. [ticket:2350]
* - with InstanceState more public, underscore all its methodsMike Bayer2012-07-181-6/+6
| | | | | that change object state as these aren't intended for public use.
* - totally remove _entity_info and _extended_entity_info, replacing all usageMike Bayer2012-07-161-137/+137
| | | | with inspect()
* - move all of orm to use absolute importsMike Bayer2012-06-231-33/+34
| | | | | | | | - 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-3/+0
| | | | | | | | | | | | | | * 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-156/+198
| | | | | | | | | | | | | | | | | | | | | | | | 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
* - [bug] Fixed bug whereby populate_existingMike Bayer2012-06-161-0/+2
| | | | | | option would not propagate to subquery eager loaders. [ticket:2497]. Also in 0.7.8.
* fix logic here broken by the change for enable_relationship_loadingMike Bayer2012-05-191-4/+8
|
* - [feature] Added utility featureMike Bayer2012-05-171-2/+4
| | | | | | | Session.enable_relationship_loading(), supersedes relationship.load_on_pending. Both features should be avoided, however. [ticket:2372]
* - [bug] Fixed bug whereby subqueryload() fromMike Bayer2012-05-171-1/+7
| | | | | | | a polymorphic mapping to a target would incur a new invocation of the query for each distinct class encountered in the polymorphic result. [ticket:2480]. Also in 0.7.8.
* - [removed] The legacy "mutable" system of theMike Bayer2012-04-231-8/+0
| | | | | | | | | | | | | | ORM, including the MutableType class as well as the mutable=True flag on PickleType and postgresql.ARRAY has been removed. In-place mutations are detected by the ORM using the sqlalchemy.ext.mutable extension, introduced in 0.7. The removal of MutableType and associated constructs removes a great deal of complexity from SQLAlchemy's internals. The approach performed poorly as it would incur a scan of the full contents of the Session when in use. [ticket:2442]
* - re-merge + CHANGESMike Bayer2012-04-231-1/+1
|\
| * make auto-correlation the same for Query & select()Diana Clarke2012-04-021-1/+1
| |
* | - merge attribute flag overhaul for [ticket:2358]Mike Bayer2012-04-231-16/+8
| |
* | - merged #1401 branch from bitbucketMike Bayer2012-04-221-61/+7
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-46/+3
| | | | | | | | | | | | - add foreign, remote annotations to declarative
| * | - move properties to use the new create_joinsMike Bayer2012-02-101-19/+4
| | | | | | | | | | | | - fix up subquery eager loading
| * | - got m2m, local_remote_pairs, etc. workingMike Bayer2012-02-091-0/+4
| |/ | | | | | | | | | | | | | | - using new traversal that returns the product of both sides of a binary, starting to work with (a+b) == (c+d) types of joins. primaryjoins on functions working - annotations working, including reversing local/remote when doing backref
* | - [feature] Added new flag to @validatesMike Bayer2012-04-111-3/+3
|/ | | | | | | | 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.
* - [feature] Added new capability to relationshipMike Bayer2012-01-221-0/+7
| | | | | | | | | | | loader options to allow "default" loader strategies. Pass '*' to any of joinedload(), lazyload(), subqueryload(), or noload() and that becomes the loader strategy used for all relationships, except for those explicitly stated in the Query. Thanks to up-and-coming contributor Kent Bower for an exhaustive and well written test suite ! [ticket:2351]
* fix a callcount issue hereMike Bayer2012-01-221-3/+1
|