graphql-python / graphql-python/graphene-sqlalchemy
geoalchemy2 support
- Vorherrschende Sprache
- Python
- Sterne
- 985
- Forks
- 223
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
## 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)
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.