summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/session.py
Commit message (Collapse)AuthorAgeFilesLines
* - don't load deferred columns on unexpire for merge with load=False,Diana Clarke2016-04-061-0/+7
| | | | | | | fixes #3488 Change-Id: Ic9577b800e4a4e2465ec7f3a2e95bd231f5337ee Co-Authored-By: Mike Bayer <mike_mp@zzzcomputing.com>
* - Further continuing on the common MySQL exception case ofMike Bayer2016-03-231-12/+31
| | | | | | | | | a savepoint being cancelled first covered in :ticket:`2696`, the failure mode in which the :class:`.Session` is placed when a SAVEPOINT vanishes before rollback has been improved to allow the :class:`.Session` to still function outside of that savepoint. It is assumed that the savepoint operation failed and was cancelled. fixes #3680
* - Fixed bug in :meth:`.Session.merge` where an object with a compositeMike Bayer2016-02-111-2/+3
| | | | | | | | primary key that has values for some but not all of the PK fields would emit a SELECT statement leaking the internal NEVER_SET symbol into the query, rather than detecting that this object does not have a searchable primary key and no SELECT should be emitted. fixes #3647
* - fully hyperlink the docstring for make_transientMike Bayer2016-02-081-11/+47
| | | | | | | | | - establish make_transient and make_transient_to_detached as special-use, advanced use only functions - list all conditions under make_transient() under which an attribute will not be loaded and establish that make_transient() does not attempt to load all attributes before detaching the object from its session, fixes #3640
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - revert the change first made in a6fe4dc, as we are now generalizingMike Bayer2016-01-281-14/+2
| | | | | | | | | | | | | | | | | | | | | | | the warning here to all safe_reraise() cases in Python 2. - Revisiting :ticket:`2696`, first released in 1.0.10, which attempts to work around Python 2's lack of exception context reporting by emitting a warning for an exception that was interrupted by a second exception when attempting to roll back the already-failed transaction; this issue continues to occur for MySQL backends in conjunction with a savepoint that gets unexpectedly lost, which then causes a "no such savepoint" error when the rollback is attempted, obscuring what the original condition was. The approach has been generalized to the Core "safe reraise" function which takes place across the ORM and Core in any place that a transaction is being rolled back in response to an error which occurred trying to commit, including the context managers provided by :class:`.Session` and :class:`.Connection`, and taking place for operations such as a failure on "RELEASE SAVEPOINT". Previously, the fix was only in place for a specific path within the ORM flush/commit process; it now takes place for all transational context managers as well. fixes #2696
* fix some typospr/220Nils Philippsen2015-12-081-1/+1
|
* - The :meth:`.Session.merge` method now tracks pending objects byMike Bayer2015-12-041-3/+17
| | | | | | | | primary key before emitting an INSERT, and merges distinct objects with duplicate primary keys together as they are encountered, which is essentially semi-deterministic at best. This behavior matches what happens already with persistent objects. fixes #3601
* - A rare case which occurs when a :meth:`.Session.rollback` fails in theMike Bayer2015-11-191-2/+14
| | | | | | | | | | | | scope of a :meth:`.Session.flush` operation that's raising an exception, as has been observed in some MySQL SAVEPOINT cases, prevents the original database exception from being observed when it was emitted during flush, but only on Py2K because Py2K does not support exception chaining; on Py3K the originating exception is chained. As a workaround, a warning is emitted in this specific case showing at least the string message of the original database error before we proceed to raise the rollback-originating exception. fixes #2696
* - reduce some callcounts within the new eventsMike Bayer2015-09-031-31/+29
|
* - The :class:`.SessionEvents` suite now includes events to allowticket_2677Mike Bayer2015-09-021-115/+126
| | | | | | | | | | | | | | | | | | | | | unambiguous tracking of all object lifecycle state transitions in terms of the :class:`.Session` itself, e.g. pending, transient, persistent, detached. The state of the object within each event is also defined. fixes #2677 - Added a new session lifecycle state :term:`deleted`. This new state represents an object that has been deleted from the :term:`persistent` state and will move to the :term:`detached` state once the transaction is committed. This resolves the long-standing issue that objects which were deleted existed in a gray area between persistent and detached. The :attr:`.InstanceState.persistent` accessor will **no longer** report on a deleted object as persistent; the :attr:`.InstanceState.deleted` accessor will instead be True for these objects, until they become detached. - The :paramref:`.Session.weak_identity_map` parameter is deprecated. See the new recipe at :ref:`session_referencing_behavior` for an event-based approach to maintaining strong identity map behavior. references #3517
* - use consistent and descriptive language in all casesMike Bayer2015-08-271-3/+14
| | | | | | where we refer to the "weak_identity_map" option, and add additional exposition in the session documentation which refers to it. fixes #3517
* fix typo int->intopr/192halfcrazy2015-08-091-1/+1
|
* - Fixed bug where the state tracking within multiple, nestedMike Bayer2015-04-021-0/+1
| | | | | | | | | :meth:`.Session.begin_nested` operations would fail to propagate the "dirty" flag for an object that had been updated within the inner savepoint, such that if the enclosing savepoint were rolled back, the object would not be part of the state that was expired and therefore reverted to its database state. fixes #3352
* - Added a list() call around a weak dictionary used within theMike Bayer2015-04-011-1/+1
| | | | | | commit phase of the session, which without it could cause a "dictionary changed size during iter" error if garbage collection interacted within the process. Change was introduced by
* - Fixed bug where the session attachment error "object is alreadyMike Bayer2015-03-101-7/+7
| | | | | | | attached to session X" would fail to prevent the object from also being attached to the new session, in the case that execution continued after the error raise occurred. fixes #3301
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - remove the need for a recursive call hereMike Bayer2015-02-201-5/+12
|
* - Fixed bug where internal assertion would fail in the case whereMike Bayer2015-02-201-2/+5
| | | | | | | | an ``after_rollback()`` handler for a :class:`.Session` incorrectly adds state to that :class:`.Session` within the handler, and the task to warn and remove this state (established by :ticket:`2389`) attempts to proceed. fixes #3309
* - Mapped state internals have been reworked to allow for a 50% reductionMike Bayer2015-02-181-3/+7
| | | | | | | | in callcounts specific to the "expiration" of objects, as in the "auto expire" feature of :meth:`.Session.commit` and for :meth:`.Session.expire_all`, as well as in the "cleanup" step which occurs when object states are garbage collected. fixes #3307
* - A warning is emitted if the ``isolation_level`` parameter is usedMike Bayer2015-02-041-8/+33
| | | | | | | | | | | | | | | | with :meth:`.Connection.execution_options` when a :class:`.Transaction` is in play; DBAPIs and/or SQLAlchemy dialects such as psycopg2, MySQLdb may implicitly rollback or commit the transaction, or not change the setting til next transaction, so this is never safe. - Added new parameter :paramref:`.Session.connection.execution_options` which may be used to set up execution options on a :class:`.Connection` when it is first checked out, before the transaction has begun. This is used to set up options such as isolation level on the connection before the transaction starts. - added new documentation section detailing best practices for setting transaction isolation with sessions. fixes #3296
* - correctionsMike Bayer2014-12-271-2/+2
| | | | - attempt to add a script to semi-automate the fixing of links
* - Added new method :meth:`.Session.invalidate`, functions similarlyMike Bayer2014-12-121-2/+40
| | | | | | | | | | to :meth:`.Session.close`, except also calls :meth:`.Connection.invalidate` on all connections, guaranteeing that they will not be returned to the connection pool. This is useful in situations e.g. dealing with gevent timeouts when it is not safe to use the connection further, even for rollbacks. references #3258
* - A new series of :class:`.Session` methods which provide hooksMike Bayer2014-12-081-22/+37
| | | | | | | | | | directly into the unit of work's facility for emitting INSERT and UPDATE statements has been created. When used correctly, this expert-oriented system can allow ORM-mappings to be used to generate bulk insert and update statements batched into executemany groups, allowing the statements to proceed at speeds that rival direct use of the Core. fixes #3100
* - add an option for bulk_save -> update to not do historyMike Bayer2014-12-071-11/+21
|
* - fix inheritance persistenceMike Bayer2014-12-071-0/+158
| | | | - start writing docs
* - initial tests for bulkMike Bayer2014-12-071-1/+2
|
* Merge branch 'master' into ticket_3100Mike Bayer2014-11-061-47/+61
|\
| * - Fixed bug where :meth:`.Session.expunge` would not fully detachMike Bayer2014-10-191-4/+8
| | | | | | | | | | | | | | 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
| * - Improvements to the mechanism used by :class:`.Session` to locateMike Bayer2014-10-141-43/+53
| | | | | | | | | | | | | | "binds" (e.g. engines to use), such engines can be associated with mixin classes, concrete subclasses, as well as a wider variety of table metadata such as joined inheritance tables. fixes #3035
* | - add options to get back pk defaults for inserts.Mike Bayer2014-09-021-7/+9
| | | | | | | | times spent start getting barely different...
* | Merge branch 'master' into ticket_3100Mike Bayer2014-09-021-5/+5
|\ \ | |/
| * - need to use safe_discard() at least in _restore_snapshot(), let's use itMike Bayer2014-08-291-3/+3
| | | | | | | | everywhere in Session since the optimized one only applies to loading
| * - use a faster discard when loadingMike Bayer2014-08-291-2/+2
| | | | | | | | - don't do a bool on identity map since it calls __len__
* | - refinementsMike Bayer2014-08-191-19/+10
| |
* | - change to be represented as two very fast bulk_insert() and bulk_update() ↵Mike Bayer2014-08-151-28/+29
| | | | | | | | methods
* | devMike Bayer2014-08-151-6/+17
| |
* | - proof of conceptMike Bayer2014-08-151-0/+34
|/
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-159/+164
| | | | 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
* - Fixed bug where items that were persisted, deleted, or had aMike Bayer2014-07-011-1/+4
| | | | | | | primary key change within a savepoint block would not participate in being restored to their former state (not in session, in session, previous PK) after the outer transaction were rolled back. fixes #3108
* - Adjustment to attribute mechanics concerning when a value isMike Bayer2014-05-291-25/+25
| | | | | | | | | | | | | | implicitly initialized to None via first access; this action, which has always resulted in a population of the attribute, now emits an attribute event just like any other attribute set operation and generates the same kind of history as one. Additionally, many mapper internal operations will no longer implicitly generate these "None" values when various never-set attributes are checked. These are subtle behavioral fixes to attribute mechanics which provide a better solution to the problem of :ticket:`3060`, which also involves recognition of attributes explicitly set to ``None`` vs. attributes that were never set. fixes #3061
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-2/+2
| | | | Found using: https://github.com/intgr/topy
* Added some links in session docsbenselme2014-04-231-35/+39
|
* - Added new utility function :func:`.make_transient_to_detached` which canMike Bayer2014-04-091-1/+35
| | | | | | | be used to manufacture objects that behave as though they were loaded from a session, then detached. Attributes that aren't present are marked as expired, and the object can be added to a Session where it will act like a persistent one. fix #3017
* -rewrite expire/refresh sectionMike Bayer2014-02-231-0/+24
|
* - happy new yearMike Bayer2014-01-051-1/+1
|
* Don't barf on Session(info=...) from sessionmaker(info=None)Robin Schoonover2013-12-311-1/+2
|
* load_on_pending is different from enable_relationship_loading and shouldMike Bayer2013-12-151-2/+8
| | | | not be superseded. both have a potential use.
* - The :class:`.exc.StatementError` or DBAPI-related subclassMike Bayer2013-12-111-1/+12
| | | | | | | | | | now can accomodate additional information about the "reason" for the exception; the :class:`.Session` now adds some detail to it when the exception occurs within an autoflush. This approach is taken as opposed to combining :class:`.FlushError` with a Python 3 style "chained exception" approach so as to maintain compatibility both with Py2K code as well as code that already catches ``IntegrityError`` or similar.