Closed
Description
My understanding is that pagination and limiting should be enabled by using the SQLAlchemyConnectionField
on a Connection
type.
Running a query such as,
{
facts(first: 1) {
edges {
node {
id
appid
pageid
}
cursor
}
pageInfo {
endCursor
hasNextPage
}
}
}
yields a SQL query without LIMIT %s, %s
in the SELECT
statement which is suggested to be the case in #27. Specifically, the generated query is,
SELECT count(*) AS count_1
FROM (SELECT "TABLE".id AS "TABLE_id", "TABLE".appid AS "TABLE_appid", "TABLE".pageid AS "TABLE_pageid"
FROM "TABLE" ORDER BY "TABLE".id ASC) AS anon_1
My schema is pretty straight forward,
from graphene import Connection, ObjectType, Schema, relay
from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType
from models.generated.fact import Fact as FactModel
class Fact(SQLAlchemyObjectType):
class Meta:
model = FactModel
interfaces = (relay.Node,)
class FactConnection(Connection):
class Meta:
node = Fact
class Query(ObjectType):
node = relay.Node.Field()
facts = SQLAlchemyConnectionField(FactConnection)
schema = Schema(query=Query)
and my model (while generated) is,
class Fact(Base):
__tablename__ = "TABLE"
id = Column(Integer, primary_key=True)
appid = Column(Integer)
pageid = Column(String)
Am I missing a step or is this possibly a bug? I am using graphene-sqlalchemy 2.1.0.
Metadata
Metadata
Assignees
Labels
No labels