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.
1 parent 3712542 commit 7af4137Copy full SHA for 7af4137
examples/field_example.py
@@ -0,0 +1,30 @@
1
+import graphene
2
+
3
+class Person(graphene.Interface):
4
+ name = graphene.String()
5
+ age = graphene.ID()
6
7
+class Patron(Person):
8
+ id = graphene.ID()
9
10
+class Query(graphene.ObjectType):
11
12
+ patron = graphene.Field(Patron)
13
14
+ def resolve_patron(self, args, info):
15
+ return Patron(id=1, name='Demo')
16
17
+schema = graphene.Schema(query=Query)
18
+query = '''
19
+ query something{
20
+ patron {
21
+ id
22
+ name
23
+ }
24
+}
25
+'''
26
+result = schema.execute(query)
27
+# Print the result
28
+print result.data['patron']
29
30
0 commit comments