graphql-python / graphql-python/graphene-sqlalchemy
geoalchemy2 support
- 主要语言
- 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