【发布时间】:2014-06-13 06:09:52
【问题描述】:
我创建了一个连续三列的 csv 文件..在 google bigquery 中创建了一个带有 csv 文件的表的数据集 ....为此我完成了我的 java 代码...但现在我必须添加一个在java代码中动态存在行的新列..?
// Main method for data print.
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) throws IOException, InterruptedException {
// Create a new BigQuery client authorized via OAuth 2.0 protocol
Bigquery bigquery = createAuthorizedClient();
TableRow row = new TableRow();
row.set("Column1", "Sample23");
row.set("Column2", 7);
row.set("Column3", "Sample25");
TableDataInsertAllRequest.Rows rows = new TableDataInsertAllRequest.Rows();
rows.setJson(row);
List rowList = new ArrayList();
rowList.add(rows);
TableDataInsertAllRequest content =
new TableDataInsertAllRequest().setRows(rowList);
TableDataInsertAllResponse response = bigquery.tabledata().insertAll(PROJECT_ID, DATASET_ID, TABLE_ID, content).execute();
System.out.println("Final response = " + response);
}
【问题讨论】:
标签: java google-app-engine google-bigquery