art1415926535 / graphene-sqlalchemy-filter

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

How to use async resolver for filter? #23

Open Baddhizm opened 4 years ago

Baddhizm commented 4 years ago

For example

class UserFilter(FilterSet):
    is_cool = graphene.Boolean()

    @classmethod
    async def is_cool_filter(cls, info, query, value):
        returned_list= await async_func()

        if value:
            filter_ = query.id.in_(returned_list)
        else:
            filter_ = query.id.in_(None)

        return query, filter_
art1415926535 commented 4 years ago

This cannot be done now. But it will be a nice improvement! 👍

Now I don't have time for this task. Maybe someone can do PR...