我们有用于Apache Beam的Firebase I/O连接器吗



我试着为Firebase寻找Firebase I/O连接器,但找不到。有人能帮我这样做吗,或者有人带着Firebase I/O连接器来读写我的文件,请帮我。

提前感谢。

官方Google文档中有以下有趣的链接,显示了BeamJava的读写示例:

https://cloud.google.com/blog/topics/developers-practitioners/using-firestore-and-apache-beam-data-processing

Pipeline pipeline = Pipeline.create(options);
String collectionGroupId = "collection-group-name";
RpcQosOptions rpcQosOptions = RpcQosOptions.newBuilder()
.withHintMaxNumWorkers(options.as(DataflowPipelineOptions.class)
.getMaxNumWorkers())
.build();
pipeline
.apply(Create.of(collectionGroupId))
.apply(new CreatePartitionQueryRequest(rpcQosOptions.getHintMaxNumWorkers()))
.apply(FirestoreIO.v1().read().partitionQuery().withNameOnlyQuery().build())
.apply(FirestoreIO.v1().read().runQuery().build())
.apply(MapElements.into(TypeDescriptors.strings()).via(
(runQueryResponse) -> runQueryResponse.getDocument().getName())
)
.apply(ParDo.of(new CreateDeleteOperation()))
.apply("shuffle writes", Reshuffle.viaRandomKey())
.apply(
FirestoreIO.v1().write()
.batchWrite()
.withRpcQosOptions(rpcQosOptions)
.build()
);
pipeline.run().waitUntilFinish();

Javadoc:的链接

https://beam.apache.org/releases/javadoc/2.41.0/org/apache/beam/sdk/io/gcp/firestore/FirestoreIO.html

您也可以查看此链接,其中显示了writeFirestoreIO:的示例

使用自动生成的ID 将文档从Beam添加到Firestore

对于Python,我认为Beam上现在没有开源的IO,但您可以在ParDoDoFn中使用Firestore客户端,这里有一个显示示例的链接:

在Google数据流中使用FireStore

访问Apache Beam官方网站

在标题中查找Documentation

在里面你会看到I/O Connectors,点击它:I/O连接器。

在列表中找到Firestore IO,然后阅读它的Javadoc。

或者你可能需要Datastore IO(我想是旧版本(,这是Javadoc。

请注意,您需要选择正在使用的数据库。

最新更新