Below is the code that I'm using to write data to BigQuery
WriteResult result = formattedData.get(successRows).setCoder(TableRowJsonCoder.of())
.apply("BQ SteamingInserts",BigQueryIO.writeTableRows()
.withMethod(BigQueryIO.Write.Method.STREAMING_INSERTS)
.withFormatFunction(new TableRowFormatFn())
.to(new DestinationMapper())
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
.withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_NEVER)
.withFailedInsertRetryPolicy(InsertRetryPolicy.retryTransientErrors())
.withoutValidation()
.withExtendedErrorInfo());
The code is handling all the schema related issues but when table does not exist in BigQuery, it keeps retrying the inserts indefinitely resulting in pipeline getting stalled.
Below is the error obtained in Dataflow
java.lang.RuntimeException: com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
{
"code" : 404,
"errors" : [ {
"domain" : "global",
"message" : "Not found: Table analytics-and-presentation:trusted_layer_ods.wrong_table",
"reason" : "notFound"
} ],
"message" : "Not found: Table analytics-and-presentation:trusted_layer_ods.wrong_table",
"status" : "NOT_FOUND"
}
Can someone help?