.withMaxFileSize(10) .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED) .withFormatFunction( user -> { Matcher matcher = userPattern.matcher(user);
BigQueryIO.<Integer>write() .to(tableFunction) .withFormatFunction(i -> new TableRow().set("name", "number" + i).set("number", i)) .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED) .withSchemaFromView(schemasView)
.withFormatFunction(toTableRowDoFn::toTableRow) .withCreateDisposition(CreateDisposition.CREATE_NEVER) .withWriteDisposition(WriteDisposition.WRITE_APPEND)
.to(tableSpec) .withSchema(tableSchema) .withFormatFunction( (Quote elem) -> new TableRow().set("source", elem.source).set("quote", elem.quote)) .to(tableSpec) .withJsonSchema(tableSchemaJson) .withFormatFunction( (Quote elem) -> new TableRow().set("source", elem.source).set("quote", elem.quote)) .withFormatFunction( (WeatherData elem) -> new TableRow() .to(tableSpec + "_partitioning") .withSchema(tableSchema) .withFormatFunction( (WeatherData elem) -> new TableRow()
@Override public POutput buildIOWriter(PCollection<Row> input) { return input.apply( BigQueryIO.<Row>write() .withSchema(BigQueryUtils.toTableSchema(getSchema())) .withFormatFunction(BigQueryUtils.toTableRow()) .to(tableSpec)); }
/** * A {@link PTransform} that writes a {@link PCollection} containing {@link TableRow TableRows} to * a BigQuery table. * * <p>It is recommended to instead use {@link #write} with {@link * Write#withFormatFunction(SerializableFunction)}. */ public static Write<TableRow> writeTableRows() { return BigQueryIO.<TableRow>write().withFormatFunction(IDENTITY_FORMATTER); }