Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Can django-lint detect redundant fetches? #28

Open
Milo-Lu opened this issue Oct 25, 2019 · 1 comment
Open

Can django-lint detect redundant fetches? #28

Milo-Lu opened this issue Oct 25, 2019 · 1 comment

Comments

@Milo-Lu
Copy link

Milo-Lu commented Oct 25, 2019

Can django-lint detects places where extra columns are retrieved, and provides suggestions of using values or values_list? Thanks

@lamby
Copy link
Owner

lamby commented Oct 26, 2019

(By "extra" I assume you are meaning that they are retrieved but not used.) django-lint does not currently detect this but given that the underlying pylint tool can detect unused local variables then it might be possible to some degree but there would be so many false positives as model instances can be passed between modules... so, no, on balance I don't think this woud be a good thing to add.

Regarding using values_list etc. I would not recommend this approach as it moves you out of the world of Django into "raw" Python - I would use .only().

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants