Skip to content

geoalchemy2 support #140

Open
Open
@wahello

Description

@wahello

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 (<class 'sqlalchemy.sql.schema.Column'>)

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)


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions