Skip to content

Commit f21ec85

Browse files
authored
Fix tutorial.rst code sample that raises exception
If you try doing "schema = graphene.Schema", as this tutorial did, you get "AssertionError: Schema query must be Object Type but got: None." Instead you have to pass the query in on init.
1 parent c1a0cae commit f21ec85

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/tutorial.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ Create ``flask_sqlalchemy/schema.py`` and type the following:
9595
from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField
9696
from models import db_session, Department as DepartmentModel, Employee as EmployeeModel
9797
98-
schema = graphene.Schema()
99-
10098
10199
class Department(SQLAlchemyObjectType):
102100
class Meta:
@@ -114,7 +112,7 @@ Create ``flask_sqlalchemy/schema.py`` and type the following:
114112
node = relay.Node.Field()
115113
all_employees = SQLAlchemyConnectionField(Employee)
116114
117-
schema.query = Query
115+
schema = graphene.Schema(query=Query)
118116
119117
Creating GraphQL and GraphiQL views in Flask
120118
--------------------------------------------

0 commit comments

Comments
 (0)