Below code worked for Dataflow 1.9 sdk, migrating to 2.X
下面的代码适用于Dataflow 1.9 sdk,迁移到2.X.
PCollection<TableRow> tableRow = ...
tableRow.apply(BigQueryIO.Write()
.to(String.format("%1$s:%2$s.%3$s",projectId, bqDataSet, bqTable))
.withSchema(schema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND));
I get
我明白了
The method apply(PTransform<? super PCollection<TableRow>,OutputT>) in the type PCollection<TableRow> is not applicable for the arguments (BigQueryIO.Write<Object>)
Release notes are not much of a help here and documentation on 2.X is non existant redirects to beam API page.
发行说明在这里没什么帮助,2.X的文档是不存在的重定向到beam API页面。
2 个解决方案
#1
1
Have you tried using BigqueryIO.writeTableRows()?
你尝试过使用BigqueryIO.writeTableRows()吗?
Apache Beam 2.1.0 BigqueryIO documentation https://beam.apache.org/documentation/sdks/javadoc/2.1.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.html
Apache Beam 2.1.0 BigqueryIO文档https://beam.apache.org/documentation/sdks/javadoc/2.1.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.html
#2
0
You can try providing TableRow
type explicitly (BigQuery.<TableRow>write()...
) or use BigQuery.writeTableRows()
as suggested above.
您可以尝试显式提供TableRow类型(BigQuery。
Looks like the interface was made generic in 2.x. Earlier version had TableRow hard coded.
看起来界面在2.x中是通用的。早期的版本有TableRow硬编码。
#1
1
Have you tried using BigqueryIO.writeTableRows()?
你尝试过使用BigqueryIO.writeTableRows()吗?
Apache Beam 2.1.0 BigqueryIO documentation https://beam.apache.org/documentation/sdks/javadoc/2.1.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.html
Apache Beam 2.1.0 BigqueryIO文档https://beam.apache.org/documentation/sdks/javadoc/2.1.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.html
#2
0
You can try providing TableRow
type explicitly (BigQuery.<TableRow>write()...
) or use BigQuery.writeTableRows()
as suggested above.
您可以尝试显式提供TableRow类型(BigQuery。
Looks like the interface was made generic in 2.x. Earlier version had TableRow hard coded.
看起来界面在2.x中是通用的。早期的版本有TableRow硬编码。