graphql-engine
graphql-engine copied to clipboard
Joining from a database table to an action result and/or expanded filtering/aggregated when joining via action relationship
Currently, we can only link actions to database entities via action relationships. However, this functionality is extremely limited. There is no ability to filter out results or iterate. It would also be nice to be able to join from a table to an action result so you can get a superset of the table entity against the action dataset when the action is of type query.
Hello everybody! I have a related use case, where I need to extend the GraphQL schema by joining with the result of a query action.
Suppose the following example:
-
There's a
local_tabletable stored in my Hasura project's primary database with theexternal_table_idcolumn on it, and exposed via graphql. -
I've defined a query action to get data from a third party REST API, defined as follows:
# in actions.yaml actions: - name: external_table definition: kind: "" handler: http://thirdpartyserver permissions: - role: anonymous comment: Get external table -
The output of this actions is:
type ExternalTable { id: Int! # additional information }The column
external_table_idworks as a FK to theExternalTable.idcolumn
In this scenario, I'd like to run the following query:
query MyQuery {
local_table {
id
external_table_id
external_table {
id
# the rest of the available fields
}
}
}
Would this be possible to implement?
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 issues from ground up.
We are pleased to announce that we have launched V3-Alpha of Hasura (Data Delivery Network). It is quite possible that the data-connector centric approach of V3 would obviate the need for specific support for actions and relationships between them and other entities.
Do let us know if more is needed to address what you want to achieve with your API.