This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
FieldError when using select_related with enable_only_optimization #152
Labels
enhancement
New feature or request
When trying to use
select_related
on a field, I am getting an error when theDjangoOptimizerExtension
is used with its defaultenable_only_optimization=True
.This happens because
only()
is used with "id", and thenselect_related
is issued on top:strawberry-django-plus/strawberry_django_plus/optimizer.py
Lines 529 to 533 in 9a54dd0
A workaround is to add the field also to
only
, but that could be done automatically then also.I am not sure about the
select_related
being necessary/useful here yet (maybe because of the Optional/None it might be necessary), but I think it's a generic issue.I also wondered what's the point of
enable_only_optimization
. Is it to reduce the amount of data being selected/transferred only?(related)
The text was updated successfully, but these errors were encountered: