I am trying to export bigquery data to google cloud storage bucket via the API. I adapted a code snippet from here https://cloud.google.com/bigquery/docs/exporting-data
Job job = table.extract(format, gcsUrl);
// Wait for the job to complete
try {
Job completedJob = job.waitFor(WaitForOption.checkEvery(1,
TimeUnit.SECONDS),
WaitForOption.timeout(3, TimeUnit.MINUTES));
if (completedJob != null && completedJob.getStatus().getError() == null) {
// Job completed successfully
} else {
// Handle error case
System.out.println(completedJob.getStatus().getError());
}
} catch (InterruptedException | TimeoutException e) {
// Handle interrupted wait
}
I have exchanged format with "JSON" since my data is nested and can't be exported to CSV and the gcsUrl with "gs://mybucket/export_*.json". But the error messages tells me the following problem:
transfer not working BigQueryError{reason=invalid, location=null, message=Operation cannot be performed on a nested schema. Field: totals}
Any advice what to do? JSON should be able to handle a nested format...