Reputation: 784
I'm trying to write beamSql data to BigQuery as shown below :
final_out1.apply(BigQueryIO.<TableRow>Write
.named("Write")
.to("my-project:data_id1.tables_test")
.withSchema(schema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE))
.withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED));
I'm getting error on named(), the error :
The method named(String) is undefined for the type BigQueryIO.Write
Any idea what this means ?
EDIT The format function that I defined :
final_out1.apply(BigQueryIO.<TableRow>write()
.withSchema(schema)
.to("beta-194409:data_id1.tables_test"));
/* .withFormatFunction(fin -> new TableRow().
set("SalesComponent", fin.getSalesComponent()).
set("DuetoValue", fin.getDuetoValue()).
set("ModelIteration", fin.getMo//delIteration())) */
//.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE).withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED));
Upvotes: 0
Views: 231
Reputation: 2621
There is no such method named()
for class BigQueryIO.Write
so this error makes sense.
You can specify a transform name as the first parameter of the apply()
method.
final_out1.apply("Write", BigQueryIO.<TableRow>.write()
.to("my-project:data_id1.tables_test")
.withSchema(schema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE))
.withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED));
Note: Use BigQueryIO.write()
instead of BigQueryIO.Write
.
Upvotes: 1