graphql-python / graphql-python/graphene-sqlalchemy

Examples don't work

Offen
#30 7 Kommentare 16 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
985
Forks
223
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi,

I followed the flask-sqlalchemy examples [here](https://github.com/graphql-python/graphene-sqlalchemy/blob/master/examples/flask_sqlalchemy) (and the snippets in the project's Readme as well) but it didn't work out of the box. I had the following exception: `AttributeError: 'Request' object has no attribute 'get'` when trying to request from Graphiql.

After some fiddling with flask-sqlalchemy i solved the bug by passing a `context` argument to `GraphQLView.as_view`.

Here is my full url declaration:
```python
app.add_url_rule(
'/graphql',
view_func=GraphQLView.as_view(
'graphql',
schema=schema,
graphiql=True,
context={'session': db_session}
),
)
```

I don't know if this is the proper way to fix the problem, but thought it'll be useful to tell you about it.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.