1

I need to pass column names as parameters in standard SQL Bigquery so that I do not need to hard code the column names. How can I do that? I need to do something like :

@column_name = "Origin";
SELECT @column_name FROM table

1 Answers1

0

As of April 2015, the answer seems to be:

There are no 'variables' to be set in BigQuery, but you could add a feature request.

From the same thread, it seems you can use Datalab to use Python variables with BigQuery.

Also, see this thread about using SQL API.

Community
  • 1
  • 1
David Andrei Ned
  • 799
  • 1
  • 11
  • 28
  • As of Dec 2016, bigquery standard SQL supports parameterized queries: https://cloud.google.com/bigquery/docs/release-notes#December_22_2016 – xibalba1 Apr 21 '20 at 15:37