summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/session.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix sessionmaker.__repr__pr/45Timur2013-11-161-1/+1
| | | A comma separating 'class_' from the other args. It's still there even when kw is empty, which is syntactically correct.
* - spot checking of imports, obsolete functionsMike Bayer2013-08-171-2/+1
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-31/+41
| | | | | | | | | - 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
* Added a new attribute :attr:`.Session.info` to :class:`.Session`;Mike Bayer2013-08-021-2/+42
| | | | | | | | this is a dictionary where applications can store arbitrary data local to a :class:`.Session`. The contents of :attr:`.Session.info` can be also be initialized using the ``info`` argument of :class:`.Session` or :class:`.sessionmaker`.
* a pass where we try to squash down as many list()/keys() combinationsMike Bayer2013-05-261-4/+4
| | | | as possible
* merge defaultMike Bayer2013-04-301-3/+4
|\
| * - Fixed a regression from 0.7 where the contextmanager featureMike Bayer2013-04-301-3/+4
| | | | | | | | | | | | | | of :meth:`.Session.begin_nested` would fail to correctly roll back the transaction when a flush error occurred, instead raising its own exception while leaving the session still pending a rollback. [ticket:2718]
* | - the raw 2to3 runMike Bayer2013-04-271-10/+10
|/ | | | - went through examples/ and cleaned out excess list() calls
* - dont do a boolean check on the mapped objectMike Bayer2013-04-201-1/+1
|
* Improved the behavior of instance management regardingMike Bayer2013-04-201-3/+5
| | | | | | | | | | | | | | 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]
* python2.5 fixMike Bayer2013-04-181-1/+2
|
* Reworked internal exception raises that emitMike Bayer2013-04-181-6/+6
| | | | | | | | | a rollback() before re-raising, so that the stack trace is preserved from sys.exc_info() before entering the rollback. This so that the traceback is preserved when using coroutine frameworks which may have switched contexts before the rollback function returns. [ticket:2703]
* - add some more transaction states so that we deliver a more accurateMike Bayer2013-03-041-36/+44
| | | | | | | | message for [ticket:2662]; after_commit() is called within "committed" state, not prepared, and no SQL can be emitted for prepared or committed - consolidate state assertions in session transaction, use just one method - add more unit tests for these assertions
* - A clear error message is emitted if an event handlerMike Bayer2013-02-251-14/+19
| | | | | | | | | | attempts to emit SQL on a Session within the after_commit() handler, where there is not a viable transaction in progress. [ticket:2662] - rework how SessionTransaction maintains state, using symbols instead. - add lots of notes and cross-linking for session events. - add a link to :func:`.select()` within :meth:`.FromClause.select`.
* - Added new helper function :func:`.was_deleted`, returns TrueMike Bayer2013-02-201-0/+4
| | | | | | | | | if the given object was the subject of a :meth:`.Session.delete` operation. - An object that's deleted from a session will be de-associated with that session fully after the transaction is committed, that is the :func:`.object_session` function will return None. [ticket:2658]
* see also for session commit, rollbackMike Bayer2013-02-111-1/+10
|
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* more warningsMike Bayer2012-11-281-12/+19
|
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-163/+189
|
* - remove remote_foreign annotationMike Bayer2012-10-281-8/+13
| | | | - support annotations on Column where name isn't immediately present
* - more docsMike Bayer2012-10-261-1/+1
| | | | - it appears we can get rid of all those "XYZ_toplevel" names and use :doc:.
* - errant maxdbMike Bayer2012-10-191-2/+0
| | | | - errant pdbs
* - move out maxdbMike Bayer2012-10-181-0/+2
| | | | | | - begin consolidating docs for dialects to be more self contained - add a separate section for "external" dialects - not sure how we're going to go with this yet.
* - [bug] Continuing [ticket:2566] regarding extraMike Bayer2012-10-061-0/+15
| | | | | | | | | | | | | | | | state post-flush due to event listeners; any states that are marked as "dirty" from an attribute perspective, usually via column-attribute set events within after_insert(), after_update(), etc., will get the "history" flag reset in all cases, instead of only those instances that were part of the flush. This has the effect that this "dirty" state doesn't carry over after the flush and won't result in UPDATE statements. A warning is emitted to this effect; the set_committed_state() method can be used to assign attributes on objects without producing history events. [ticket:2582]
* - [feature] The Session will produce warningsMike Bayer2012-10-041-3/+27
| | | | | | | | | | | | | | | | | | | when unsupported methods are used inside the "execute" portion of the flush. These are the familiar methods add(), delete(), etc. as well as collection and related-object manipulations, as called within mapper-level flush events like after_insert(), after_update(), etc. It's been prominently documented for a long time that SQLAlchemy cannot guarantee results when the Session is manipulated within the execution of the flush plan, however users are still doing it, so now there's a warning. Maybe someday the Session will be enhanced to support these operations inside of the flush, but for now, results can't be guaranteed.
* - add one more #2583 test to cover the "multiple PK switch" use caseMike Bayer2012-10-031-1/+1
|
* - [bug] Fixed Session accounting bug whereby replacingMike Bayer2012-10-031-3/+18
| | | | | | | | | | a deleted object in the identity map with another object of the same primary key would raise a "conflicting state" error on rollback(), if the replaced primary key were established either via non-unitofwork-established INSERT statement or by primary key switch of another instance. [ticket:2583]
* - commit Priit Laes docstring fixesMike Bayer2012-09-301-7/+8
| | | | - don't even talk about metadata.bind in declarative
* - [bug] Extra logic has been added to the "flush"Mike Bayer2012-09-221-1/+9
| | | | | | | | | | | | that occurs within Session.commit(), such that the extra state added by an after_flush() or after_flush_postexec() hook is also flushed in a subsequent flush, before the "commit" completes. Subsequent calls to flush() will continue until the after_flush hooks stop adding new state. An "overflow" counter of 100 is also in place, in the event of a broken after_flush() hook adding new content each time. [ticket:2566]
* - [feature] New session events after_transaction_createMike Bayer2012-09-201-1/+9
| | | | | | | | and after_transaction_end allows tracking of new SessionTransaction objects. If the object is inspected, can be used to determine when a session first becomes active and when it deactivates.
* updatesMike Bayer2012-09-101-1/+10
|
* - rework scoped_session and sessionmaker, [ticket:2500]Mike Bayer2012-09-101-81/+123
| | | | - rewrite tons of session docs
* - add a test to make sure we've tested session.execute(stmt, multiparams)Mike Bayer2012-09-091-25/+84
| | | | - rewrite docs for session.execute()
* add a note, no autoflush with execute, [ticket:2550]Mike Bayer2012-08-161-0/+2
|
* big rework of is_active and SessionTransaction docsMike Bayer2012-08-081-32/+109
|
* - continue editing the merge docsMike Bayer2012-08-081-22/+26
|
* - modernize some merge docs a bitMike Bayer2012-08-071-0/+23
|
* - with InstanceState more public, underscore all its methodsMike Bayer2012-07-181-134/+134
| | | | | that change object state as these aren't intended for public use.
* turn commit_all into an iterative methodMike Bayer2012-06-251-2/+6
|
* 2.5 compatMike Bayer2012-06-231-4/+0
|
* - move all of orm to use absolute importsMike Bayer2012-06-231-31/+30
| | | | | | | | - 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-5/+1
| | | | | | | | | | | | | | * 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)
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-22/+22
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.
* - [feature] The 'objects' argument toMike Bayer2012-06-081-11/+6
| | | | | flush() is no longer deprecated, as some valid use cases have been identified.
* - add before_attach event, [ticket:2464]Mike Bayer2012-06-071-4/+14
|
* - [feature] Added utility featureMike Bayer2012-05-171-0/+44
| | | | | | | Session.enable_relationship_loading(), supersedes relationship.load_on_pending. Both features should be avoided, however. [ticket:2372]
* - [feature] Calling rollback() within aMike Bayer2012-04-241-43/+55
| | | | | | | | | | | | | | session.begin_nested() will now only expire those objects that had net changes within the scope of that transaction, that is objects which were dirty or were modified on a flush. This allows the typical use case for begin_nested(), that of altering a small subset of objects, to leave in place the data from the larger enclosing set of objects that weren't modified in that sub-transaction. [ticket:2452] - inline the "register_newly_XYZ" functions to operate upon collections to reduce method calls
* - [feature] The after_attach event is nowMike Bayer2012-04-241-2/+2
| | | | | | | | | emitted after the object is established in Session.new or Session.identity_map upon Session.add(), Session.merge(), etc., so that the object is represented in these collections when the event is called. [ticket:2464]
* - [bug] The "passive" flag on Session.is_modified()Mike Bayer2012-04-241-39/+25
| | | | | | | | no longer has any effect. is_modified() in all cases looks only at local in-memory modified flags and will not emit any SQL or invoke loader callables/initializers. [ticket:2320]
* - the inspect interface is done, needs docs.Mike Bayer2012-04-041-4/+4
| | | | | - start dressing up InstanceState for it's coming out, start moving internal things to be underscored within the lib