-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Batch Mutations for creating, updating, and deleting #438 #653
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR implements batch mutations for creating, updating, and deleting multiple objects in a single operation. The implementation makes batch operations an official feature by explicitly requiring list types as arguments, replacing the previous undocumented approach that relied on hidden logic for batch creation. Sequence diagram for batch mutation processsequenceDiagram
actor User
participant System
User->>System: Send batch mutation request
System->>System: Check if data is a list
alt Data is a list
System->>System: Process each item in the list
else Data is not a list
System->>System: Process single item
end
System->>User: Return mutation results
Class diagram for batch mutation changesclassDiagram
class Mutation {
+create_fruit: Fruit
+create_fruits: list[Fruit]
+patch_fruits: list[Fruit]
+update_fruits: list[Fruit]
}
class FruitInput
class FruitPartialInput
class Fruit
class FruitFilter
Mutation --> FruitInput
Mutation --> FruitPartialInput
Mutation --> Fruit
Mutation --> FruitFilter
note for Mutation "Batch mutations now require list types as arguments"
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @keithhackbarth - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟡 Documentation: 2 issues found
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@bellini666, @thclark, @patrick91 - What is the process for requesting a PR review here? |
Hi @keithhackbarth , Sorry for taking long to review this. I'm in the middle of a relocation (just moved from Brazil to the Netherlands) and it is consuming all of my time. I'll try to take some time during this week, or maximum next weekend to review this! |
Thanks, @bellini666 – and congrats on the move! Hope you're settling in well and enjoying the Netherlands. Quick semi-related question: is there a specific reason we disable all DjangoOptimizerExtension for mutations? Just want to clarify the reasoning behind that approach. When I remove those lines in mutations/fields.py and rerun pytest - everything works and its more performant so trying to figure out the logic. |
Batch mutations for creating, updating, and deleting.
Description
Batched mutations are mutations that mutate multiple objects at once.
Mutations with a filter function or accept a list of objects that return a list.
Types of Changes
Issues Fixed or Closed by This PR
#438
Checklist
Key Considerations When Reviewing
Previously, batch creation in Strawberry Django was an undocumented and untested feature, relying on hidden logic to adjust argument typing. To support batch operations as an official feature (including updates and deletes), I updated the syntax approach, which introduces a breaking change.
The new method explicitly requires batch mutations to take a
list
type as an argument. This makes the behavior more straightforward, consistent, and explicit.Summary by Sourcery
Implement batch mutations for creating, updating, and deleting multiple objects simultaneously, requiring list-type arguments for clarity and consistency. Update documentation and add tests to support this new feature.
New Features:
Enhancements:
Documentation:
Tests: