sandboxws
12/29/2018 - 6:06 AM

WriteAlbumeToBigQuery.java

bqTableRows.apply("Write to BigQuery",
  BigQueryIO.writeTableRows()
    .to(options.getOutputTable()) // Passed as an argument from the command line
    .withSchema(AlbumTableSchema.schema()) // The schema for the BigQuery table
    .ignoreUnknownValues() // Ignore any values passed but not defined on the table schema
    .withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND) // Append to the BigQuery table.
    .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED) // Create the BigQuery table if it doesn't exist
);