Skip to content
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

Add support for batching #1798

Closed
wants to merge 1 commit into from
Closed

Add support for batching #1798

wants to merge 1 commit into from

Conversation

patrick91
Copy link
Member

This PR adds support for batching. I want to make sure all the views get this :)

TODO:

  • Consolidate all the views (this can be done in another PR if I don't manage to have enough time)
  • Allow to disable batching
  • Support of async (with gather)

Closes #1383

@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #1798 (13949fd) into main (c64a9f9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1798   +/-   ##
=======================================
  Coverage   98.15%   98.15%           
=======================================
  Files         139      139           
  Lines        5252     5262   +10     
  Branches      955      960    +5     
=======================================
+ Hits         5155     5165   +10     
  Misses         52       52           
  Partials       45       45           

@justuswilhelm
Copy link

This looks good. Looking forward to seeing this get merged.

@patrick91
Copy link
Member Author

hi @justuswilhelm! that's good to know, do you need this for django or other frameworks? 😊

@justuswilhelm
Copy link

hi @justuswilhelm! that's good to know, do you need this for django or other frameworks? 😊

Thanks for your fast response. Yes, I am using strawberry in django together with apollo in the frontend

@camflan
Copy link

camflan commented Mar 13, 2023

@patrick91 I'd love to get this merged. Is there anything I can help with?

@patrick91
Copy link
Member Author

@camflan I'll try to work on this in the next few weeks, I'm a bit busy and don't have a lot of free time :D

Good to know there's people that need this 😊

@camflan
Copy link

camflan commented Mar 13, 2023

@camflan I'll try to work on this in the next few weeks, I'm a bit busy and don't have a lot of free time :D

Good to know there's people that need this 😊

Understood! We've started an initiative to get off graphene and this will be one of our blockers for rolling out to clients. If there's anything I can do to help please let me know

@patrick91
Copy link
Member Author

@camflan thanks for offering! Please don't hesitate to ping me in discord if I forget :)

What integration are you using? :)

@patrick91
Copy link
Member Author

patrick91 commented Mar 15, 2023

@camflan I'll think about how we can enable this feature using schema extensions, if I don't find a good solution I'll keep working on the solution from this PR

@camflan
Copy link

camflan commented Mar 15, 2023

@camflan thanks for offering! Please don't hesitate to ping me in discord if I forget :)

What integration are you using? :)

We'd be mostly using a django integration

@patrick91
Copy link
Member Author

@camflan I'm working on refactoring the HTTP view layer before adding this. Shouldn't take too long 😊

@camflan
Copy link

camflan commented Mar 30, 2023

@camflan I'm working on refactoring the HTTP view layer before adding this. Shouldn't take too long 😊

Famous last words 🙈 😅

thanks for the update!

@patrick91
Copy link
Member Author

@camflan that's been merged! I'll work on batching soon :)

Do you have any requirements? I need to think about security requirements for this, for now I think I'll add the following options:

  1. Enable disable batching
  2. Batching limit (max x operations)

but I wonder if we should put more :)

@camflan
Copy link

camflan commented Apr 5, 2023

@camflan that's been merged! I'll work on batching soon :)

Yay! 🥳

Do you have any requirements? I need to think about security requirements for this, for now I think I'll add the following options:

1. Enable disable batching

2. Batching limit (max x operations)

I think both of those would cover what we need for now. Batching limit, rate limiting, etc could even be tackled later as a middleware instead of the core implementation, right?

@patrick91
Copy link
Member Author

I think both of those would cover what we need for now. Batching limit, rate limiting, etc could even be tackled later as a middleware instead of the core implementation, right?

depends on what you mean by middlewares, Strawberry extensions at the moment only work on a single operation.

But you'll be able to extend the GraphQL view/router to do additional validation. I think there's going to be a method called run_batch that will validate and execute the batching (and maybe a validate_batch method that can be used to change the validation if needed)

@patrick91
Copy link
Member Author

closed in favour of #2698

@patrick91 patrick91 closed this Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

support batched queries
3 participants