graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Event trigger on a view

Open jcable opened this issue 5 years ago • 7 comments
trafficstars

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.

jcable avatar May 21 '20 22:05 jcable

+1

13banda avatar Jan 03 '21 04:01 13banda

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

hoseyneil avatar Mar 03 '21 14:03 hoseyneil

+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.

vxm5091 avatar Feb 16 '22 06:02 vxm5091

+1

gauravverma avatar Feb 24 '22 10:02 gauravverma

+1

Relaxe111 avatar Apr 26 '22 06:04 Relaxe111

Any updates to this?

valstu avatar Jun 03 '22 12:06 valstu

+1

jozef-slezak avatar Aug 05 '22 19:08 jozef-slezak

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

gouravd avatar Nov 11 '22 13:11 gouravd

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?

ethagnawl avatar Mar 17 '23 16:03 ethagnawl

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.

Shalashtein avatar Sep 08 '23 07:09 Shalashtein

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

chrisfurlong-aiwyn avatar Dec 13 '23 20:12 chrisfurlong-aiwyn