I'm trying to call external_query with dynamically created query string in BigQuery Web UI.
DECLARE extquery STRING;
SET extquery = "SELECT * FROM mytable;";
SELECT * FROM EXTERNAL_QUERY("my-external-conn", extquery);
This script gives an error
Query error: Invalid table-valued function EXTERNAL_QUERY
Connection argument in EXTERNAL_QUERY must be a literal string or query parameter
Is it impossible to do in BigQuery? What is the right way to pass query as a parameter?