Skip to content

Instantly share code, notes, and snippets.

@sandboxws
Created December 29, 2018 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandboxws/a380e190a6209542efc37078fb1cff19 to your computer and use it in GitHub Desktop.
Save sandboxws/a380e190a6209542efc37078fb1cff19 to your computer and use it in GitHub Desktop.
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
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment