Graphene GAE集成
项目描述
为Graphene提供的Google AppEngine集成库
免费软件:BSD许可协议
升级说明
如果您是从旧版本(2.0版本之前)升级,请查看Graphene升级指南。
安装
要将Graphene-GAE安装到您的AppEngine项目中,请转到您的项目文件夹,并在shell中运行以下命令
pip install graphene-gae -t ./libs
这将安装库及其依赖项到您的项目根目录下的libs文件夹中,因此当您发布应用程序时,依赖项将与您的GAE项目一起上传。
确保libs文件夹位于您的Python路径中,请将以下内容添加到您的appengine_config.py
import sys
for path in ['libs']:
if path not in sys.path:
sys.path[0:0] = [path]
示例
这是一个简单的GAE模型
class Article(ndb.Model):
headline = ndb.StringProperty()
summary = ndb.TextProperty()
text = ndb.TextProperty()
author_key = ndb.KeyProperty(kind='Author')
created_at = ndb.DateTimeProperty(auto_now_add=True)
updated_at = ndb.DateTimeProperty(auto_now=True)
要为它创建GraphQL模式,您只需编写以下内容
import graphene
from graphene_gae import NdbObjectType
class ArticleType(NdbObjectType):
class Meta:
model = Article
class Query(graphene.ObjectType):
articles = graphene.List(ArticleType)
@graphene.resolve_only_args
def resolve_articles(self):
return Article.query()
schema = graphene.Schema(query=QueryRoot)
然后您可以简单地查询该模式
要了解更多信息,请查看以下示例
贡献
克隆此仓库后,通过运行以下命令确保安装了依赖项:
make deps
make install
请确保正在运行测试和代码风格检查
make test
make lint
历史记录
1.0.7 (待定)
GraphQLHandler GET 支持 ([PR #27](https://github.com/graphql-python/graphene-gae/pull/27))
1.0.6 (2016-12-06)
修复了 DeadlineExceededError 导入,swo 连接能够正确处理超时
1.0.5 (2016-11-23)
改进了 NdbConnectionField 的行为,当 transform_edges 也过滤掉一些边时 ([PR #26](https://github.com/graphql-python/graphene-gae/pull/25))
1.0.3 (2016-11-22)
将 transform_edges 添加到 NdbConnectionField ([PR #25](https://github.com/graphql-python/graphene-gae/pull/25))
1.0.2 (2016-10-20)
将 _handle_graphql_errors 钩子添加到 GraphQLHandler
1.0.1 (2016-09-28)
添加了对 StructuredProperty 的支持
1.0 (2016-09-26)
升级到 Graphene 1.0
0.1.9 (2016-08-17)
每个 NdbObject 现在都暴露了一个映射到实体 key.id() 的 ndbId String 字段
将 ndb boolean 参数添加到 NdbKeyStringField,因此现在在查看 KeyProperty 时,可以获取全局 GraphQL id 或 NDB 内部 id。
0.1.8 (2016-08-16)
使 connection_from_ndb_query 对随机的 ndb 超时具有弹性
0.1.7 (2016-06-14)
BREAKING: 修复了 KeyProperty 的行为,以公开 GraphQL 全球 ID 而不是内部 ndb.Key 值。 ([PR #16](https://github.com/graphql-python/graphene-gae/pull/16))
0.1.6 (2016-06-10)
将开发状态更改为 Beta
添加了 NdbNode.global_id_to_key [PR #15](https://github.com/graphql-python/graphene-gae/pull/15)
0.1.5 (2016-06-08)
修复了 ndb.KeyProperty 的行为 ([PR #14](https://github.com/graphql-python/graphene-gae/pull/14))
0.1.4 (2016-06-02)
- NdbConnectionField 添加了可用于查询的参数
keys_only - 执行只获取键的查询
batch_size - 控制NDB查询迭代批量大小
page_size - 控制分页连接结果的页面大小
- 添加了对 LocalStructuredProperty 的支持。
给定属性 ndb.LocalStructuredType(Something),它将自动映射到 Field(SomethingType) - SomethingType 必须是模式的一部分。
支持 repeated 和 required 属性。
0.1.3 (2016-05-27)
添加了 graphene_gae.webapp2.GraphQLHandler - 一个基本的 HTTP 处理程序,用于处理 GraphQL 请求
0.1.1 (2016-05-25)
- 将 graphene 依赖项更新到最新的 0.10.1 版本。
NdbConnection.from_list 现在将上下文作为参数获取
0.1.0 (2016-05-11)
首次在 PyPI 上发布。
项目详情
graphene_gae-2.0.0.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | d0141b76853ae6297a12359c3b64b1d410439eeb339107bd839daef97cf73e34 |
|
MD5 | 6271d7af8918acf088d4218bf0ee31e3 |
|
BLAKE2b-256 | 56a7a3aee22a7215b09c6a884b8e4a2c56c5bf0e24a0de3e4c956318a43b1573 |