How to use the graphene-sqlalchemy.graphene_sqlalchemy.utils.get_query function in graphene-sqlalchemy

To help you get started, we’ve selected a few graphene-sqlalchemy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql-python / graphene / graphene-sqlalchemy / graphene_sqlalchemy / types.py View on Github external
def get_node(cls, id, context, info):
        try:
            model = cls._meta.model
            query = get_query(model, context)
            return query.get(id)
        except NoResultFound:
            return None
github graphql-python / graphene / graphene-sqlalchemy / graphene_sqlalchemy / fields.py View on Github external
def connection_resolver(resolver, connection, model, root, args, context, info):
        iterable = resolver(root, args, context, info)
        if iterable is None:
            iterable = get_query(model, context)
        if isinstance(iterable, Query):
            _len = iterable.count()
        else:
            _len = len(iterable)
        return connection_from_list_slice(
            iterable,
            args,
            slice_start=0,
            list_length=_len,
            list_slice_length=_len,
            connection_type=connection,
            pageinfo_type=PageInfo,
            edge_type=connection.Edge,
        )