【发布时间】:2018-05-05 13:07:53
【问题描述】:
我有一个位于新“asia-northeast1”区域的 BigQuery 数据集。我正在尝试运行 Dataflow 模板化管道(在澳大利亚地区运行)以从中读取表。即使数据集/表确实存在,它也会抛出以下错误:
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
{
"code" : 404,
"errors" : [ {
"domain" : "global",
"message" : "Not found: Dataset grey-sort-challenge:Konnichiwa_Tokyo",
"reason" : "notFound"
} ],
"message" : "Not found: Dataset grey-sort-challenge:Konnichiwa_Tokyo"
}
我在这里做错了吗?
/**
* BigQuery -> ParDo -> GCS (one file)
*/
public class BigQueryTableToOneFile {
public static void main(String[] args) throws Exception {
PipelineOptionsFactory.register(TemplateOptions.class);
TemplateOptions options = PipelineOptionsFactory
.fromArgs(args)
.withValidation()
.as(TemplateOptions.class);
options.setAutoscalingAlgorithm(THROUGHPUT_BASED);
Pipeline pipeline = Pipeline.create(options);
pipeline.apply(BigQueryIO.read().from(options.getBigQueryTableName()).withoutValidation())
.apply(ParDo.of(new DoFn<TableRow, String>() {
@ProcessElement
public void processElement(ProcessContext c) throws Exception {
String commaSep = c.element().values()
.stream()
.map(cell -> cell.toString().trim())
.collect(Collectors.joining("\",\""));
c.output(commaSep);
}
}))
.apply(TextIO.write().to(options.getOutputFile())
.withoutSharding()
.withWritableByteChannelFactory(GZIP)
);
pipeline.run();
}
public interface TemplateOptions extends DataflowPipelineOptions {
@Description("The BigQuery table to read from in the format project:dataset.table")
@Default.String("bigquery-samples:wikipedia_benchmark.Wiki1k")
ValueProvider<String> getBigQueryTableName();
void setBigQueryTableName(ValueProvider<String> value);
@Description("The name of the output file to produce in the format gs://bucket_name/filname.csv")
@Default.String("gs://bigquery-table-to-one-file/output/bar.csv.gz")
ValueProvider<String> getOutputFile();
void setOutputFile(ValueProvider<String> value);
}
}
参数:
--project=grey-sort-challenge
--runner=DataflowRunner
--jobName=bigquery-table-to-one-file
--maxNumWorkers=1
--zone=australia-southeast1-a
--stagingLocation=gs://bigquery-table-to-one-file/jars
--tempLocation=gs://bigquery-table-to-one-file/tmp
--templateLocation=gs://bigquery-table-to-one-file/template
职位编号:2018-05-05_05_37_08-8260293482986343692
【问题讨论】:
-
我们也面临同样的问题。你有什么解决办法吗?
-
不,恐怕还没有。
标签: google-bigquery google-cloud-dataflow