graphql-python / graphql-python/graphene-sqlalchemy

geoalchemy2 support

未關閉
#140 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
985
分支
223
PR 合併指標
30 天內沒有已合併 PR

描述

## Help! geoalchemy2 support!

```

class CoordinateMixin():
location = db.Column('location', Geography(geometry_type='POINT' ,srid=4326, spatial_index=True, dimension=2), doc='gps coordinate')

```
Exception: Don't know how to convert the SQLAlchemy field user.location ()

I'v already add the following code in schema file.
```

from geoalchemy2 import Geography
from graphene_sqlalchemy.converter import get_column_doc, convert_sqlalchemy_type
from app.graphql.extesions import CoordinateJSON

@convert_sqlalchemy_type.register(Geography)
def convert_column_to_coordinatejson(type, column, registry=None):
return graphene.Field(CoordinateJSON, description=get_column_doc(column))

schema = graphene.Schema(query=RootQuery, types=types, mutation=MyMutation)

```

貢獻指南

開啟貢獻指南

研究方向

先從 schema 檔案和回報的轉換例外開始,接著檢查 graphene_sqlalchemy.converter 如何分派 SQLAlchemy 欄位類型。重現 Geography 範例,並驗證 schema 建立能處理 location 欄位並產生預期的 CoordinateJSON 欄位。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
graphql, python, sqlalchemy
領域
backend-api-design
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。