We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e62fcf + c155b7a commit 557ec44Copy full SHA for 557ec44
docs/execution/execute.rst
@@ -30,3 +30,30 @@ You can pass context to a query via ``context_value``.
30
schema = graphene.Schema(Query)
31
result = schema.execute('{ name }', context_value={'name': 'Syrus'})
32
33
+
34
35
+Variables
36
+_______
37
38
+You can pass variables to a query via ``variable_values``.
39
40
41
+.. code:: python
42
43
+ class Query(graphene.ObjectType):
44
+ user = graphene.Field(User)
45
46
+ def resolve_user(self, args, context, info):
47
+ return context.get('user')
48
49
+ schema = graphene.Schema(Query)
50
+ result = schema.execute(
51
+ '''query getUser($id: ID) {
52
+ user(id: $id) {
53
+ id
54
+ firstName
55
+ lastName
56
+ }
57
+ }''',
58
+ variable_values={'id': 12},
59
+ )
0 commit comments