summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/state.py
Commit message (Collapse)AuthorAgeFilesLines
* - Fixed bug where :meth:`.Session.expunge` would not fully detachMike Bayer2014-10-191-1/+10
| | | | | | | the given object if the object had been subject to a delete operation that was flushed, but not committed. This would also affect related operations like :func:`.make_transient`. fixes #3139
* improve exception vs. exit handlingndparker2014-09-231-2/+2
|
* - defaultdict benchmarks faster than a namedtuple; OKMike Bayer2014-08-291-14/+0
| | | | - inline the column-based expiration operations as well
* - use a faster discard when loadingMike Bayer2014-08-291-2/+1
| | | | - don't do a bool on identity map since it calls __len__
* - rename _InspectionAttr to InspectionAttrMike Bayer2014-08-131-1/+1
|
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-25/+27
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - revert the memoized committed_state / callables changes as they appear to ↵Mike Bayer2014-05-241-19/+8
| | | | | | add to lazy loading. not really clear which approach is better in the long run.
* inliningMike Bayer2014-05-191-10/+21
|
* - some inlining, speed up identity mapMike Bayer2014-05-191-4/+8
|
* - add some docs for the instancestate linkage to the inspection systemMike Bayer2014-04-041-5/+67
|
* - Fixed bug in mutable extension as well asMike Bayer2014-03-191-2/+2
| | | | | | :func:`.attributes.flag_modified` where the change event would not be propagated if the attribute had been reassigned to itself. fixes #2997
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - The ``viewonly`` flag on :func:`.relationship` will now preventMike Bayer2013-11-191-0/+2
| | | | | | | | | | 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]
* - :func:`.attributes.get_history()` when used with a scalar column-mappedMike Bayer2013-10-251-1/+31
| | | | | | | | | attribute will now honor the "passive" flag passed to it; as this defaults to ``PASSIVE_OFF``, the function will by default query the database if the value is not present. This is a behavioral change vs. 0.8. [ticket:2787] - Added new method :meth:`.AttributeState.load_history`, works like :attr:`.AttributeState.history` but also fires loader callables.
* use accepts scalar loader here so we deal with _ProxyImpl correctlyMike Bayer2013-10-111-6/+4
|
* - fix bug due to regression from #2793, make sure we only go to loadMike Bayer2013-10-111-0/+9
| | | | | scalar attributes here and not relationships, else we get an error if there's no actual scalars to load
* fix typospr/23Hyunjun Kim2013-08-251-2/+2
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-52/+32
| | | | | | | | | - 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 performance fix related to the usage of the :func:`.defer` optionMike Bayer2013-07-131-9/+14
| | | | | | | | | | | | | 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]
* Added a conditional to the unpickling process for ORMMike Bayer2013-04-231-1/+2
| | | | | | | mapped objects, such that if the reference to the object were lost when the object was pickled, we don't erroneously try to set up _sa_instance_state - fixes a NoneType error.
* Improved the behavior of instance management regardingMike Bayer2013-04-201-13/+14
| | | | | | | | | | | | | | 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]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-3/+2
|
* - use our new Cls.memoized_name._reset(self) method in place of all those ↵Mike Bayer2012-09-231-3/+3
| | | | | | __dict__.pop(), remove reset_memoized
* - rename .attr to .attrs on mapper, instance state, [ticket:2569]Mike Bayer2012-09-221-1/+1
|
* don't need this is_really_none() thing anymoreMike Bayer2012-08-081-3/+0
|
* - [feature] A warning is emitted when a referenceMike Bayer2012-08-041-4/+14
| | | | | | | | | to an instrumented collection is no longer associated with the parent class due to expiration/attribute refresh/collection replacement, but an append or remove operation is received on the now-detached collection. [ticket:2476]
* a lot of docsMike Bayer2012-07-181-6/+11
|
* - with InstanceState more public, underscore all its methodsMike Bayer2012-07-181-11/+11
| | | | | that change object state as these aren't intended for public use.
* - document the inspection systemMike Bayer2012-07-181-1/+69
|
* - express most of the orm.util functions in terms of the inspection systemMike Bayer2012-07-161-2/+4
| | | | | | | | | | | | | | - 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
* - move load_scalar_attributes out to loading.pyMike Bayer2012-07-141-3/+5
|
* rework imports hereMike Bayer2012-07-031-18/+18
|
* turn commit_all into an iterative methodMike Bayer2012-06-251-12/+18
|
* - [moved] The InstrumentationManager interfaceMike Bayer2012-06-241-2/+2
| | | | | | | | | | | | | and the entire related system of alternate class implementation is now moved out to sqlalchemy.ext.instrumentation. This is a seldom used system that adds significant complexity and overhead to the mechanics of class instrumentation. The new architecture allows it to remain unused until InstrumentationManager is actually imported, at which point it is bootstrapped into the core.
* absolute imports in core, sqlMike Bayer2012-06-231-1/+0
|
* - move all of orm to use absolute importsMike Bayer2012-06-231-7/+6
| | | | | | | | - 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
* - [feature] The of_type() construct on attributesMike Bayer2012-06-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* - [feature] Added utility featureMike Bayer2012-05-171-0/+1
| | | | | | | Session.enable_relationship_loading(), supersedes relationship.load_on_pending. Both features should be avoided, however. [ticket:2372]
* - [removed] The legacy "mutable" system of theMike Bayer2012-04-231-131/+4
| | | | | | | | | | | | | | 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]
* merge patch for [ticket:2208]. This still needs documentation.Mike Bayer2012-04-231-38/+99
|\
| * - the inspect interface is done, needs docs.Mike Bayer2012-04-041-35/+94
| | | | | | | | | | - 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-0/+4
| |
* | - merge attribute flag overhaul for [ticket:2358]Mike Bayer2012-04-231-2/+2
|/
* - [bug] Fixed bug where unpickled object didn'tMike Bayer2012-01-281-0/+4
| | | | | | | | have enough of its state set up to work correctly within the unpickle() event established by the mutable object extension, if the object needed ORM attribute access within __eq__() or similar. [ticket:2362]
* happy new yearMike Bayer2012-01-041-1/+1
|
* - attribute system gets a pop() method.Mike Bayer2011-10-301-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - remove() on a scalar object will raise if the object removed is not what was present. - InstanceState can be pickled if obj() is None; this to support the other changes in this commit - only use trackparent flag on attributes if single_parent or ONETOMANY; otherwise we can skip this overhead - attribute hasparent()/sethasparent() check that trackparent is set, else their usage is invalid - [bug] Fixed backref behavior when "popping" the value off of a many-to-one in response to a removal from a stale one-to-many - the operation is skipped, since the many-to-one has since been updated. [ticket:2315] - [bug] After some years of not doing this, added more granularity to the "is X a parent of Y" functionality, which is used when determining if the FK on "Y" needs to be "nulled out" as well as if "Y" should be deleted with delete-orphan cascade. The test now takes into account the Python identity of the parent as well its identity key, to see if the last known parent of Y is definitely X. If a decision can't be made, a StaleDataError is raised. The conditions where this error is raised are fairly rare, requiring that the previous parent was garbage collected, and previously could very well inappropriately update/delete a record that's since moved onto a new parent, though there may be some cases where "silent success" occurred previously that will now raise in the face of ambiguity. Expiring "Y" resets the "parent" tracker, meaning X.remove(Y) could then end up deleting Y even if X is stale, but this is the same behavior as before; it's advised to expire X also in that case. [ticket:2264]
* - Fixed bug apparent only in Python 3 wherebyMike Bayer2011-07-241-4/+0
| | | | | | | | sorting of persistent + pending objects during flush would produce an illegal comparison, if the persistent object primary key is not a single integer. [ticket:2228] Also in 0.6.9
* - Added checks inside the UOW to detect the unusualMike Bayer2011-04-101-1/+0
| | | | | | | | | | | | | | | | | | | condition of being asked to UPDATE or DELETE on a primary key value that contains NULL in it. [ticket:2127] - Some refinements to attribute history. More changes are pending possibly in 0.8, but for now history has been modified such that scalar history doesn't have a "side effect" of populating None for a non-present value. This allows a slightly better ability to distinguish between a None set and no actual change, affects [ticket:2127] as well. - rewriting the history tests in test_attributes to be individual per operation/assertion. its a huge job so this is partial for the moment.