Graphene acts as Data Cache layer like open query engine.
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- graphql, python
调研方向
该 issue 一开始没有指出要从哪个仓库文件、测试或入口点着手。首先明确缓存范围、键的确定方式、过期、变更失效以及父子更新行为;完成这项工作需要达成一致的设计,并完成相应的实现和测试。
由索引模型根据 Issue 内容生成。
描述
Hi Team,
My name is Giang, I would like to propose a new feature for caching results on certain selected nodes with class Meta: cache = True.
I would to do data analytics on big data lake s3 using pyspark mapping spark (or other libraries) schema to graphene schema and I would like to utilize server side graphql as cache layer . In other words, I would like to treat graphql as a next custom ORM for pyspark or other dataframe libraries.
When query data, I would like to get custom field results on that node and cache it for 30 minutes (Where big data speed of access to data lake s3 does not matter, but rather than the aggregations of results)
@jkimbo cc

Cached data will need to be run when there is no cached data when query and updating when using mutation on the Node

And we also have a scheme for updating from childs to parents
import graphene
Import os
os.env[“GRAPHENE_CACHE_TIME”] = 1800
class Company(graphene.ObjectType):
class Meta:
interfaces = (relay.Node,)
cache = True
name = graphene.String()
revenue = graphene.Float()
datetime = graphene.DateTime()
if there are nested child (update all parent nodes cache)
@classmethod // cache this result on query
get_all_companies(cls, info):
return [cls(**data) for data in database.values()]
@classmethod // cache this result by different pairs of inputs on query
get_company_report_by_period(cls, info, name, period):
selected_data = [data for data in database.values() if name == data[“name”] and period in data[“datetime”]]
return {
“name”: name,
“revenue”: sum(data[“revenue”] for data in selected_data),
“datetime”: period
}
class Query(graphene.ObjectType):
get_report = graphene.List(Company)
get_company_report_period = graphene.Field(Company)
def resolve_get_report(_, info):
return Company.get_all_companies()
def resolve_get_company_report_period(_, info, name, period):
return Company.get_company_report_by_period(name, period)
database = {
“0”: {
“name”: “amazon”,
“revenue”: 1000,
“datetime”: “2021-04-01”
},
“1”: {
“name”: “amazon”,
“revenue”: 1000,
“datetime”: “2021-05-01”
},
“2”: {
“name”: “google”,
“revenue”: 1000,
“datetime”: “2021-06-01”
}
}
Kind regards
Giang
- 主要语言
- Python
- 星标
- 8.2k
- 派生
- 818
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
graphql-python/graphene 的其他 Issue
-
🐛 bug
难度 2/5 1-3 小时 新手友好度 72/100
graphql-python/graphene#1389 · 5 条评论 · 2 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 68/100
graphql-python/graphene#1606 ·
-
✨ enhancement
难度 2/5 1-3 小时 新手友好度 38/100
graphql-python/graphene#1601 · 2 条评论 ·
-
✨ enhancement
难度 4/5 3-5 天 新手友好度 42/100
graphql-python/graphene#1600 ·
-
🐛 bug
难度 2/5 1-3 小时 新手友好度 55/100
graphql-python/graphene#1593 ·
查看 graphql-python/graphene 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
sublimehq/package_control#1780 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·