-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto optimizations #7
Conversation
* Drops Django 1.9, adds Django 1.11 * 1.8 remains due to being LTS * Drops DRF 3.3, adds DRF 3.6
* Which can be used in place of the explicit mixin approach if desired
fb8e5e5
to
34ab554
Compare
* Depending on what is being expanded * By default is disabled, can easily be enabled globally/per view * Tested to support optimizing calls to both single related instances, and to related querysets. Uses `select_related` and `prefetch_related` as required * Can be provided explicitly on non-model serializers * Can be disabled for individual expandable relations
34ab554
to
72a8335
Compare
Codecov Report
@@ Coverage Diff @@
## master #7 +/- ##
=========================================
Coverage ? 99.77%
=========================================
Files ? 5
Lines ? 450
Branches ? 0
=========================================
Hits ? 449
Misses ? 1
Partials ? 0
Continue to review full report at Codecov.
|
Fixes #6 as an aside |
* Remove the requirement to add to `INSTALLED_APPS`, unnecessary * Better explanation of `QUERY_PARAMS_ENABLED` setting
@gareth-lloyd would love your input on this if you can spare the time? :) |
I read through this today. I like the approach! I'll try to find time for a line-by-line review and then I'd be happy to start using it on some of our views ASAP. |
Hi, |
As discussed elsewhere, Django 1.8 support should not be dropped as per Django’s support schedule. |
So maybe make a try with DRF 3.6.4 (last 3.6 version) instead of 3.6.2 |
fe69435
to
58d7fa1
Compare
7b70b57
to
45c4db3
Compare
@jojolalpin @KyeRussell the tests pass now on this branch, and master has been merged into it, so it conforms to the current Django support lifecycles as well as Rest framework current - 2. The only thing preventing it from being merged is lack of feedback. I could just merge it as-is, as it shouldn't negatively affect users unless they turn the feature on. Happy to take suggestions! |
Hi,
Yesterday I managed to pass some tests on my fork but was struggling with
the set thing for Django 2.
I will make tries with the updated branch as I have a project with a set of
interlinked serializers that should show the gains in perf (as for now it
takes 30 secs to run a query...)
I will let you know asap the results and any problems I encounter.
EDIT: It works like a charm. THANKS A LOT !
1 thing, with a ManyToMany field using a through model (a person, an organization and a membership, organization.members is a ManyToManyField to Person Through Memberships.
I can expand members in organization but not members__person
But I can expand memberships__person so this is not blocking and maybe even just a limitation of the ManyToManyField.
Performance: now it runs in 3 seconds instead of 30 with few queries.
Before I had already declared primarykey fields in the serializers that I commented so I cannot measure exacly the gain).
Le mer. 3 janv. 2018 à 21:51, Ian Clark <[email protected]> a écrit :
… @jojolalpin <https://github.com/jojolalpin> @KyeRussell
<https://github.com/kyerussell> the *tests pass* now on this branch, and
master has been merged into it, so it conforms to the current Django
support lifecycles as well as Rest framework current - 2. The only thing
preventing it from being merged is lack of feedback. I could just merge it
as-is, as it shouldn't negatively affect users unless they turn the feature
on. Happy to take suggestions!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACrozx9sLo6-7ydGhxoKCi_gM5DH8j3Oks5tG-hegaJpZM4M-we0>
.
|
Hi, any idea when you merge this ? |
Hey @jojolalpin. Sorry, I'm no longer working with DRF so I've not had the ability to run this in the wild. What's your experience been with it? Happy to build a very though I think, because IIRC I've turned the feature off by default? |
Hi Ian,
I pull from the commit with this option. Everything works well and I think
you should merge what is ok if you do not work on it anymore.
Your extension comes in my default setting with drf.
Thanks a lot for it.
Julien
Le lun. 2 juil. 2018 à 19:47, Ian Clark <[email protected]> a écrit :
… Hey @jojolalpin <https://github.com/jojolalpin>. Sorry, I'm no longer
working with DRF so I've not had the ability to run this in the wild.
What's your experience been with it? Happy to build a very though I think,
because IIRC I've turned the feature off by default?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACrozyM21kGUsnPOEYsJe3_34sTIZ0QRks5uClyigaJpZM4M-we0>
.
|
Thanks a lot!
Le lun. 2 juil. 2018 à 20:01, Ian Clark <[email protected]> a écrit :
… Merged #7
<#7>
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACrozzjVLflCSelWXyO7odF_AxrsgV_Zks5uCl_1gaJpZM4M-we0>
.
|
@jojolalpin now available in |
Just a quick question, permissions are still not checked when you expand?
Le lun. 2 juil. 2018 à 20:52, Ian Clark <[email protected]> a écrit :
… @jojolalpin <https://github.com/jojolalpin> now available in 0.6.0 -
thanks for the extreme patience!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACroz4rvMenHkVY3e8EVgVlVKHNzhPcKks5uCmvRgaJpZM4M-we0>
.
|
I think that's correct, but this was all done so long ago! Would need to sit down properly to give you a more complete answer |
If you did not add this "recently", permissions are not checked. I had to
make a filter working with a not so old commit.
Le lun. 2 juil. 2018 à 21:01, Ian Clark <[email protected]> a écrit :
… I think that's correct, but this was all done so long ago! Would need to
sit down properly to give you a more complete answer
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACroz80e7NO_6E5Nmk7Lf0jtr5qxeYi-ks5uCm4NgaJpZM4M-we0>
.
|
Happy to take contributions if you've worked on something? |
No it was very specific for a rarely called query and very basic. Could
have done more beautiful but I was lazy.
Le lun. 2 juil. 2018 à 21:10, Ian Clark <[email protected]> a écrit :
… Happy to take contributions if you've worked on something?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACrozw_uhx8p-Jl_UZN7ALoXm3TXbPC7ks5uCnALgaJpZM4M-we0>
.
|
to end about permissions, having each object read permissions (I use
dry-rest-permissions <https://github.com/dbkaplan/dry-rest-permissions>) in
the response allows to simply filter it.
Le lun. 2 juil. 2018 à 21:49, jojolalpin <[email protected]> a écrit :
… No it was very specific for a rarely called query and very basic. Could
have done more beautiful but I was lazy.
Le lun. 2 juil. 2018 à 21:10, Ian Clark ***@***.***> a
écrit :
> Happy to take contributions if you've worked on something?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#7 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ACrozw_uhx8p-Jl_UZN7ALoXm3TXbPC7ks5uCnALgaJpZM4M-we0>
> .
>
|
TODOS: