Spring Batch extension which contains an ItemWriter
implementation for BigQuery based on Java BigQuery.
It supports writing CSV, JSON using load jobs.
Next to the configuration of Spring Batch one needs to configure the BigQueryCsvItemWriter
.
@Bean
BigQueryCsvItemWriter<MyDto> bigQueryCsvWriter() {
WriteChannelConfiguration writeConfiguration = WriteChannelConfiguration
.newBuilder(TableId.of("csv_dataset", "csv_table"))
.setAutodetect(true)
.setFormatOptions(FormatOptions.csv())
.build();
BigQueryCsvItemWriter<MyDto> writer = new BigQueryCsvItemWriterBuilder<MyDto>()
.bigQuery(mockedBigQuery)
.writeChannelConfig(writeConfiguration)
.build();
}
Additional examples could be found in here.
Property | Required | Description |
---|---|---|
|
yes |
BigQuery object that provided by BigQuery Java Library. Responsible for connection with BigQuery. |
|
yes |
BigQuery write channel config provided by BigQuery Java Library. Responsible for configuring data type, data channel, jobs that will be sent to BigQuery. |
|
no |
Your own converter that specifies how to convert input CSV / JSON to a byte array. |
|
no |
Your way to customize how to create BigQuery dataset. |
|
no |
Your custom handler for BigQuery Job provided by BigQuery Java Library. |