【发布时间】:2017-06-09 20:06:58
【问题描述】:
我可以使用 Java API 创建视图,但查询需要是旧版 sql:
public void createView(String dataSet, String viewName, String query) throws Exception {
Table content = new Table();
TableReference tableReference = new TableReference();
tableReference.setTableId(viewName);
tableReference.setDatasetId(dataSet);
tableReference.setProjectId(projectId);
content.setTableReference(tableReference);
ViewDefinition view = new ViewDefinition();
view.setQuery(query);
content.setView(view);
LOG.debug("View to create: " + content);
try {
if (tableExists(dataSet, viewName)) {
bigquery.tables().delete(projectId, dataSet, viewName).execute();
}
} catch (Exception e) {
LOG.error("Could not delete table", e);
}
bigquery.tables().insert(projectId, dataSet, content).setProjectId(projectId).execute();
}
有没有办法使用 API 使用标准 sql 创建 BQ 视图?
【问题讨论】:
-
我在 API 文档中没有看到相关选项。如果您在查询本身的开头使用
#standardSQL会怎样?
标签: google-bigquery