2017-05-09 30 views
1

) 这是我的第一个问题,我真的很难找到一些答案。 我想创建非常简单的管道,并且一开始就已经卡住了。这里说到我的代码:梁数据流python名'PipelineOptions'未定义

import apache_beam as beam 
options = PipelineOptions() 
google_cloud_options = options.view_as(GoogleCloudOptions) 
google_cloud_options.project = 'myproject' 
google_cloud_options.job_name = 'mypipe' 
google_cloud_options.staging_location = 'gs://mybucket/staging' 
google_cloud_options.temp_location = 'gs://mybucket/temp' 
options.view_as(StandardOptions).runner = 'DataflowRunner' 

产生错误: NameError:名字 'PipelineOptions' 没有你的帮助定义

THX。

回答

0

您将需要添加一些额外的进口量例如工作:

from apache_beam.io import ReadFromText 
from apache_beam.io import WriteToText 
from apache_beam.metrics import Metrics 
from apache_beam.utils.pipeline_options import PipelineOptions 
from apache_beam.utils.pipeline_options import SetupOptions 
from apache_beam.utils.pipeline_options import GoogleCloudOptions 
from apache_beam.utils.pipeline_options import StandardOptions