Passing Input to BigQuery in Retool Workflows?

Hello!

As seen above, I have a webhook that when triggered, calls a BigQuery that does a simple select *. I want to instead pass to this query an input variable I send from the webhook. Is that possible?

Hi @rbnsl, welcome to the community! :wave:

Yes, that's possible but you have to make sure they are the same data type when you use it in BigQuery.
i.e. your shift_id is a string column as well in BigQuery otherwise you need to cast it to whichever data type you store shift_id in BQ.

Hi Jocen, thanks! Two more questions:

  1. How do I actually use shift_id in BQ? Like is there some sort of {{shift_id}} type syntax?
  2. I'm doing a simple select * from <view> as seen in the image above, which in turn runs the underlying SQL query that defines the view every time. Is there any way to pass shift_id one level deeper to the underlying SQL query that materializes the view? If so, how would I do that?

Thanks in advance :slight_smile:

@rbnsl, have you built a retool app prior to exploring workflows? referring to those would be similar to any resource you have in the app, i.e. {{startTrigger.data.shift_id}} and you can use this in specifying in your WHERE statement for BQ:

SELECT
  *
FROM your_dataset.your_table t
WHERE t.shift_id = {{startTrigger.data.shift_id}}

This is the basic reference but can get more complex depending on what you're wanting to achieve.

1 Like