I am a newbie using BigQuery.
I am building a query that I will share with several other people. Each person is responsible for different business units and I want them to be able to easily insert the name of their business units in this query.
I built something like this, and it works fine from what I tested:
DECLARE business_units array<string>;
SET business_units = ["unit_A", "unit_C", "unit_D"];
SELECT *
FROM dataset
WHERE bu_name IN UNNEST(business_units)
Problem
I also want to be able to easily change that query in order to search for all possible business units.
Ideally, I just want to change the "SET" line. I tried different things but none of them seem to work. I believe that I need to use metacharacters or regular expression, but I am not being able to find the right combination. I have already looked into the BigQuery documentation, but I am not being able to understand how to do this.
I have tried things like:
SET business_units = ["."];
SET business_units = ["*"];
SET business_units = ["\."];
SET business_units = ["%%"];
When I use any of these, my result return as empty.
Could someone point me in the right direction, please?