I want to upload data from Google Cloud Storage to table in Big Query. There is my code to create job:
Job job = new Job();
JobConfiguration config = new JobConfiguration();
JobConfigurationLoad loadConfig = new JobConfigurationLoad();
List<String> sources = new ArrayList<String>();
sources.add("gs://bucket/file.cvs");
loadConfig.setSourceUris(sources);
TableReference tableRef = new TableReference();
tableRef.setDatasetId("DATASET_ID");
tableRef.setTableId(TABLE_ID);
tableRef.setProjectId(PROJECT_ID);
loadConfig.setDestinationTable(tableRef);
List<TableFieldSchema> fields = FieldsBigQuery.schema();
TableSchema schema = new TableSchema();
schema.setFields(fields);
loadConfig.setSchema(schema);
config.setLoad(loadConfig);
job.setConfiguration(config);
Insert insert = _bigquery.jobs().insert(PROJECT_ID, job);
insert.setProjectId(PROJECT_ID);
JobReference jobRef = insert.execute().getJobReference();
I don't have any errors or exception but it's not upload any data to my table (Table size 0B). I tried to create table without any data and than to upload data to this table but it isn't.
I would appreciate any help,
Thanks very much!