Questions tagged [flask-graphql]

Items related to the package flask-graphql

Items related to the package flask-graphql at https://github.com/graphql-python/flask-graphql

18 questions
6
votes
1 answer

What is the meta subclass in graphene?

I'm learning how to use GraphQL and python. I've found the graphene project along with it's SQLAlchemy and Flask extensions. I've been reading tutorials and docs and I'm having trouble figuring out what class Meta is used for when defining a schema.…
Paymahn Moghadasian
  • 9,301
  • 13
  • 56
  • 94
5
votes
1 answer

How can I extract data from a list of dicts using graphene's mutation method?

I’m trying to created a list of objects using graphql mutation, but have been unsuccessful. I've identified the error, please see code snippets and comment on where the error is propagating. Note: I'm using Graphene on Flask with Python 2.7 Here’s…
Amir
  • 197
  • 2
  • 17
4
votes
1 answer

Python graphql exception handling: Is it expected to get errors array with 200 OK response?

According to the documentation in https://www.howtographql.com/graphql-python/6-error-handling/ I use raise GraphQLError to show errors in my Flask GraphQL app mutate functions, like this one: import graphene from graphql import GraphQLError from…
3
votes
1 answer

How to do search for a specific set of data by using a filter

I have a tag model and I would like to search for a specific tag with a specific name. Here is what I have so far. from datetime import datetime from graphene_sqlalchemy import SQLAlchemyObjectType,SQLAlchemyConnectionField from database.base import…
Gagan
  • 5,416
  • 13
  • 58
  • 86
2
votes
1 answer

How useful is GraphQLError() provided in Graphene?

The python graphene documentation does not mention anything about graphQL error. Under what scenarios is it useful, does it have any advantage over a simple raise Exception('Authenication Failure : User is not registered') ? I did my homework and…
Shivansh Jagga
  • 1,541
  • 1
  • 15
  • 24
2
votes
0 answers

GraphQL query returns null : flask-graphene

I'm trying to expose spark aggregation results using a graphql api. The query returns null everytime though, from flask import Flask, request from graphene import ObjectType, Schema, String, Int, Field, Float, List from flask_graphql import…
Mister Spurious
  • 271
  • 2
  • 11
2
votes
0 answers

Connect to multiple data sources at once using Flask-GraphiQL

I'm building a GraphQL API that connects to two different databases. I'm trying to create a GraphQL interface using Flask-GraphQL but it appears I can only bind a single SQLAlchemy session to the app at once via the context variable: from flask…
Johnny Metz
  • 5,977
  • 18
  • 82
  • 146
1
vote
1 answer

Flask graphql query with '&' returns 'Syntax Error GraphQL'

I have a very simple flask graphql app and everything work as I aspect, I can call it from my browser and it returns the given data. But if I send a string which contains '&' I always get the message "Syntax Error GraphQL (1:22) Unterminated string…
1
vote
1 answer

mongo model fields not available in query string and GraphiQL query

I am creating a project to query a mongo schema in GraphQL. I have a model which act as a mongo collection and schema file for mapping the model with graphql Query. When i try to query the fields in mongo models only id is getting populated and not…
Kannan K
  • 77
  • 2
  • 12
1
vote
1 answer

Generating GraphQL json document from Flask graphene

I want to generate a GraphQL .json document that has graphene schema from Flask. Django has something like manage.py that does this (https://github.com/graphql-python/graphene-django/blob/master/docs/introspection.rst). Anyone know how to generate a…
mvangala
  • 33
  • 4
1
vote
1 answer

Fetch deep nested documents with GraphQL

What would the best approach to fetch deep nested object with graphql only when asked for. I'm talking here performance wise Lets say you have the following mongo/mongoose schema : User | |_ Name | |_ Friends (RefId into User) | …
Pavel 'PK' Kaminsky
  • 796
  • 1
  • 10
  • 22
0
votes
1 answer

Using Flask with graphene and py2neo: Cannot use variables in Query Class/resolver

for a project I am trying to implement a graphql endpoint via flask in order to query a neo4j-DB using py2neo and graphene. Within a docker container I am using python 3.9 and the follwing packages are…
Martin
  • 1
  • 1
0
votes
1 answer

How to make a json request on a graphql endpoint built with graphene and flask

I have a flask app and I am using graphene to build some graphql endpoints. The following snippet is to build the metadata_by_config query. engine = create_engine('postgres_url', convert_unicode=True) db_session =…
Nik391
  • 517
  • 2
  • 7
  • 24
0
votes
1 answer

How to add filtering by id to my user resolver?

I have schema.py that goes like this: import graphene from app import db from graphene import relay from app.models import User as UserModel, Event as EventModel from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType class…
saki709
  • 145
  • 2
  • 9
0
votes
1 answer

Using same connection with multiple resolvers in graphene

I have a code like this, # SWAMI KARUPPASWAMI THUNNAI import jwt import graphene from flask import request from auth.helper import medease_token from database.get_connection import get_connection from flask_graphql import GraphQLView class…
1
2