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
1
vote
1 answer

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 of Question.id. Example: # 6,000 Question.id's for…
1
vote
1 answer

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 a string): book(id: "Qm9vazow") { id …
Phil
  • 3,342
  • 5
  • 28
  • 50
1
vote
0 answers

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{ featureVectors(featureSize: 128){ #I want to query on this …
Kevin Vasko
  • 1,561
  • 3
  • 22
  • 45
1
vote
0 answers

How to dynamic switch sqlalchemy model through graphene relay?

In our system, we have two similar(but not same) databases. So I built these sqlalchemy models: # base.py Base = declarative_base() class T1(Base): __tablename__ = 't1' id = Column(Integer, primary_key=True) name = Column(String) #…
Yang HG
  • 710
  • 3
  • 18
0
votes
0 answers

Filter Graphene using Custom type SQLAlchemy

i want to retrieve Departments and its Employee, with filter on both table something like this SELECT d.name, e.name FROM departments d JOIN employee e on d.id = e.department_id WHERE d.name = "Finance" and e.name like '%m%' here's my graphql…
hphp
  • 2,142
  • 2
  • 13
  • 26
0
votes
1 answer

how to filter join query with Flask and SQLAlchemy

Hello I'm trying to query something like this in SQLAlcehmy, Flask and Graphene select d."name", e."name" from departments d join employees e on e.department_id = d.id where e."name" like '%M%' and d."name" = 'IT' so, it would return all…
hphp
  • 2,142
  • 2
  • 13
  • 26
0
votes
0 answers

SQLAlchemyObjectType.Meta two models graphene

I am trying to combine two SQLAlchemyConnectionField. The current error i face is graphql.error.base.GraphQLError: Expected value of type "PostsObject" but got: Tag My current connections are defined like so posts =…
0
votes
1 answer

How to return custom child object that does not have a SQLAlchemy type

I have objects of type Foo and Bar, each Bar object has a field category (specified by a name string) and a parent id linking it to an object of type Foo ... I wish to have a GQL schema which can be queried as follows: { foo { category { …
user491880
  • 4,709
  • 4
  • 28
  • 49
0
votes
1 answer

Column_property / hybrid_property for union a list

The situation is as follows. I have a table with two lists includes relationships to another table. A Child entry can have one or two parents (mostly two ;). A parent distinguishes his children per family. This structure is fixed. Now I want have a…
SmnHgr
  • 57
  • 1
  • 4
0
votes
0 answers

How to eliminate quotes on integers in JSON from GraphiQL/Flask/Graphene/SQLAlchemy/PostgreSQL

The following JSON has quotes around the integers, and I need these gone (observe the rRegionkey): { "data": { "regionsAll": { "edges": [ { "node": { "rComment": "hs use ironic, even requests. s", …
James Madison
  • 845
  • 1
  • 7
  • 18
0
votes
1 answer

How to set NonNull to node and edges in connection class?

I'd like to add NonNull to node and edges in connection. class TestSchema(SQLAlchemyObjectType): class Meta: model = Test interfaces = (relay.Node,) id = graphene.ID(required=True) when I looked at document explorer in…
Eric Lee
  • 700
  • 2
  • 9
  • 30
0
votes
1 answer

Graphene: How to add a function before query execute?

Is there a way to execute a function before all query? When I add an annotation above Query class, It makes an error AssertionError: Type is not a valid ObjectType. def my_func(f): @wraps(f) def…
Eric Lee
  • 700
  • 2
  • 9
  • 30
0
votes
1 answer

Graphene and SQLAlchemy: derivate from a base object type

I am building an app using Flask, Graphene, SQLAlchemy and Graphene-SQLAlchemy in which I implemented the following models: class User(db.Model): __tablename__ = "user" id = Column(Integer, primary_key=True) name = Column(Text,…
0
votes
1 answer

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 Query(graphene.ObjectType): """Query objects for GraphQL API.""" …
Art
  • 119
  • 1
  • 6
0
votes
2 answers

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 :- my resolved function def resolve_freelancers(self,…
Dhaval Chheda
  • 4,637
  • 5
  • 24
  • 44