You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the display_name is requested, song.album will be prefetched, but song.album.artist won't be and will result in N+1 queries for each serialized Song object. This can be resolved by using album.artist.name, album.artist. or album.artist.* as the value of display_name.requires.
Is this the expected behavior? If so, it would be helpful to have it mentioned explicitly in the docs. Otherwise, it's necessary to fix the DynamicFilterBackend._build_implicit_prefetches method to include prefetches of relations with empty path remainders. Either way I'll be glad to provide a PR with fixes.
The text was updated successfully, but these errors were encountered:
If the last part of the path in
DynamicField.requires
attribute is a relation and not a field name, the prefetch is not done. Example:If the
display_name
is requested,song.album
will be prefetched, butsong.album.artist
won't be and will result in N+1 queries for each serializedSong
object. This can be resolved by usingalbum.artist.name
,album.artist.
oralbum.artist.*
as the value ofdisplay_name.requires
.Is this the expected behavior? If so, it would be helpful to have it mentioned explicitly in the docs. Otherwise, it's necessary to fix the
DynamicFilterBackend._build_implicit_prefetches
method to include prefetches of relations with empty path remainders. Either way I'll be glad to provide a PR with fixes.The text was updated successfully, but these errors were encountered: