graphql-python / flask-graphql

Adds GraphQL support to your Flask application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Flask-GraphQL and Flask-SQLAlchemy together?

remingtonc opened this issue · comments

Based on the tutorial setup and personal testing, it doesn't appear that these two methods work in tandem. Any examples of these interoperating? Or should I switch to raw SQLAlchemy to support GraphQL?

Moving issue to graphene-sqlalchemy as it is more applicable.

@syrusakbary Thank you! That is the tutorial I have been following, however I am attempting to use Flask-SQLAlchemy instead of SQLAlchemy alone. It does not appear to work out of the box when modeling using the convenience of Flask-SQLAlchemy.

This isn't a tremendous issue because I can always convert over to just SQLAlchemy, but it would be nice if they worked together. I could easily be wrong, and hope I am :)

I set the session:

schema = graphene.Schema()
schema.execute(context_value={'session': db.session})

On query:
{ "errors": [ { "message": "'NoneType' object has no attribute 'fields'" } ], "data": null }

@remingtonc I ran into this recently, any update since you reported? thanks