art1415926535 / graphene-sqlalchemy-filter

Filters for Graphene SQLAlchemy integration
https://pypi.org/project/graphene-sqlalchemy-filter/
MIT License
118 stars 34 forks source link

'Request' object has no attribute 'get' #2

Closed cargan closed 5 years ago

cargan commented 5 years ago

Hi, I am getting this error with FilterableConnectionField, however with original SQLAlchemyConnectionField it works. I have tried with my own model as well as with dummy User model used in the example. Using Flask.

An error occurred while resolving field Query.allPreds Traceback (most recent call last): File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphql/execution/executor.py", line 450, in resolve_or_error return executor.execute(resolve_fn, source, info, args) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphql/execution/executors/sync.py", line 16, in execute return fn(*args, kwargs) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy/fields.py", line 74, in connection_resolver return on_resolve(resolved) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy/fields.py", line 47, in resolve_connection resolved = cls.get_query(model, info, args) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy_filter/connection_field.py", line 32, in get_query query = filter_set.filter(info, query, request_filters) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy_filter/filters.py", line 446, in filter info.context[cls._filter_aliases] = {} File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/werkzeug/local.py", line 351, in setitem self._get_current_object()[key] = value TypeError: 'Request' object does not support item assignment Traceback (most recent call last): File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphql/execution/executor.py", line 450, in resolve_or_error return executor.execute(resolve_fn, source, info, *args) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphql/execution/executors/sync.py", line 16, in execute return fn(args, kwargs) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy/fields.py", line 74, in connection_resolver return on_resolve(resolved) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy/fields.py", line 47, in resolve_connection resolved = cls.get_query(model, info, **args) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy_filter/connection_field.py", line 32, in get_query query = filter_set.filter(info, query, request_filters) File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/graphene_sqlalchemy_filter/filters.py", line 446, in filter info.context[cls._filter_aliases] = {} File "/home/datas/predictions-api/venv/lib/python3.6/site-packages/werkzeug/local.py", line 351, in setitem self._get_current_object()[key] = value graphql.error.located_error.GraphQLLocatedError: 'Request' object does not support item assignment

query { allPreds (filters:{shopId: 134}) { edges { node { id } } } }

art1415926535 commented 5 years ago

Hi, I think it's mistake of Flask-GraphQL module whats has strange graphene context. It's request object (why? 🙄). Main guide says that the context is of type dict. Also aiohttp-graphql has the correct context type.

I fixed that in a new version in any case.

cargan commented 5 years ago

Thanks, that was quick!