graphql-engine
graphql-engine copied to clipboard
[Relay] support aggregate
I've tried the Relay API, but I can't find a way to aggregate it in the Relay API.
It would be great if xxx_aggregate
was generated in query_root or if a field like total_count
was added in xxx_connection
.
For example:
query MyQuery {
user_aggregate {
aggregate {
count
}
}
}
or
query MyQuery {
user_connection {
+ total_count
edges {
node {
id
name
}
}
}
}
Thank you!
Any solution or update here?
Was also expecting this to be in relay. You can get aggregate relations, but odd that you can't get the actual aggregates of the root tables themselves.
What's weird is that the types for x_aggregate
do seem to be generated, but it doesn't include a distinct_on
or where
parameter, and is also not exposed by default on the query root, so it doesn't seem usable.
Can someone from Hasura comment about whether this is something they intend to support?
As another clarification, it seems that array_relationship
is supported for aggregate purposes, and leads to x
, x_aggregate
, and x_connection
fields all being added ... except at the root query level. I guess this is what the other users up-thread were referring to, but I only just now understood this clarification after digging through the graph that was generated.
any update on this core feature?
Having the same issue. Any updates on weather this will be supported soon?
FWIW, my work around here is to make call to the standard hasura endpoint where the aggregate values are available at the top level. Then Make my relay api queries subsequently.
Anything new? Relay's totalCount is really important, we need to display the number of rows/pages the user can paginate.
i don't think it's the timing to use relay in hasura right now.
I already reverted what I did before (use hasura relay to do the pagination), right now i just use normal hausra schema to do the pagination. And Currently, Hasura’s Relay schema doesn’t expose remote schemas or actions.
So, some complex logic is hard to handle with hasura relay.
@Vbubblery Hasura schema pagination has some serious drawbacks. limit/offset might cause data duplication on high-frequent updated tables, and implementing cursor pagination on an incremental field is too dirty. I don't like it.
any update?
It's unfortunate there's no discussion from the Hasura team in over a year on this. GraphQL + Relay + React is the stack many enterprises large and small are going to be building with.
Any update?
anyone?
Any update on this issue?
I've since migrated off this project/team, but we were required to completely abandon Hasura due to this, as Relay's opinionated schema standard was far more important to us than using Hasura, which had plentiful competitors.
Hopefully a team member sees this and can respond, but I can't recommend the tool at this point in time to anyone.
We also have the same need, it's important for us to return paginated results, and having the total count regardless of the page size is key.
Up. I need this feature as well
I've since migrated off this project/team, but we were required to completely abandon Hasura due to this, as Relay's opinionated schema standard was far more important to us than using Hasura, which had plentiful competitors.
Hopefully a team member sees this and can respond, but I can't recommend the tool at this point in time to anyone.
What tool did you ending up using? I'm also giving up on Hasura based on their poor Relay support.
Sorry, it's been even longer by now so I don't remember at this point in time; but I remember it was just one of the other major competitor libraries, nothing to esoteric.
What is the current recommended way to aggregate at the root table level ?
Thanks everyone for your comments and patience on this issue. We have been closely listening into all the feedback and requests from the community, and have been working on a re-imagined, re-architectured Hasura, that tackles many of these from ground up. We are pleased to announce that we are launching V3-Alpha of Hasura (Data Delivery Network) on our next Community call on Nov 30. Relay is an important focus in V3 and will be a first class citizen. While aggregations will not be available in the Alpha version yet, it's in our near term roadmap. We would request to join this community call to learn more about Hasura V3. We will continue to update this issue as soon we have clear timeline for this support.
Relay is an important focus in V3
The word "relay" doesn't appear even a single time in the v3 docs. I remember being in a community call with Tanmai more than 2 years ago when he stated something very similar e.g. "relay is top of our mind/a first class citizen" and in those 2 years, there have been precisely zero relay features built.
We'd love to see relay features, but to anyone reading this, I wouldn't hold your breath.
@KayakinKoder While more Relay features are underway, you can start using Relay's Global ID and node fields as specified here: https://hasura.io/docs/3.0/data-domain-modeling/global-id/
We will add more docs for Relay in GraphQL section of the docs very soon as well.
@tirumaraiselvan I don't understand how I can utilize Global ID to get aggregate queries like the entire count of the entries.
I'm currently resorting on REST endpoints generated from "vanilla" GraphQL aggregate queries.