Python GraphenePython 的 GraphQL 框架
Graphene 是 Python 的 GraphQL 框架,用于快速轻松构建 GraphQL schemas/types 。支持多种数据源,包括 SQL(Django、SQLAlchemy)、NoSQL、自定义 Python 对象等等。
示例代码:
import graphene
class Query(graphene.ObjectType):
hello = graphene.String()
def resolve_hello(self, args, context, info):
return 'World'
schema = graphene.Schema(query=Query)
schema.execute('''
query {
hello
}
''')评论
