From f21ec8587d871f00896f72b88641f348bb22a0b9 Mon Sep 17 00:00:00 2001 From: Brent Tubbs Date: Thu, 6 Jul 2017 16:03:41 -0600 Subject: [PATCH] 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. --- docs/tutorial.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 16ca2981..b07eaecf 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -95,8 +95,6 @@ Create ``flask_sqlalchemy/schema.py`` and type the following: from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField from models import db_session, Department as DepartmentModel, Employee as EmployeeModel - schema = graphene.Schema() - class Department(SQLAlchemyObjectType): class Meta: @@ -114,7 +112,7 @@ Create ``flask_sqlalchemy/schema.py`` and type the following: node = relay.Node.Field() all_employees = SQLAlchemyConnectionField(Employee) - schema.query = Query + schema = graphene.Schema(query=Query) Creating GraphQL and GraphiQL views in Flask --------------------------------------------