0
我在本地機器上設置了DataFlow管道。它需要一個帶有JSON對象的示例新行分隔文件,它的作用是將最終結果格式化爲TableRow
。當是寫入BigQuery的時候,我不知道如何進行身份驗證。在Dataflow的文檔或者使用本地管道寫入BigQuery的例子中,我找不到任何東西。如果可能的話,我想知道如何去做。在我的心目中,應該是這樣的兩種:通過本地DataFlow作業寫入BigQuery
...
session_windowed_items.apply(ParDo.of(new FormatAsTableRowFn()))
.apply(BigQueryIO.Write
.withCredentials/Token(SOME_TOKEN) // <- This line
.withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_NEVER)
.to("project:db.table"));
...
或
...
PipelineOptions options = PipelineOptionsFactory.create();
options.setGoogleCloudCredentials/Token(SOME_TOKEN) // <- This line
Pipeline p = Pipeline.create(options);
...