hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.17k stars 2.76k forks source link

Event trigger on a view #4842

Open jcable opened 4 years ago

jcable commented 4 years ago

Event triggers are created on tables. If I use SQL to create a view I can use that anywhere in a GraphQL query where a table could be used but Views don't appear in the pick list when creating triggers.

I wanted to use a view to enforce a security boundary where my GraphQL client can push data into a table in a write only mode which triggers a webhook which augments the data forwarded to an external system from another table which the client doesn't have access to. View based triggers would handle this nicely.

13banda commented 3 years ago

+1

hoseyneil commented 3 years ago

View based event triggers would be absolutely amazing. We are just about to embark on putting a layer in front of Hasura to do just this, but I believe Hasura doing this adds a hell of a lot of value

vxm5091 commented 2 years ago

+1 for this feature, as the data we currently need to pass into the serverless function called by the trigger is spread out across 3 tables, and a view would allow us to easily organize exactly the data we need to be included in the payload.

gauravverma commented 2 years ago

+1

Relaxe111 commented 2 years ago

+1

valstu commented 2 years ago

Any updates to this?

jozef-slezak commented 2 years ago

+1

gouravd commented 1 year ago

Is this implemented? I can see Views can be selected in Events setup

ethagnawl commented 1 year ago

Does anyone know if there's a chance this will ever land? Alternatively, are there any common/documented workarounds, along the lines of what @hoseyneil had outlined above?

Shalashtein commented 1 year ago

A big chunk of Hasura users, are using the event triggers as a simple queueing system, so we'd be dropping a lot of accessory tools if we can just have 2 changes to the event triggers. First we need some way to setup filters on the table triggering the event (which is probably why people want event triggers on views) and the ability to attach relationship data alongside the event payload.

Use case example: You have a table of product orders with a status column that might have one of 3 values, pending, success, and failed. You want to trigger different communication flows with the customer based on the status of the order. Rightnow, we'd need to setup an event trigger on the orders table, that hits some endpoint that then pulls all the relationship data, and forwards the event to one of the three endpoints that handle the different states.

chrisfurlong-aiwyn commented 10 months ago

Any update on this? This would be extremely valuable, as would enabling the enrichment of event payloads with relationships