2017-05-09 33 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