Skip to content

Commit 4524a44

Browse files
committed
docs: add examples for basic root fields
1 parent c85ea87 commit 4524a44

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

examples/flask_sqlalchemy/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ and run some queries!
5353
__typename
5454
}
5555

56+
employee(id: "RW1wbG95ZWU6Mw==") {
57+
name
58+
hiredOn
59+
}
60+
5661
allEmployees(sort: [HIRED_ON_ASC, NAME_ASC], first: 2) {
5762
edges {
5863
cursor

examples/flask_sqlalchemy/schema.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ class Query(graphene.ObjectType):
5151
# Expose `node` root field as mandated by Relay specification
5252
node = relay.Node.Field()
5353

54+
# Basic root fields, e.g. `employee(id: "RW1wbG95ZWU6Mw==")`
55+
employee = relay.Node.Field(Employee)
56+
role = relay.Node.Field(Role)
57+
department = relay.Node.Field(Department)
58+
5459
# Allow sorting over one or multiple columns, by default over the primary
5560
# key, e.g. `allEmployees(sort: [HIRED_ON_ASC, NAME_ASC, ID_ASC])`; not
5661
# specifying `sort` is the same as using `sort=Employee.sort_argument()`

0 commit comments

Comments
 (0)