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)

```

贡献指南

打开贡献指南

调研方向

Start with the schema file and the reported conversion exception, then inspect how graphene_sqlalchemy.converter dispatches SQLAlchemy column types. Reproduce the Geography example and verify that schema creation handles the location field and produces the intended CoordinateJSON field.

由索引模型根据 Issue 内容生成。

评估

技术栈
graphql, python, sqlalchemy
领域
backend-api-design
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。