graphql-python / graphql-python/graphene-sqlalchemy
Question about querying a single resource with flask sqlalchemy example.
- 主要語言
- Python
- 星號
- 985
- 分支
- 223
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I have followed the example at http://docs.graphene-python.org/projects/sqlalchemy/en/latest/tutorial/#testing-our-graphql-schema and have a question.
I can issue the following query to list all employees and their departments.
```
{
allEmployees {
edges {
node {
name
department {
name
}
}
}
}
}
```
I would like to be able to query a single employee name and their department name by employee id. I can query using the Node interface, but that doesn't allow me to access Employee name field. Am I supposed to "cast" this to the specific Employee type to do that? What I would like is something like:
```
{
employee(id: "someid") {
name
department {
name
}
}
```
Is this reasonable or am I "doing it wrong"? What is best practice for accessing a single employee using the Relay connections/nodes/edges paradigm?
Many thanks in advance!
貢獻指南
研究方向
從連結的 Graphene SQLAlchemy 教學開始,然後檢視 Node 介面和 issue 中的範例查詢。當確立並記錄透過 Relay 的 connections/nodes/edges 模型依 ID 擷取一個 Employee,同時存取其姓名和部門的建議方式後,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- graphql, python, sqlalchemy
- 領域
- api, backend-api-design
- Issue 類型
- 文件
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 20/100