summaryrefslogtreecommitdiff
path: root/test/orm/session.py
Commit message (Collapse)AuthorAgeFilesLines
* - unit tests have been migrated from unittest to nose.Mike Bayer2009-06-101-1436/+0
| | | | | See README.unittests for information on how to run the tests. [ticket:970]
* - removed test.testing.ORMTest, test.fixtures, and allMike Bayer2009-06-021-3/+4
| | | | dependencies on those.
* - Removed all* O(N) scanning behavior from the flush() process,Mike Bayer2009-05-171-2/+2
| | | | | | | | | | | 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-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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().
* - Session.scalar() now converts raw SQL strings to text()Mike Bayer2009-02-171-0/+6
| | | | | the same way Session.execute() does and accepts same alternative **kw args.
* - The "clear()", "save()", "update()", "save_or_update()"Mike Bayer2009-01-171-12/+14
| | | | | | Session methods have been deprecated, replaced by "expunge_all()" and "add()". "expunge_all()" has also been added to ScopedSession.
* if at first you don't succeed, fail, fail againMike Bayer2009-01-051-1/+1
|
* - Generalized the IdentityManagedState._instance_dict() callableMike Bayer2009-01-051-0/+8
| | | | | | | to the IdentityMap class so that Weak/StrongInstanceDict both have the same behavior wrt the state referencing the map - Fixed bug when using weak_instance_map=False where modified events would not be intercepted for a flush(). [ticket:1272]
* Added note for mssql about using snapshot isolation in order to get multipleMichael Trier2009-01-021-4/+0
| | | | connection session tests to pass.
* Modified fails_on testing decorator to take a reason for the failure.Michael Trier2008-12-121-1/+1
| | | | | This should assist with helping to document the reasons for testing failures. Currently unspecified failures are defaulted to 'FIXME: unknown'.
* Implemented experimental savepoint support in mssql. There are still some ↵Michael Trier2008-12-111-1/+1
| | | | failing savepoint related tests.
* Flagged another transaction test as causing mssql to hang. Need to look into ↵Michael Trier2008-11-101-0/+1
| | | | these.
* add two new hooks for bulk operations to SessionExtension:Martijn Faassen2008-11-061-0/+12
| | | | | | * after_bulk_delete * after_bulk_update
* the recent change to garbage collection of InstanceState meant thatMike Bayer2008-10-301-0/+15
| | | | | the deferred lambda: created by lazy_clause would get a state with no dict. creates strong reference to the object now.
* - Improved weakref identity map memory management to no longerMike Bayer2008-10-191-1/+1
| | | | | require mutexing, resurrects garbage collected instance on a lazy basis for an InstanceState with pending changes.
* Fixed session.transaction.commit() on a autocommit=False session not ↵Ants Aasma2008-09-301-0/+9
| | | | | | starting a new transaction. Moved starting a new transaction in case of previous closing into SessionTransaction.
* - session.execute() will execute a Sequence object passed toMike Bayer2008-09-281-28/+12
| | | | | | | | | | | it (regression from 0.4). - Removed the "raiseerror" keyword argument from object_mapper() and class_mapper(). These functions raise in all cases if the given class/instance is not mapped. - Refined ExtensionCarrier to be itself a dict, removed 'methods' accessor - moved identity_key tests to test/orm/utils.py - some docstrings
* - rearranged delete() so that the object is attached beforeMike Bayer2008-09-051-2/+6
| | | | | cascades fire off [ticket:5058] - after_attach() only fires if the object was not previously attached
* recheck the dirty list if extensions are presentMike Bayer2008-08-301-1/+30
|
* - Session.delete() adds the given object to the session ifMike Bayer2008-08-241-0/+4
| | | | | not already present. This was a regression bug from 0.4 [ticket:1150]
* - The before_flush() hook on SessionExtension takes placeMike Bayer2008-08-171-0/+66
| | | | | | | | | | | before the list of new/dirty/deleted is calculated for the final time, allowing routines within before_flush() to further change the state of the Session before the flush proceeds. [ticket:1128] - Reentrant calls to flush() raise an error. This also serves as a rudimentary, but not foolproof, check against concurrent calls to Session.flush().
* - renamed autoexpire to expire_on_commitMike Bayer2008-08-031-1/+1
| | | | | - renamed SessionTransaction autoflush to reentrant_flush to more clearly state its purpose - added _enable_transaction_accounting, flag for Mike Bernson which disables the whole 0.5 transaction state management; the system depends on expiry on rollback in order to function.
* - The "entity_name" feature of SQLAlchemy mappersMike Bayer2008-08-021-13/+5
| | | | | has been removed. For rationale, see http://groups.google.com/group/sqlalchemy/browse_thread/thread/9e23a0641a88b96d?hl=en
* - Fixed a series of potential race conditions inMike Bayer2008-07-181-1/+81
| | | | | | | Session whereby asynchronous GC could remove unmodified, no longer referenced items from the session as they were present in a list of items to be processed, typically during session.expunge_all() and dependent methods.
* - Removed 2.3 set emulations/enhancements.Jason Kirtland2008-07-151-1/+0
| | | | (sets.Set-based collections & DB-API returns still work.)
* - Added a new SessionExtension hook called after_attach().Mike Bayer2008-07-151-2/+5
| | | | | This is called at the point of attachment for objects via add(), add_all(), delete(), and merge().
* - Added is_active flag to Sessions to detect whenMike Bayer2008-06-171-1/+9
| | | | | | a transaction is in progress [ticket:976]. This flag is always True with a "transactional" (in 0.5 a non-"autocommit") Session.
* - Query.UpdateDeleteTest.test_delete_fallback fails on mysql due to subquery ↵Mike Bayer2008-06-091-5/+1
| | | | | | | | | | | | | | | | | in DELETE; not sure how to do this exact operation in MySQL - added query_cls keyword argument to sessionmaker(); allows user-defined Query subclasses to be generated by query(). - added @attributes.on_reconstitute decorator, MapperExtension.on_reconstitute, both receieve 'on_load' attribute event allowing non-__init__ dependent instance initialization routines. - push memusage to the top to avoid pointless heisenbugs - renamed '_foostate'/'_fooclass_manager' to '_sa_instance_state'/'_sa_class_manager' - removed legacy instance ORM state accessors - query._get() will use _remove_newly_deleted instead of expunge() on ObjectDeleted, so that transaction rollback restores the previous state - removed MapperExtension.get(); replaced by a user-defined Query subclass - removed needless **kwargs from query.get() - removed Session.get(cls, id); this is redundant against Session.query(cls).get(id) - removed Query.load() and Session.load(); the use case for this method has never been clear, and the same functionality is available in more explicit ways
* - unrolled loops for the simplified Session.get_bind() argsJason Kirtland2008-05-211-2/+11
| | | | - restored the chunk of test r4806 deleted (!)
* - globally renamed refresh_instance to refresh_stateMike Bayer2008-05-211-9/+1
| | | | | | - removed 'instance' arg from session.get_bind() and friends, this is not a public API - renamed 'state' arg on same to '_state' - fixes [ticket:1055]
* - Centralized 'x is not mapped' reporting into sa.orm.exc.Jason Kirtland2008-05-211-0/+139
| | | | | | | - Guards are now present on all public Session methods and passing in an unmapped hoho anywhere yields helpful exception messages, going to some effort to provide hints for debugging situations that would otherwise seem hopeless, such as broken user instrumentation or half-pickles.
* pool_threadlocal is off by default [ticket:1049]Mike Bayer2008-05-191-1/+14
|
* dont raise assertions when in autocommit mode [ticket:1046]Mike Bayer2008-05-161-0/+11
|
* - Removed @unsupportedJason Kirtland2008-05-141-6/+6
|
* Chipping away at remaining cruft.Jason Kirtland2008-05-101-48/+48
|
* Test suite modernization in progress. Big changes:Jason Kirtland2008-05-091-253/+291
| | | | | | | | | | | - @unsupported now only accepts a single target and demands a reason for not running the test. - @exclude also demands an exclusion reason - Greatly expanded @testing.requires.<feature>, eliminating many decorators in the suite and signficantly easing integration of multi-driver support. - New ORM test base class, and a featureful base for mapped tests - Usage of 'global' for shared setup going away, * imports as well
* r4695 merged to trunk; trunk now becomes 0.5.Mike Bayer2008-05-091-319/+101
| | | | 0.4 development continues at /sqlalchemy/branches/rel_0_4
* - added "after_begin()" hook to SessionMike Bayer2008-05-061-3/+9
| | | | - Session.rollback() will rollback on a prepared session
* Explicit test of .autoflush(False) to avoid issues with save_on_init=True ↵Jason Kirtland2008-04-221-1/+31
| | | | [ticket:869]
* flush(objects=[]) is a no-op [ticket:928]Jason Kirtland2008-04-221-0/+14
|
* - trailing whitespace...Jason Kirtland2008-03-171-43/+43
|
* - DEFAULT VALUES again.Jason Kirtland2008-03-171-1/+1
|
* fix insert() to have values (supports buildbot's SQLite)Mike Bayer2008-03-161-1/+1
|
* Session.execute can now find binds from metadataAnts Aasma2008-03-121-0/+15
|
* - the value of a bindparam() can be a callable, in whichMike Bayer2008-02-221-0/+15
| | | | | | | | | | | | | | | | case it's evaluated at statement execution time to get the value. - expressions used in filter(), filter_by() and others, when they make usage of a clause generated from a relation using the identity of a child object (e.g. filter(Parent.child==<somechild>)), evaluate the actual primary key value of <somechild> at execution time so that the autoflush step of the Query can complete, thereby populating the PK value of <somechild> in the case that <somechild> was pending. - cleanup of attributes.get_committed_value() to never return the NO_VALUE value; evaluates to None
* - updated the naming scheme of the base test classes in test/testlib/testing.py;Mike Bayer2008-02-111-2/+2
| | | | | tests extend from either TestBase or ORMTest, using additional mixins for special assertion methods as needed
* - added standalone "query" class attribute generatedMike Bayer2008-01-251-4/+7
| | | | | | | by a scoped_session. This provides MyClass.query without using Session.mapper. Use via: MyClass.query = Session.query_property()
* - parent transactions weren't started on the connection when adding a ↵Ants Aasma2008-01-201-1/+117
| | | | | | | | | | | connection to a nested session transaction. - session.transaction now always refers to the innermost active transaction, even when commit/rollback are called directly on the session transaction object. - when preparing a two-phase transaction fails on one connection all the connections are rolled back. - two phase transactions can now be prepared. - session.close() didn't close all transactions when nested transactions were used. - rollback() previously erroneously set the current transaction directly to the parent of the transaction that could be rolled back to. - autoflush for commit() wasn't flushing for simple subtransactions.
* - testbase is gone, replaced by testenvJason Kirtland2008-01-121-32/+32
| | | | | | - Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase - testing.db has the configured db - Fixed up the perf/* scripts
* Reworked r4042- undeclared deprecation warnings are now *fatal* to tests. ↵Jason Kirtland2008-01-101-6/+6
| | | | No surprises.