Vol*_*il3 5 etl python-3.x bonobo-etl
我是第一次使用Bonobo。我能够找出基本的例子。我想知道如何在提取步骤中放入两种不同类型的数据输入?假设我要从两个不同的站点抓取数据,如何将它们添加到管道中?
谢谢
您可以有两个不同的提取步骤(或 n 个不同的提取步骤)。
例如:
import bonobo
def extract_1():
yield "x1", "a"
yield "x1", "b"
yield "x1", "c"
def extract_2():
yield "x2", "a"
yield "x2", "b"
yield "x2", "c"
def extract_3():
yield "x3", "a"
yield "x3", "b"
yield "x3", "c"
def normalize(name, value):
yield name.upper(), value
def get_graph(**options):
graph = bonobo.Graph()
graph.add_chain(normalize, print, _input=None)
graph.add_chain(extract_1, _output=normalize)
graph.add_chain(extract_2, _output=normalize)
graph.add_chain(extract_3, _output=normalize)
return graph
if __name__ == "__main__":
with bonobo.parse_args() as options:
bonobo.run(get_graph(**options))
Run Code Online (Sandbox Code Playgroud)
请注意,每个节点都有先进先出约束,但“标准化”将在提取器生成数据时以随机顺序获取节点。
| 归档时间: |
|
| 查看次数: |
234 次 |
| 最近记录: |