我在pythonsdk中使用googleclouddataflow。在
我想:
我怎样才能拿到那张单子?在以下组合转换之后,我创建了一个ListPCollectionView对象,但无法迭代该对象:
class ToUniqueList(beam.CombineFn):
def create_accumulator(self):
return []
def add_input(self, accumulator, element):
if element not in accumulator:
accumulator.append(element)
return accumulator
def merge_accumulators(self, accumulators):
return list(set(accumulators))
def extract_output(self, accumulator):
return accumulator
def get_list_of_dates(pcoll):
return (pcoll
| 'get the list of dates' >> beam.CombineGlobally(ToUniqueList()))
我做错了吗?最好的办法是什么?在
谢谢。在
直接获取
PCollection
的内容是不可能的——apachebeam或数据流管道更像是一个关于应该进行什么处理的查询计划,PCollection
是计划中的逻辑中间节点,而不是包含数据。主程序汇编计划(管道)并启动它。在但是,最终您将尝试将数据写入按日期分片的BigQuery表。此用例目前仅支持in the Java SDK,并且仅支持流式管道。在
对于根据数据向多个目的地写入数据的更一般的处理方法,请遵循BEAM-92。在
另请参见Creating/Writing to Parititoned BigQuery table via Google Cloud Dataflow
相关问题 更多 >
编程相关推荐