Comments (9)
Hey Matt, good to see that you've familiarized yourself with the Relay spec 😊 I agree that it is confusing at first, but once you've got the intuition, it makes a lot more sense-
However, I think you've got a point with your statements. Sometimes you don't need all the pagination info but just want to get the benefits of a connection (e.g. filtering or other constraints), but don't need the edges. Currently prototyping an optional nodes
field on the connections:
{
pets {
nodes {
name
}
}
}
This way you can get rid of the additional nesting layer in cases where you really don't need it. Please LMK if you're interested in that, so I can tag you for PR review once it's ready in a few weeks. 🙂
If you have some specific points of that could be improved on the graphene-sqlalchemy docs, I'd appreciate any PRs bringing improvements.
Cheers
from graphene-sqlalchemy.
from graphene-sqlalchemy.
Relay wants it:
https://relay.dev/graphql/connections.htm
To conform with pagination best practices:
https://graphql.org/learn/pagination/
from graphene-sqlalchemy.
Re-opening because I'd like to know how to turn off pagination, if it's possible. The edge-node syntax makes sense to me for relationships, but I would like to turn it off for basic queries, like getting all product prices.
Instead of this:
{
"data": {
"allProducts": {
"edges": [
{
"node": {
"price": 39.99
}
},
{
"node": {
"price": 49.95
}
}
]
}
}
}
Would prefer:
{
"data": {
"allProducts": [
{
"price": 39.99
},
{
"price": 49.95
}
]
}
}
from graphene-sqlalchemy.
Okay, I am learning. This is a feature of Relay.
Here's the mental model that Relay wants:
And here's how they implement it in GraphQL (which doesn't allow properties on edges):
https://relay.dev/docs/tutorial/connections-pagination/
from graphene-sqlalchemy.
This diagram clicks even more with the graphene-sqlalchemy behavior I'm seeing:
from graphene-sqlalchemy.
Hi @erikwrede, thank you for replying. Yes, please tag me in the PR.
from graphene-sqlalchemy.
Hi @MattKleinsmith, the first PR is here: graphql-python/graphene#1499
Another PR will be necessary to add native support in graphene-sqlalchemy
, but this change enables us to work with the native graphene-relay Connections
. Please LMK what you think :)
from graphene-sqlalchemy.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.
from graphene-sqlalchemy.
Related Issues (20)
- Remove unused metadata HOT 2
- Enum cannot represent value HOT 5
- Flask example gives ImportError HOT 6
- examples/flask_sqlalchemy: dependency specification needed, due to breaking change in graphql-core ^3 HOT 1
- Expand docs with batching example
- Global ids from objects with composite primary keys are not correctly extracted (again) HOT 3
- Hybrid properties don't work in the presence of future annotations HOT 6
- Prioritize custom type conversion over standard conversions HOT 1
- Relationship isn't working if a model has a property named other than 'id'. HOT 5
- Support for sqlalchemy ^2.0.0 HOT 7
- flask_sqlalchemy example does not run with v3 release HOT 2
- hybrid_property annotations with built-in types defaulting to `ForwardRef` and failing schema compilation HOT 2
- Default sort HOT 1
- ORMField batching results in null result HOT 1
- filter: Guys, did you forgot on DateTimeFilter? HOT 1
- Requiring graphene_type for custom filters as well as type hints HOT 1
- Allow a custom filter class with the purpose of using all the base filters, and adding sqlalchemy-filter esk filters
- A way to add custom filters not specific to fields
- Conversion of BigInteger primary keys to ID
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphene-sqlalchemy.