简体   繁体   English

Apache Beam和BigQuery

[英]Apache beam and BigQuery

I'm trying to execute apache beam sdk 2.4 and the libraries com.google.cloud.bigquery but thow exception 我正在尝试执行Apache Beam sdk 2.4和库com.google.cloud.bigquery但出现异常

Exception in thread main java.lang.NoSuchMethodError com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath(LjavalangString;)LcomgoogleapiclientgoogleapisservicesAbstractGoogleClient$Builder;
at com.google.api.services.bigquery.Bigquery$Builder.setBatchPath(Bigquery.java3519)

import com.google.cloud.bigquery.*;

<dependency>
    <groupId>com.google.cloud.dataflow</groupId>
    <artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
    <version>[2.4.0, 2.99)</version>
</dependency>

<!-- slf4j API frontend binding with JUL backend -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <versi

on>1.7.14</version>
    </dependency>

   <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-jdk14</artifactId>
        <version>1.7.14</version>
    </dependency>

    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-bigquery</artifactId>
        <version>1.35.0</version>
    </dependency>

</dependencies>
 the code example apache beam 2.4 using 
import com.google.api.services.bigquery.model.TableFieldSchema;
import com.google.api.services.bigquery.model.TableRow;
import com.google.api.services.bigquery.model.TableSchema;

If I use the the libraries om.google.api.services.bigquery. 如果使用库om.google.api.services.bigquery。 the code example run successfully . 该代码示例成功运行。

What library is it using internally? 它在内部使用什么库?

What library should I use? 我应该使用哪个库? com.google.api.services.bigquery or com.google.cloud.bigquery? com.google.api.services.bigquery还是com.google.cloud.bigquery?

Beam 2.4 is using com.google.api.services.bigquery v2-rev374-1.22.0. Beam 2.4使用的是com.google.api.services.bigquery v2-rev374-1.22.0。 This is also the library that you should use with Beam 2.4. 这也是应与Beam 2.4一起使用的库。 The com.google.api.services.bigquery library is out of date and there is an open issue to upgrade it. 该com.google.api.services.bigquery库是过时,有一个悬而未决的问题进行升级。 Unfortunately other components in Beam depend on libraries which are incompatible with com.google.cloud.bigquery, and those need to be upgraded before the new library can be used. 不幸的是,Beam中的其他组件取决于与com.google.cloud.bigquery不兼容的库,在使用新库之前需要对其进行升级。

If you aren't already doing so, you should take a look at the BigQuery IO , which provides a wrapper to common BigQuery operations for Beam. 如果您尚未这样做,则应该看看BigQuery IO ,它为Beam的常见BigQuery操作提供了包装。

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

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