https://cloud.google.com/bigquery/docs/creating-partitioned-tables显示了如何在Python中创建分区表.我去过那里,我做到了.
现在的问题是,如何使用Java API做同样的事情?相应的Java代码与Python下面的代码相同:
{
"tableReference": {
"projectId": "myProject",
"tableId": "table1",
"datasetId": "mydataset"
},
"timePartitioning": {
"type": "DAY"
}
}
缺少分区的Java:
Job createTableJob = new Job();
JobConfiguration jobConfiguration = new JobConfiguration();
JobConfigurationLoad loadConfiguration = new JobConfigurationLoad();
createTableJob.setConfiguration(jobConfiguration);
jobConfiguration.setLoad(loadConfiguration);
TableReference tableReference = new TableReference()
.setProjectId("myProject")
.setDatasetId("mydataset")
.setTableId("table1");
loadConfiguration.setDestinationTable(tableReference);
// what should be place here to set DAY timePartitioning?
我正在使用Maven Central Repository中最新的api版本:com.google.apis:google-api-services-bigquery:v2-rev326-1.22.0.