summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/state.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* - Some fixes to the state handling regardingMike Bayer2011-04-071-2/+4
| | | | | | | | | backrefs, typically when autoflush=False, where the back-referenced collection wouldn't properly handle add/removes with no net change. Thanks to Richard Murri for the test case + patch. [ticket:2123] (also in 0.6.7).
* - some changes to the identity map regardingMike Bayer2011-03-041-8/+2
| | | | | | | | | | | | rare weakref callbacks during iterations. The mutex has been removed as it apparently can cause a reentrant (i.e. in one thread) deadlock, perhaps when gc collects objects at the point of iteration in order to gain more memory. It is hoped that "dictionary changed during iteration" will be exceedingly rare as iteration methods internally acquire the full list of objects in a single values() call. [ticket:2087]
* - replace all usage of True and False for passive with PASSIVE_NO_INITIALIZE,Mike Bayer2011-02-111-2/+2
| | | | | | PASSIVE_OFF, now expresed as non-boolean symbols - make "passive" available positionally on all get_history() methods, call it like that
* formatting fixMike Bayer2011-02-101-3/+7
|
* - An exception is raised in the unusual case that anMike Bayer2011-02-101-2/+7
| | | | | | | | append or similar event on a collection occurs after the parent object has been dereferenced, which prevents the parent from being marked as "dirty" in the session. Will commit as a warning in 0.6. [ticket:2046]
* - add support for pickling with mutable scalars, mutable compositesMike Bayer2011-01-021-1/+4
| | | | | | | - add pickle/unpickle events to ORM events. these are needed for the mutable extension. - finish mutable extension documentation, consolidate examples, add full descriptions
* - whitespace removal bonanzaMike Bayer2011-01-021-62/+62
|
* - clean up copyright, update for 2011, stamp every file withMike Bayer2011-01-021-0/+6
| | | | | a consistent tag - AUTHORS file
* - removes the "on_" prefix.Mike Bayer2010-12-301-5/+5
|
* - mutable examples now move into sqlalchemy.ext.mutableMike Bayer2010-12-291-1/+3
| | | | | | | | | | | - streamline interfaces, get Mutable/MutableComposite to be as minimal in usage as possible - docs for mutable, warnings regrarding mapper events being global - move MutableType/mutable=True outwards, move orm tests to its own module, note in all documentation - still need more events/tests for correct pickling support of composites, mutables. in the case of composites its needed even without mutation. see [ticket:2009]
* - on_expire event, since we are starting to build off of events aroundMike Bayer2010-12-251-0/+4
| | | | | | | | | | | | full lifecycle - composite will use events to do everything we want it to, i.e. storing the composite in __dict__, invalidating it on change of any of the columns. - will reinstate mutability of composites via callable attached to the composite - but userland code will still need to establish change event listening on the composite itself, perhaps via a "mutable" mixin like the scalars.py example, perhaps via addition of descriptors to the mutable object.
* - slight simplify to state.modified_event()Mike Bayer2010-12-231-10/+7
|
* - another heap of inlinings and now I really have to be done with thisMike Bayer2010-12-211-22/+6
|
* - refactor expire_attributes into two simpler methodsMike Bayer2010-12-211-30/+22
|
* - further optimize what get_all_pending() returns to reduce the work of ↵Mike Bayer2010-12-191-10/+11
| | | | receivers
* - remove the need to use LoadDeferredColumns, LoadLazyAttribute in most cases,Mike Bayer2010-12-161-29/+29
| | | | | | | | | these are back to being part of LoaderStrategy - simplify attribute.get() - inline the dict get inside of attribute.__get__() - revert some memoized attrs from InstanceState which are called in almost all cases regardless - inlining
* - inlinings and callcount reductionsMike Bayer2010-12-121-4/+8
| | | | - add test coverage for the rare case of noload->lazyload + pickle
* - callcountsMike Bayer2010-12-101-1/+1
|
* callcount destructo engageMike Bayer2010-12-091-1/+20
|
* - shave about a millisecond off of moderately complex save casades.Mike Bayer2010-12-061-2/+1
|
* - merge mapper simpler compile branch, [ticket:1966]Mike Bayer2010-11-261-3/+5
|\
| * [ticket:1966] implementationMike Bayer2010-11-151-3/+3
| |
* | - most tests passing on adapted MapperExtensionMike Bayer2010-11-061-3/+0
| |
* | - merge tipMike Bayer2010-11-061-2/+8
|\ \ | |/
| * - Fixed bug whereby a non-"mutable" attribute modified eventMike Bayer2010-10-261-2/+8
| | | | | | | | | | | | | | | | | | which occurred on an object that was clean except for preceding mutable attribute changes would fail to strongly reference itself in the identity map. This would cause the object to be garbage collected, losing track of any changes that weren't previously saved in the "mutable changes" dictionary.
* | - begin adding tests for event registration and dispatch standaloneMike Bayer2010-10-021-1/+1
| | | | | | | | | | - fix pickling again - other test fixes
* | - add instrumentation eventsMike Bayer2010-10-021-9/+4
| | | | | | | | | | | | | | | | | | - simplify listen_for_events example with new system - add "propagate", "retval", "raw" flags to attribute events. this solves the "return value" issue as well as the "subclass" issue. - begin thinking about event removal. Each listen() method will have a corresponding remove(). Custom listen() methods will have to package all the info onto the event function that is needed to remove its state.
* | - reorganizationMike Bayer2010-09-141-8/+15
| | | | | | | | | | | | | | - attrbutes.py splits into attribtes.py and instrumentation.py - all the various Event subclasses go into events.py modules - some ideas for orm events - move *Extension out to deprecated_interfaces
* | - merge tip, 0.6.4 + 0.6.5Mike Bayer2010-09-141-1/+1
|\ \ | |/
| * - 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.
* | merge from tipMike Bayer2010-09-031-0/+1
|\ \ | |/
| * - 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.
* | - reorganize events into cls->dispatch, which is an instance of _Dispatch.Mike Bayer2010-08-101-4/+4
| | | | | | | | | | | | cut down on extraneous stuff, cleanup The Event class never gets instantiated and its methods stay the same so that sphinx can get to it.
* | - worked it out so that classes declare a nested class "event",Mike Bayer2010-07-241-7/+5
|/ | | | | | | | | with methods representing events. This is self-documenting via sphinx. - implemented new model for pool, classmanager. Most events are one or two args, so going back to allowing any kind of *arg, **kw signature for events - this is simpler and improves performance, though we don't get the "we can add new kw's anytime". perhaps there's some other way to approach that.
* - 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]