![](/img/trans.png)
[英]Deploy Spring cloud data flow on Google compute engine with data flow scheduling feature, and without using K8s or Cloud Foundry
[英]Google cloud data flow exmaple
我試圖使用以下鏈接將多個 csv 文件從雲存儲插入到大查詢中,但出現錯誤“ attributeerror: 'filecoder' object has no attribute 'to_type_hint' ”。 有人可以幫我嗎
看起來 FileCoder 錯誤地沒有從beam.coders.Coder
繼承; 我懷疑修復此問題將使問題 go 消失。
無論如何,這里實際上最好使用 DoFn 而不是 Coder,例如
class CsvLineDecoder(beam.DoFn):
"""Encode and decode CSV data coming from the files."""
def __init__(self, columns):
self._columns = columns
self._num_columns = len(columns)
self._delimiter = ","
def process(self, value):
st = io.StringIO(value)
cr = csv.DictWriter(st,
self._columns,
delimiter=self._delimiter,
quotechar='"',
quoting=csv.QUOTE_MINIMAL)
return next(cr)
然后將其用作
(p
| 'Read From Text - ' + input_file >> beam.io.ReadFromText(gs_path, skip_header_lines=1)
| beam.ParDo(CsvLineDecoder(list(fields.keys())))
...)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.