graphql-engine
graphql-engine copied to clipboard
Allow sorting by computed fields
It would be so great if Hasura supports computed field in order by Eg:
{
show(order_by: {
show_distance(args: {lat: 77.7843636, long: 9.4664509}): asc
}) {
...ShowDetails
}
}
Function created for Computed field show_distance
ST_Distance(
ST_Transform(location::Geometry, 3857),
ST_Transform(ST_SetSRID(ST_MakePoint(lat, long), 4326), 3857)
)
Related to https://github.com/hasura/graphql-engine/issues/3772
@tirumaraiselvan Hi Selvan, We're waiting for this feature for a long time. May I know, when developers can access this feature.
Sorting based on distance is one of the main functionality in our app. So, I would like to see the ticket with a closed tag.
@vivekkannavenus Hi. Unfortunately, the ETA for this is still not clear at the moment because of backlog. I can probably suggest workarounds using Views/Custom functions if you can share your schema and computed field definitions.
Our team would really appreciate this! Our use case is sorting content by a computed score column and filtering results by followed sources. Serving this content feed is the main functionality of our product, so first class support for ordering by computed fields would be great.
would very much appreciate this being implemented!
+1 Would be amazing to have this.
@tirumaraiselvan Any update on this? Would be really helpful to reduce extra views and functions.
Much needed..
Hi, any updates?
+1, any updates on the feature?
For anyone interested, a viable workaround seems to be creating a view with all of the original table's columns plus the desired calculated field
.
Is there any chance this gets bumped from "p/longterm" to something closer to a more immediate development/release?
+1, Any update on this feature?
+1 - any updates on this feature?
any updates on sorting by computed_field with args? It's been a while now
@mikejackowski this feature request is not currently scheduled. I believe it's also not strictly necessary, since it is possible to sort the results of tracked custom functions, even if it's not currently possible to sort by computed fields. This is illustrated in this GitHub repository and sub-directory:
https://github.com/dventimihasura/hasura-projects/tree/master/computed-fields-1