Questions tagged [graphene-sqlalchemy]

graphene-sqlalchemy allows user to create GraphQL API using Python/SQLalchemy. Graphene-Python is a library for building GraphQL APIs in Python which provides an extendable API for making developers' lives easier.

graphene-sqlalchemy allows user to create GraphQL API using Python/SQLalchemy. Graphene-Python is a library for building GraphQL APIs in Python which provides an extendable API for making developers' lives easier.

32 questions
4
votes
1 answer

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 "exclude_fields" property but that didn't…
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
0 answers

Share Meta classes between two SQLAlchemyObjectType

I'm using graphene_sqlalchemy package in my Flask app (https://github.com/graphql-python/graphene-sqlalchemy) and I need to make two queries using the same Model. I was wondering if is possible two types share the same model as bellow: class…
3
votes
1 answer

Generic Create Model Mutation for Graphene

I'm trying to create some kind of a generic create mutation in graphene for a flask application. In order to create a mutation, the syntax would normally be as follows: class CreateMutation(graphene.Mutation): class Arguments: …
fness
  • 89
  • 5
2
votes
0 answers

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 retrieve the data based on the query from graphQL, and…
jason
  • 562
  • 8
  • 24
2
votes
0 answers

Sqlalchemy graphene deeply nested schemas

i.m new to graphene I'm triyng to recieve information from 3 models: two models connect (User and Classes) has many-to-many relationships, one model (Lessons) connect as many-to-one with Classes model. my goal is to have possibility to show…
Dmitriy_kzn
  • 518
  • 4
  • 16
2
votes
1 answer

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 multiple posts. In order to attain this use case, I…
Gagan
  • 5,416
  • 13
  • 58
  • 86
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
2
votes
2 answers

Graphene_sqlalchemy and flask-sqlalchemy disagree on what constitutes a Valid SQLAlchemy Model?

Playing with Flask, Graphene and am running into a problem. Consider the following. The Model project.model.site: from project import db from project.models import user from datetime import datetime class Site(db.Model): __tablename__ =…
1
vote
1 answer

Mocking SQLAlchemy test within Strawberry/FastAPI

I'm working on creating unit tests for a FastAPI, Strawberry, and SQLAlchemy setup. The current API is working and returning data correctly, but I cannot figure out how to mock the underlying database for unit tests. Would love any help/guidance to…
sokeefe
  • 627
  • 12
  • 33
1
vote
1 answer

Graphene: customizing how Enum is serialized

Our backend uses SQLAlchemy as our ORM, and I've recently been playing around with exposing a graphql API, but am having a hard time figuring out how to customize how Enum is serialized by graphene. Our SqlAlchemy objects all inherit from a…
1
vote
1 answer

SQLAlchemy query renders .filter() as "WHERE false"

My issues comes down to the following code runned with Python3.8 and SQLAlchemy1.3: subquery = ( session.query( Article.id, SubscriberArticle.subscriber_id, SubscriberArticle.data, SubscriberArticle.is_activated, …
1
vote
1 answer

Add value to existing graphene.Enum

Is there a way to add a value to an existing graphene.Enum? I want to use graphene-sqlalchemy sort_enum() functionality and to add additional functionality of my own - TOTAL_COUNT_ASC and TOTAL_COUNT_DESC that will enable sorting by total count, but…
yeger
  • 351
  • 2
  • 15
1
vote
1 answer

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 simplify, lets consider I'm computing f(x)=ax+b where…
cglacet
  • 8,873
  • 4
  • 45
  • 60
1
vote
0 answers

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 backend in python. The purpose is that this graphql…
Ram
  • 159
  • 1
  • 10
1
2 3