Reputation: 11
SELECT
@run_date,
Country_PG,
SUM(Weighted_Revenue) AS Weighted_Pipe
FROM
`revenue.data`
GROUP BY
1,2
When I run this query I am getting an undeclared query error for @run_date
.
How do I solve this error?
For your information: this is a scheduled query.
Upvotes: 1
Views: 4560
Reputation: 143
When you attempt to test a scheduled query with either the parameter @run_date or @run_time in the UI it will return the error: "Undeclared query parameters"
However, when run as part of a backfill or at the scheduled time it will work correctly.
This is a bit ugly from a UI standpoint, but in order to test the scheduled query you should use the BQ command line as stated in the documentation
Upvotes: 2
Reputation: 5503
When you are running the query manually, it is expected to fail if @run_date
is not defined (by you).
When you are running it as scheduled query, based on documentation @run_date
should be passed in by BigQuery, if you got error telling @run_date
is not defined, create a bug to BigQuery here.
Upvotes: 2