]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- Feature enhancement: joined and subquery
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 Jul 2011 19:14:03 +0000 (15:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 Jul 2011 19:14:03 +0000 (15:14 -0400)
commit15cd4235b6e5bbcfebe14ba64f56b780ae2346d6
treeda60bd82f9084752cc46d114372f3cb16f17a3d0
parent7bb2adfff90f989d45cbcb6f306d8d9d82298816
  - Feature enhancement: joined and subquery
    loading will now traverse already-present related
    objects and collections in search of unpopulated
    attributes throughout the scope of the eager load
    being defined, so that the eager loading that is
    specified via mappings or query options
    unconditionally takes place for the full depth,
    populating whatever is not already populated.
    Previously, this traversal would stop if a related
    object or collection were already present leading
    to inconsistent behavior (though would save on
    loads/cycles for an already-loaded graph). For a
    subqueryload, this means that the additional
    SELECT statements emitted by subqueryload will
    invoke unconditionally, no matter how much of the
    existing graph is already present (hence the
    controversy). The previous behavior of "stopping"
    is still in effect when a query is the result of
    an attribute-initiated lazyload, as otherwise an
    "N+1" style of collection iteration can become
    needlessly expensive when the same related object
    is encountered repeatedly. There's also an
    as-yet-not-public generative Query method
    _with_invoke_all_eagers()
    which selects old/new behavior [ticket:2213]
CHANGES
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_eager_relations.py
test/orm/test_subquery_relations.py