]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- Added new option to :func:`.relationship` ``distinct_target_key``.
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Oct 2013 20:54:21 +0000 (16:54 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Oct 2013 20:54:21 +0000 (16:54 -0400)
commit28a349135792a2f8e94fc0892cb612804d3b072c
treeda4d0599fd3318445e74f914a1bc0298640a7bcd
parent0cea9fd61c59b68dd7e027bec92a67ebbea239fc
-  Added new option to :func:`.relationship` ``distinct_target_key``.
This enables the subquery eager loader strategy to apply a DISTINCT
to the innermost SELECT subquery, to assist in the case where
duplicate rows are generated by the innermost query which corresponds
to this relationship (there's not yet a general solution to the issue
of dupe rows within subquery eager loading, however, when joins outside
of the innermost subquery produce dupes).  When the flag
is set to ``True``, the DISTINCT is rendered unconditionally, and when
it is set to ``None``, DISTINCT is rendered if the innermost relationship
targets columns that do not comprise a full primary key.
The option defaults to False in 0.8 (e.g. off by default in all cases),
None in 0.9 (e.g. automatic by default).   Thanks to Alexander Koval
for help with this. [ticket:2836]

Conflicts:
lib/sqlalchemy/orm/relationships.py
doc/build/changelog/changelog_08.rst
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_subquery_relations.py