Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
strawberry_graphql-0.278.0-py3-none-any.whl | 2025-07-19 | 310.0 kB | |
strawberry_graphql-0.278.0.tar.gz | 2025-07-19 | 212.7 kB | |
0.278.0 source code.tar.gz | 2025-07-19 | 1.2 MB | |
0.278.0 source code.zip | 2025-07-19 | 1.6 MB | |
README.md | 2025-07-19 | 1.9 kB | |
Totals: 5 Items | 3.3 MB | 1 |
Add GraphQL Query batching support
GraphQL query batching is now supported across all frameworks (sync and async)
To enable query batching, add a valid batching_config
to the schema configuration.
This makes your GraphQL API compatible with batching features supported by various client side libraries, such as Apollo GraphQL and Relay.
Example (FastAPI):
:::py
import strawberry
from fastapi import FastAPI
from strawberry.fastapi import GraphQLRouter
from strawberry.schema.config import StrawberryConfig
@strawberry.type
class Query:
@strawberry.field
def hello(self) -> str:
return "Hello World"
schema = strawberry.Schema(
Query, config=StrawberryConfig(batching_config={"max_operations": 10})
)
graphql_app = GraphQLRouter(schema)
app = FastAPI()
app.include_router(graphql_app, prefix="/graphql")
Example (Flask):
:::py
import strawberry
from flask import Flask
from strawberry.flask.views import GraphQLView
app = Flask(__name__)
@strawberry.type
class Query:
@strawberry.field
def hello(self) -> str:
return "Hello World"
schema = strawberry.Schema(
Query, config=StrawberryConfig(batching_config={"max_operations": 10})
)
app.add_url_rule(
"/graphql/batch",
view_func=GraphQLView.as_view("graphql_view", schema=schema),
)
if __name__ == "__main__":
app.run()
Note: Query Batching is not supported for multipart subscriptions
Releases contributed by @aryaniyaps via [#3755]