How to use parameterization in Big Query using EXTERNAL_QUERY()?

26 views Asked by At

I’m trying to use parameterization in Big Query using the EXTERNAL_QUERY() function. I understand that EXTERNAL_QUERY() is used to query an external data source, but I’m not sure how to use it with parameters.

I have tried this method in the below link but they don't work I am hoping that this problem has been resolved:

https://stackoverflow.com/a/61294646/5221944

SELECT a.symbol, a.timestamp, a.close 
FROM EXTERNAL_QUERY("my-connection", "SELECT symbol, timestamp, close FROM my_table WHERE symbol = @symbol AND timestamp >= @start_date AND timestamp <= @end_date") a

CREATE OR REPLACE PROCEDURE dataset.my_procedure(param1 STRING)
BEGIN
    SELECT * FROM EXTERNAL_QUERY("my-external-connection", """
      SELECT * FROM external_table WHERE column1=:param1
    """) as external;
END;```
0

There are 0 answers