Examples don't work
See original GitHub issueHi,
I followed the flask-sqlalchemy examples here (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:
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.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:7
Top Results From Across the Web
examples don't work - Help
Hi, I just clone the Timeline JS project through the github. I find there is an example folder in the project and it...
Read more >examples don't work at all.
examples don't work at all. In the exercise Manipulating HTML the four boxes do not do anything when i hover over or click...
Read more >Why examples don't work? (a struggle with imports)
At first two problems appeared easy to fix: SyntaxError: import declarations may only appear at top level of a module; The character encoding...
Read more >`with-react-native-web` example doesn't work · Issue #1919
The example should work in order for developers to learn and explore how things are wired up. Furthermore, the example is using the...
Read more >What are some examples of C code that doesn't work when ...
What are some examples of C code that doesn't work when compiled in a C++ compiler?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

With modern
flask-graphqluseget_context=lambda: {'session': db.session}:See https://github.com/graphql-python/flask-graphql/issues/52#issuecomment-412773200
@yoursdearboy Super!! Your (lambda) solution worked for me using the Dec 2020 version of graphene.
If anyone wants to explore a minimal running version, code and setup instructions are here.