2 Replies Latest reply on Jul 3, 2018 4:40 PM by desiree.abbott

    How to use a workbook on Tableau Server to cancel a query running on Amazon Redshift

    desiree.abbott

      At my company, we have a Tableau dashboard published to server which shows the queries that are currently running on our Amazon Redshift cluster via a live connection.  We would like to enable an analyst to cancel their own query by clicking on a "cancel" button in the dashboard.

       

      Here's what I know already:

      1. I completely realize that this is unnecessary as they could just run the CANCEL statement in their DBMS but if possible, we want the fun/wow factor of clicking a button.  Plus it's a fun little challenge for me (even if I do need to ask for a little help ).
      2. I have already made it so I show the cancel button on only the queries that are owned by the logged-in user.
      3. I know that it is possible to use one data source to filter a live connection to another data source.
      4. Instead of using a CANCEL statement, which does not return a result set thus does not work in Tableau, you can use select pg_terminate_backend(PID) which does return a result set (a 0 or a 1 in fact).

       

      What I don't know is how to pass a value, specifically the process ID or PID, from one data source to the SELECT statement of another data source.  I'm thinking it would be via a dashboard action but maybe there's a better way?  What would be really really nice is if we could set the value of a parameter by a filter, because then I could put the parameter in the SELECT statement of my live connection, but alas, that's still not possible as far as I'm aware.

       

      Has anyone done anything like this?