summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/state.py
Commit message (Collapse)AuthorAgeFilesLines
* - lazy loads for relationship attributes now useMike Bayer2010-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | the current state, not the "committed" state, of foreign and primary key attributes when issuing SQL, if a flush is not in process. Previously, only the database-committed state would be used. In particular, this would cause a many-to-one get()-on-lazyload operation to fail, as autoflush is not triggered on these loads when the attributes are determined and the "committed" state may not be available. [ticket:1910] - A new flag on relationship(), load_on_pending, allows the lazy loader to fire off on pending objects without a flush taking place, as well as a transient object that's been manually "attached" to the session. Note that this flag blocks attribute events from taking place when an object is loaded, so backrefs aren't available until after a flush. The flag is only intended for very specific use cases.
* - An object that's been deleted now gets a flagMike Bayer2010-08-261-0/+1
| | | | | | | | | | | | 'deleted', which prohibits the object from being re-add()ed to the session, as previously the object would live in the identity map silently until its attributes were accessed. The make_transient() function now resets this flag along with the "key" flag. - make_transient() can be safely called on an already transient instance.
* - Improved the check for an "unmapped class",Mike Bayer2010-07-081-1/+1
| | | | | | | including the case where the superclass is mapped but the subclass is not. Any attempts to access cls._sa_class_manager.mapper now raise UnmappedClassError(). [ticket:1142]
* - session.merge() will not expire attributes on the returnedMike Bayer2010-05-081-0/+12
| | | | instance if that instance is "pending". [ticket:1789]
* a little bit of refinementMike Bayer2010-04-171-7/+4
|
* sillinessMike Bayer2010-02-161-5/+1
|
* Gave the "state" internals a good solidMike Bayer2010-02-141-114/+127
| | | | | cleanup with less complexity, datamembers, method calls, blank dictionary creates.
* - reduced a bit of overhead in attribute expiration, particularlyMike Bayer2010-02-131-6/+25
| | | | | | | | the version called by column loaders on an incomplete row (i.e. joined table inheritance). there are more dramatic changes that can be made here but this one is conservative so far as far as how much we're altering how InstanceState tracks "expired" attributes.
* - For those who might use debug logging onMike Bayer2010-02-131-8/+23
| | | | | | | | | | sqlalchemy.orm.strategies, most logging calls during row loading have been removed. These were never very helpful and cluttered up the code. - Some internal streamlining of object loading grants a small speedup for large results, estimates are around 10-15%.
* lessons learned unpickling from an 0.5 cacheMike Bayer2010-01-191-1/+10
|
* - raise error when unpickling non-mapped state, [ticket:1610]Mike Bayer2010-01-171-5/+12
| | | | - remove pickle language from regular unmapped class error
* - cut down on a few hundred method callsMike Bayer2010-01-111-2/+2
|
* remove needless check_modified()Mike Bayer2010-01-071-4/+0
|
* - Fixed recursion issue which occured if a mapped object'sMike Bayer2009-08-311-1/+1
| | | | | `__len__()` or `__nonzero__()` method resulted in state changes. [ticket:1501]
* instance_dict may be modified before the GC triggers _cleanup on Jython, so eatPhilip Jenvey2009-08-211-2/+8
| | | | state mismatch AssertionErrors
* - renamed PASSIVE_NORESULT to PASSIVE_NO_RESULTMike Bayer2009-08-071-4/+8
| | | | | | | | | | | | | | | | - renamed PASSIVE_NO_CALLABLES to PASSIVE_NO_FETCH - passive now propagates all the way through lazy callables, all the way into query._get(), so that many-to-one lazy load can load the instance via the local session but not trigger any SQL if not available, fixes [ticket:1298] without messing up consistency of tests added in r6201 - many-to-one also handles returning PASSIVE_NO_RESULT for the "old" value thus eliminating the need for the previous value even if the new value is None - query._get() uses identity_map.get(), which has been changed to no longer raise KeyError, thus providing mythical time savings that didn't seem to make any difference in how fast the unit tests ran.
* merge 0.6 series to trunk.Mike Bayer2009-08-061-3/+9
|
* - Fixed potential memory leak whereby previously pickled objectsMike Bayer2009-07-101-2/+7
| | | | | placed back in a session would not be fully garbage collected unless the Session were explicitly closed out.
* - Trimmed the pickle format for InstanceState which should furtherMike Bayer2009-06-161-27/+37
| | | | | reduce the memory footprint of pickled instances. The format should be backwards compatible with that of 0.5.4 and previous.
* - Fixed bug whereby list-based attributes, like pickletypeMike Bayer2009-06-151-2/+0
| | | | and PGArray, failed to be merged() properly.
* - Fixed another 0.5.4 bug whereby mutable attributes (i.e. PickleType)Mike Bayer2009-06-011-1/+3
| | | | | wouldn't be deserialized correctly when the whole object was serialized. [ticket:1426]
* - Removed all* O(N) scanning behavior from the flush() process,Mike Bayer2009-05-171-6/+18
| | | | | | | | | | | i.e. operations that were scanning the full session, including an extremely expensive one that was erroneously assuming primary key values were changing when this was not the case. * one edge case remains which may invoke a full scan, if an existing primary key attribute is modified to a new value.
* - Significant performance enhancements regarding Sessions/flush()Mike Bayer2009-05-171-0/+429
in conjunction with large mapper graphs, large numbers of objects: - The Session's "weak referencing" behavior is now *full* - no strong references whatsoever are made to a mapped object or related items/collections in its __dict__. Backrefs and other cycles in objects no longer affect the Session's ability to lose all references to unmodified objects. Objects with pending changes still are maintained strongly until flush. [ticket:1398] The implementation also improves performance by moving the "resurrection" process of garbage collected items to only be relevant for mappings that map "mutable" attributes (i.e. PickleType, composite attrs). This removes overhead from the gc process and simplifies internal behavior. If a "mutable" attribute change is the sole change on an object which is then dereferenced, the mapper will not have access to other attribute state when the UPDATE is issued. This may present itself differently to some MapperExtensions. The change also affects the internal attribute API, but not the AttributeExtension interface nor any of the publically documented attribute functions. - The unit of work no longer genererates a graph of "dependency" processors for the full graph of mappers during flush(), instead creating such processors only for those mappers which represent objects with pending changes. This saves a tremendous number of method calls in the context of a large interconnected graph of mappers. - Cached a wasteful "table sort" operation that previously occured multiple times per flush, also removing significant method call count from flush(). - Other redundant behaviors have been simplified in mapper._save_obj().