Filter by id in graphene-sqlalchemy query

How can you setup graphene-sqlalchemy to filter an object by id? I'd like to run the query: { marker(markerId: 1) { markerId title } } I would expect to get a single Marker object...

Auto-generating a graphql schema for relay (Graphene server)

I am new to Relay and am trying to put together my first app. I already have a GraphQL server (using Graphene) that is backed by a PostgreSQL DB via SQLAlchemy automap, and published as a Flask...

Get global Id of record when executing a mutation with Graphene

I am building a GraphQL API using the python packages Flask, SQLAlchemy, Graphene and Graphene-SQLAlchemy. I have followed the SQLAlchemy + Flask Tutorial. I am able to execute mutations to create...

Generate Graphene Mutation Inputs from SQLAlchemy Class Attributes

I currently have the following mutation defined for my project: My class PlanetAttribute is used to define Graphene Fields used as inputs of my mutations class PlanetAttribute: name =...

GraphQL circular queries with one to many relationships

I'm learning GraphQL by building a simple python application, basically runs nmap scans stores output to a database, and can be queried by a GraphQL API. I seem to be a bit confused on how GraphQL...

Error: gunicorn: Failed to find application object 'app' in 'app'

Here's my code: app.py from flask_graphql import GraphQLView from app.infrastructure.graphql import schema from app.infrastructure.api_resource import app app.add_url_rule('/graphql',...

How do you write a resolver that returns a SQLAlchemy as a relay connection?

I would like to return a relay connection for queries. Using standard graphene-sqlalchemy you can do this: class Query(graphene.ObjectType): node = relay.Node.Field() all_users =...

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...

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...

Select requested-only fields from DB with GraphQL and Graphene-Python

I'm building a Python Flask-GraphQL API using Graphene and was wandering if there are any common solutions to requesting only required fields from DB in resolvers. Let's say there's a request of...

AssertionError: Found different types with the same name in the schema

I have two classes: Products and SalableProducts in my models (SalableProducts inherits from Products so it has every field of it's database). Here is my schema down below I tried including the...

How can I query with a field parameter on a subrelation in Graphene-SQLAlchemy

I am trying to figure out how I can accept a parameter and query on that field in a sub table in a GraphQL. This is an example. query{ allModels{ edges{ node{ ...

Graphene/GraphQL find specific column value

For some reason, I can't figure out how to simply find a specific piece of data in my SQLAlchemy database. In the graphene-python documentation it simply does this query to match the id (which is...

SQLAlchemy / Flask - Get number of rows in relationship table

Here's my scenario. I have a table of Books each book has a table of Questions and each question has a table of Answers. What I want to do is efficiently get the amount of answers for a given list...

How to insert many to many record data?

Please consider the following use case. There is a Post model as well as a Tag model. Both of them have a many-to-many relationship between them. A post can have multiple tags while a tag can have...

can I write custom sql with graphene-sqlalchemy?

Can we write custom sql with graphene-sqlalchemy to retrieve data? My output is not present in a database table directly but is built using 'CTEs'. Background: I'm trying to build a graphql...

How to understand null edges and nodes in GraphQL

The good practice for relations in GraphQL is using the connection model with edge and node elements. The recommendation is also for both edge and node to be nullable. This is how e.g....

Graphene/Flask/SQLAlchemy - What is the recommended method to retrieve data from a route entry point?

Given a basic project structure as follows: / app.py <-- Flask app startup and basic routing models.py schema.py <-- Contains Graphene/SQLAlchemy schema definitions for...

Flask / SqlAlchemy / Graphene - how to query an object from DB and change value?

I wish to open a GraphQL mutation endpoint where an id and string is sent in. This would then gather the item based on the ID and change a value in the object, and save the change in the item in...

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...

Undefined symbol when importing tf-sentencepiece

On my MacBook (version 10.14.6) I am succesfully running a Django application including TensorFlow and tf-sentencepiece (in particular to use the universal sentence encoder model). When I perform...

float() argument must be a string or a number, not 'Float'

I know this question has been asked before but none of the questions were helpful hence asking again.. I am using graphene and parsing some Elasticsearch data before passing it to Graphene PFB :-...

Pipenv ignore Python version

I am attempting to use Pipenv on macOS (10.15.3) however I am experiencing issues. Specifically, I am declaring it uses Python 3.6 but I can not lock the Pipfile. The exact same code works fine on...

ModuleNotFoundError: No module named 'flask' when trying to up docker

I'm using docker for the first time to mount my project and I'm having a problem: project | Traceback (most recent call last): project | File "app.py", line 2, in <module> project | ...

How do I return distinct values with graphene_sqlalchemy?

I'm trying to return distinct values from a GraphQL query. from graphene_sqlalchemy import SQLAlchemyConnectionField import graphene from database.model import MyModel class...

Why don't SQLAlchemy show up in the search results of `pip3 search SQLAlchemy`?

I wanted to install SQLAlchemy for Python 3 for working with databases. I searched for the package using pip3 search SQLAlchemy, but I didn't find SQLAlchemy as part of the results. Why don't...

Order by query output column

I'm using graphene with sqlalchemy and I have an output object that contains a computed field. The field is computed according to some input (query) parameter and more or less look like this (to...

Failing to start FastAPI server, error in asyncpg

EDIT: turns out there was quite a few different errors. If you run into similar problems, you probably misconfigured something in your database - like exposing wrong port somewhere along the...

SQLAlchemy / Graphene - How to group or manipulate the queryset

I am currently using graphene-sqlalchemy-filter, which is a package built to integrate SQLAlchemy and Graphene. However, I am currently facing some issues with using it. I want to be able to...

How to use graphene dataloader on connections and how to select only necessary fields

I would like to use some non-standard database with python graphene to create a GraphQL endpoint. This database doesn't have existing SQLAlchemy dialect, is not supported by Django ORM etc., so...