~ubuntu-branches/debian/sid/sqlalchemy/sid

« back to all changes in this revision

Viewing changes to doc/build/orm/mapper_config.rst

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2014-06-27 20:17:13 UTC
  • mfrom: (1.4.28)
  • Revision ID: package-import@ubuntu.com-20140627201713-g6p1kq8q1qenztrv
Tags: 0.9.6-1
* New upstream release
* Remove Python 3.X build tag files, thanks to Matthias Urlichs for the
  patch (closes: #747852)
* python-fdb isn't in the Debian archive yet so default dialect for firebird://
  URLs is changed to obsolete kinterbasdb, thanks to Russell Stuart for the
  patch (closes: #752145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
942
942
While the :func:`.synonym` is useful for simple mirroring, the use case
943
943
of augmenting attribute behavior with descriptors is better handled in modern
944
944
usage using the :ref:`hybrid attribute <mapper_hybrids>` feature, which
945
 
is more oriented towards Python descriptors.   Techically, a :func:`.synonym`
 
945
is more oriented towards Python descriptors.   Technically, a :func:`.synonym`
946
946
can do everything that a :class:`.hybrid_property` can do, as it also supports
947
947
injection of custom SQL capabilities, but the hybrid is more straightforward
948
948
to use in more complex situations.
1395
1395
time the ORM emits an ``UPDATE`` or ``DELETE`` against the row to ensure that
1396
1396
the value held in memory matches the database value.
1397
1397
 
 
1398
.. warning::
 
1399
 
 
1400
    Because the versioning feature relies upon comparison of the **in memory**
 
1401
    record of an object, the feature only applies to the :meth:`.Session.flush`
 
1402
    process, where the ORM flushes individual in-memory rows to the database.
 
1403
    It does **not** take effect when performing
 
1404
    a multirow UPDATE or DELETE using :meth:`.Query.update` or :meth:`.Query.delete`
 
1405
    methods, as these methods only emit an UPDATE or DELETE statement but otherwise
 
1406
    do not have direct access to the contents of those rows being affected.
 
1407
 
1398
1408
The purpose of this feature is to detect when two concurrent transactions
1399
1409
are modifying the same row at roughly the same time, or alternatively to provide
1400
1410
a guard against the usage of a "stale" row in a system that might be re-using
1454
1464
The above UPDATE statement is updating the row that not only matches
1455
1465
``user.id = 1``, it also is requiring that ``user.version_id = 1``, where "1"
1456
1466
is the last version identifier we've been known to use on this object.
1457
 
If a transaction elsewhere has modifed the row independently, this version id
 
1467
If a transaction elsewhere has modified the row independently, this version id
1458
1468
will no longer match, and the UPDATE statement will report that no rows matched;
1459
1469
this is the condition that SQLAlchemy tests, that exactly one row matched our
1460
1470
UPDATE (or DELETE) statement.  If zero rows match, that indicates our version