BigQuery 的 table 装饰器在 Cloud Dataflow 中的等价物是什么?
What is the Cloud Dataflow equivalent of BigQuery's table decorators?
我们在 BigQuery 中有一个很大的 table 数据正在流入其中。每天晚上,我们希望 运行 Cloud Dataflow 管道处理过去 24 小时的数据。
在 BigQuery 中,可以使用“Table Decorator”并指定我们想要的范围(即 24 小时)来执行此操作。
当从 BQ 读取时,Dataflow 是否可以实现相同的功能 table?
我们已经查看了 Dataflow 的“Windows”文档,但我们不太确定这是否是我们需要的。到目前为止我们想出了这个(我们想要使用 FixedWindows
的最后 24 小时数据),但它仍然试图读取整个 table:
pipeline.apply(BigQueryIO.Read
.named("events-read-from-BQ")
.from("projectid:datasetid.events"))
.apply(Window.<TableRow>into(FixedWindows.of(Duration.standardHours(24))))
.apply(ParDo.of(denormalizationParDo)
.named("events-denormalize")
.withSideInputs(getSideInputs()))
.apply(BigQueryIO.Write
.named("events-write-to-BQ")
.to("projectid:datasetid.events")
.withSchema(getBigQueryTableSchema())
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE) .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED));
我们走在正确的轨道上吗?
感谢您的提问。
此时,BigQueryIO.Read 需要 table 格式的 "project:dataset:table" 信息,因此指定装饰器将不起作用。
在对此提供支持之前,您可以尝试以下方法:
- 运行 一个批处理阶段,提取整个 bigquery 并过滤掉不需要的数据并处理该数据。如果 table 真的很大,如果读取的数据量明显小于数据总量,您可能希望将数据分叉到单独的 table 中。
- 使用流数据流。例如,您可以将数据发布到 Pubsub,并创建一个 24 小时 window 的流式管道。流式管道连续运行,但提供滑动 windows 与每日 windows.
希望对您有所帮助
我们在 BigQuery 中有一个很大的 table 数据正在流入其中。每天晚上,我们希望 运行 Cloud Dataflow 管道处理过去 24 小时的数据。
在 BigQuery 中,可以使用“Table Decorator”并指定我们想要的范围(即 24 小时)来执行此操作。
当从 BQ 读取时,Dataflow 是否可以实现相同的功能 table?
我们已经查看了 Dataflow 的“Windows”文档,但我们不太确定这是否是我们需要的。到目前为止我们想出了这个(我们想要使用 FixedWindows
的最后 24 小时数据),但它仍然试图读取整个 table:
pipeline.apply(BigQueryIO.Read
.named("events-read-from-BQ")
.from("projectid:datasetid.events"))
.apply(Window.<TableRow>into(FixedWindows.of(Duration.standardHours(24))))
.apply(ParDo.of(denormalizationParDo)
.named("events-denormalize")
.withSideInputs(getSideInputs()))
.apply(BigQueryIO.Write
.named("events-write-to-BQ")
.to("projectid:datasetid.events")
.withSchema(getBigQueryTableSchema())
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE) .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED));
我们走在正确的轨道上吗?
感谢您的提问。
此时,BigQueryIO.Read 需要 table 格式的 "project:dataset:table" 信息,因此指定装饰器将不起作用。
在对此提供支持之前,您可以尝试以下方法:
- 运行 一个批处理阶段,提取整个 bigquery 并过滤掉不需要的数据并处理该数据。如果 table 真的很大,如果读取的数据量明显小于数据总量,您可能希望将数据分叉到单独的 table 中。
- 使用流数据流。例如,您可以将数据发布到 Pubsub,并创建一个 24 小时 window 的流式管道。流式管道连续运行,但提供滑动 windows 与每日 windows.
希望对您有所帮助