通过Apache Beam

时间:2017-07-11 09:24:48

标签: google-bigquery google-cloud-dataflow apache-beam

我在运行时获取BigQuery表名,并将该名称传递给管道末尾的BigQueryIO.write操作以写入该表。

我为其编写的代码是:

rows.apply("write to BigQuery", BigQueryIO
    .writeTableRows()
    .withSchema(schema)
    .to("projectID:DatasetID."+tablename)
    .withWriteDisposition(WriteDisposition.WRITE_TRUNCATE)
    .withCreateDisposition(CreateDisposition.CREATE_IF_NEEDED));

使用这种语法我总是会收到错误,

Exception in thread "main" java.lang.IllegalArgumentException: Table reference is not in [project_id]:[dataset_id].[table_id] format

如果我事先不知道应该将数据放入哪个表格,如何以正确的格式传递表格名称?有什么建议吗?

谢谢

1 个答案:

答案 0 :(得分:3)

对此派对来说很晚。 我怀疑问题是你传入的是字符串而不是表引用。

如果您创建了表格引用,我怀疑您对上述代码没有任何问题。

<label for=”productNameInput”>Product Name</label> 
<input type=”text”
id=”productNameInput” 
placeholder=”Product Name”
[ formControl]=”myForm. get ( ’productName ’)” 
[ (ngModel) ] = ”productName”>