You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Recommendation: add SQLAlchemy session object context_value in README #5
Thank you for creating such a great library. This is a huge benefit to my project.
That being said, I had to jump through a few hoops to figure out how to get querying up and running for the graphiql interface (with SQLalchemy running the backend models and linked into the database session/transaction manager)
I was finally able to get everything wired up by setting the following:
return serve_graphql_request(request, schema, context_value={'session': request.dbsession}, graphiql_enabled=True)
It would be helpful to list for other SQLAlchemy users who want a quick graphql interface via webob instead of flask.
If cookie cutter has been used to create pyramid project,
and result of session factory(new session) is added to request method as dbsession, then we should replace session with dbsession:
serve_graphql_request(request, schema, context_value={'session': request.dbsession}, graphiql_enabled=True)
Activity
sydoluciani commentedon Mar 20, 2020
If cookie cutter has been used to create pyramid project,
and result of session factory(new session) is added to request method as dbsession, then we should replace session with dbsession:
serve_graphql_request(request, schema, context_value={'session': request.dbsession}, graphiql_enabled=True)
https://github.com/Pylons/pyramid-cookiecutter-starter/blob/latest/%7B%7Bcookiecutter.repo_name%7D%7D/%7B%7Bcookiecutter.repo_name%7D%7D/sqlalchemy_models/__init__.py#L75
Otherwise, session is available in request method with the same name and current example works fine:
https://github.com/graphql-python/webob-graphql#pyramid