diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-06-16 13:35:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-06-18 17:06:53 -0400 |
commit | 64b9d9886f0bf4bbb5f0d019ecdbe579cd495141 (patch) | |
tree | efca9e29f538c845d3268c0dedbd8f9c73d2a9bd /test/dialect/postgresql/test_reflection.py | |
parent | c3102b85c40ab4578a0f56ee1e8eee4a6e0aed55 (diff) | |
download | sqlalchemy-64b9d9886f0bf4bbb5f0d019ecdbe579cd495141.tar.gz |
create new approach for deeply nested post loader options
Added very experimental feature to the :func:`_orm.selectinload` and
:func:`_orm.immediateload` loader options called
:paramref:`_orm.selectinload.recursion_depth` /
:paramref:`_orm.immediateload.recursion_depth` , which allows a single
loader option to automatically recurse into self-referential relationships.
Is set to an integer indicating depth, and may also be set to -1 to
indicate to continue loading until no more levels deep are found.
Major internal changes to :func:`_orm.selectinload` and
:func:`_orm.immediateload` allow this feature to work while continuing
to make correct use of the compilation cache, as well as not using
arbitrary recursion, so any level of depth is supported (though would
emit that many queries). This may be useful for
self-referential structures that must be loaded fully eagerly, such as when
using asyncio.
A warning is also emitted when loader options are connected together with
arbitrary lengths (that is, without using the new ``recursion_depth``
option) when excessive recursion depth is detected in related object
loading. This operation continues to use huge amounts of memory and
performs extremely poorly; the cache is disabled when this condition is
detected to protect the cache from being flooded with arbitrary statements.
Fixes: #8126
Change-Id: I9f162e0a09c1ed327dd19498aac193f649333a01
Diffstat (limited to 'test/dialect/postgresql/test_reflection.py')
0 files changed, 0 insertions, 0 deletions