简体   繁体   English

如何在Java BigQuery API中创建视图?

[英]How to create a view in the Java BigQuery API?

使用Google BigQuery的Java客户端库,如何创建视图?

The relevant API call is tables.insert . 相关的API调用是table.insert With the Java API, this is represented by the create method on the BigQuery service object . 对于Java API,这由BigQuery服务对象上的create方法表示。 You first have to create a TableInfo , which encapsulates a ViewDefinition object. 您首先必须创建一个TableInfo ,它封装了一个ViewDefinition对象。 The documentation for setDefinition on TableInfo.Builder says: TableInfo.Builder setDefinition的文档说:

Sets the table definition. 设置表定义。 Use StandardTableDefinition to create simple BigQuery table. 使用StandardTableDefinition创建简单的BigQuery表。 Use ViewDefinition to create a BigQuery view. 使用ViewDefinition创建BigQuery视图。 Use ExternalTableDefinition to create a BigQuery a table backed by external data. 使用ExternalTableDefinition创建BigQuery表,该表由外部数据支持。

Sample code: 样例代码:

bigQuery.create(TableInfo.of(TableId.of("DatasetName", "ViewName"),
        ViewDefinition.of("SELECT this, is, the, view FROM query")))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM