graphql-python / graphql-python/graphene-sqlalchemy

geoalchemy2 support

Open
#140 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
985
Forks
223
PR merge metrics
No merged PRs in 30d

Description

## 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)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.