Reputation: 313
Job declaration:
job, err := bqClient.Jobs.Insert(_PROJECT_ID_, &bigquery.Job{
Configuration: &bigquery.JobConfiguration{
Query: &bigquery.JobConfigurationQuery{
UseLegacySql: false,
CreateDisposition: "CREATE_IF_NEEDED",
Query: reportQuery.query,
WriteDisposition: "WRITE_TRUNCATE",
SchemaUpdateOptions: []string{"ALLOW_FIELD_RELAXATION", "ALLOW_FIELD_ADDITION"},
DestinationTable: &bigquery.TableReference{
ProjectId: _PROJECT_ID_,
DatasetId: dataset,
TableId: "name$" + reportQuery.tableDecorator,
},
},
},
}).Do()
The job finishes with error
2017/07/19 11:41:27 ERROR: Encountered " "WITH" "WITH "" at line 1, column 1. Was expecting: <EOF>
[Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)]
The query starts with several WITH ... AS (...)
.
What can I do?
Upvotes: 0
Views: 1245
Reputation: 313
As stated here Use standard SQL queries in java bigquery API
A workaround is to put #standardSQL
on top of the query
Upvotes: 0