]> 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:42:32 +0000 (16:42 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Oct 2013 20:42:32 +0000 (16:42 -0400)
commitf00544a589d5002ddf0146706c4ba67509452ea7
treec9d03d4aefbc93dd3e010d33a1add2912146e4e9
parent366e74b1bef36d384da4da8ff68751d68ba078f6
-  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]
doc/build/changelog/changelog_08.rst
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_subquery_relations.py