public interface BigQueryOperations
Modifier and Type | Method and Description |
---|---|
org.springframework.util.concurrent.ListenableFuture<com.google.cloud.bigquery.Job> |
writeDataToTable(String tableName,
InputStream inputStream,
com.google.cloud.bigquery.FormatOptions dataFormatOptions)
Writes data to a specified BigQuery table.
|
org.springframework.util.concurrent.ListenableFuture<com.google.cloud.bigquery.Job> |
writeDataToTable(String tableName,
InputStream inputStream,
com.google.cloud.bigquery.FormatOptions dataFormatOptions,
com.google.cloud.bigquery.Schema schema)
Writes data to a specified BigQuery table with a manually-specified table Schema.
|
org.springframework.util.concurrent.ListenableFuture<WriteApiResponse> |
writeJsonStream(String tableName,
InputStream jsonInputStream)
This method uses BigQuery Storage Write API to write new line delimited JSON file to the
specified table.
|
org.springframework.util.concurrent.ListenableFuture<WriteApiResponse> |
writeJsonStream(String tableName,
InputStream jsonInputStream,
com.google.cloud.bigquery.Schema schema)
This method uses BigQuery Storage Write API to write new line delimited JSON file to the
specified table.
|
org.springframework.util.concurrent.ListenableFuture<com.google.cloud.bigquery.Job> writeDataToTable(String tableName, InputStream inputStream, com.google.cloud.bigquery.FormatOptions dataFormatOptions)
tableName
- name of the table to write toinputStream
- input stream of the table data to writedataFormatOptions
- the format of the data to writeListenableFuture
containing the BigQuery Job indicating completion of operationBigQueryException
- if errors occur when loading data to the BigQuery tableorg.springframework.util.concurrent.ListenableFuture<com.google.cloud.bigquery.Job> writeDataToTable(String tableName, InputStream inputStream, com.google.cloud.bigquery.FormatOptions dataFormatOptions, com.google.cloud.bigquery.Schema schema)
Example:
Schema schema = Schema.of(
Field.of("CountyId", StandardSQLTypeName.INT64),
Field.of("State", StandardSQLTypeName.STRING),
Field.of("County", StandardSQLTypeName.STRING)
);
ListenableFuture<Job> bigQueryJobFuture =
bigQueryTemplate.writeDataToTable(
TABLE_NAME, dataFile.getInputStream(), FormatOptions.csv(), schema);
tableName
- name of the table to write toinputStream
- input stream of the table data to writedataFormatOptions
- the format of the data to writeschema
- the schema of the table being loadedListenableFuture
containing the BigQuery Job indicating completion of operationBigQueryException
- if errors occur when loading data to the BigQuery tableorg.springframework.util.concurrent.ListenableFuture<WriteApiResponse> writeJsonStream(String tableName, InputStream jsonInputStream)
tableName
- name of the table to write tojsonInputStream
- input stream of the json file to be writtenListenableFuture
containing the WriteApiResponse indicating completion of
operationorg.springframework.util.concurrent.ListenableFuture<WriteApiResponse> writeJsonStream(String tableName, InputStream jsonInputStream, com.google.cloud.bigquery.Schema schema)
tableName
- name of the table to write tojsonInputStream
- input stream of the json file to be writtenListenableFuture
containing the WriteApiResponse indicating completion of
operationCopyright © 2023. All rights reserved.