I am constructing "Export Data" statement and submitting it as Query to Bigquery using BigQuery API Services. To specify job configuration, I am using "JobConfigurationQuery". So "Export Data" statement query looks like as below: Ref: EXPORT DATA Statement
EXPORT DATA OPTIONS (
uri = 'gs://aayushj/gCloud_Sample-*.json',
format = 'JSON',
compression=GZIP) AS
SELECT * FROM `api-project-80697026669.MergeFeature.Table_Source_3cols` ORDER BY COL_INT
I am looking for Java API to get the number of files created by "Export Data" Statement. Didn't find any API. Though in case of "Extract Job query" i.e. config of type extract "JobConfigurationExtract", com.google.api.services.bigquery.model.JobStatistics.getExtract() method returns the instance of JobStatistics4 class which do contain method getDestinationUriFileCounts() to determine number of files created.
Snippet of com.google.api.services.bigquery.model.JobStatistics class:
public JobStatistics4 getExtract() {
return extract;
}
Snippet from: com.google.api.services.bigquery.model.JobStatistics4 class:
/**
* [Output-only] Number of files per destination URI or URI pattern specified in the extract
* configuration. These values will be in the same order as the URIs specified in the
* 'destinationUris' field.
* @return value or {@code null} for none
*/
public java.util.List<java.lang.Long> getDestinationUriFileCounts() {
return destinationUriFileCounts;
}
My custom code look like as below:
Job job = bigquery.jobs().insert(billingProjectId, jobRequest).execute();
job.getStatistics().getExtract().getDestinationUriFileCounts()
I was looking for similar kind of API in case of Query Job, which is not available.
job.getStatistics().getQuery().getDestinationUriFileCounts()
Any workaround for this, I can use to determine file names and the number of files created by "EXPORT DATA" statement?.