Package org.pipecraft.infra.bq
Class TableExportConfig.Builder
- java.lang.Object
-
- org.pipecraft.infra.bq.TableExportConfig.Builder
-
- Enclosing class:
- TableExportConfig
public static class TableExportConfig.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableExportConfigbuild()TableExportConfig.CompressiongetCompression()chargetCSVFieldDelimiter()Set<String>getDestinationURIs()TableExportConfig.ExportFormatgetExportFormat()com.google.cloud.bigquery.TableIdgetSourceTableReference()LonggetTimeoutMs()booleanisPrintHeader()TableExportConfig.BuildersetCompression(TableExportConfig.Compression compression)TableExportConfig.BuildersetExportFormat(TableExportConfig.ExportFormat exportFormat)TableExportConfig.BuildersetFieldDelimiter(char csvFieldDelimiter)TableExportConfig.BuildersetPrintHeader(boolean printHeader)TableExportConfig.BuildersetTimeoutMs(Long timeoutMs)
-
-
-
Constructor Detail
-
Builder
public Builder(com.google.cloud.bigquery.TableId sourceTableReference, Set<String> destinationURIs)Constructor- Parameters:
sourceTableReference- reference to the table to exportdestinationURIs- A set of fully-qualified Google Cloud Storage URIs where the table should be exported to
-
Builder
public Builder(com.google.cloud.bigquery.TableId sourceTableReference, String destinationURI)Constructor- Parameters:
sourceTableReference- reference to the table to exportdestinationURI- The Google Cloud Storage URI where the table should be exported to
-
-
Method Detail
-
setExportFormat
public TableExportConfig.Builder setExportFormat(TableExportConfig.ExportFormat exportFormat)
- Parameters:
exportFormat- the format of the output file. Default is CSV.- Returns:
- This builder object
-
getExportFormat
public TableExportConfig.ExportFormat getExportFormat()
- Returns:
- the format of the output file/s. Default is CSV.
-
setCompression
public TableExportConfig.Builder setCompression(TableExportConfig.Compression compression)
- Parameters:
compression- the compression of the output file/s. Default is NONE.- Returns:
- This builder object
-
getCompression
public TableExportConfig.Compression getCompression()
- Returns:
- the compression of the output file/s. Default is NONE.
-
setFieldDelimiter
public TableExportConfig.Builder setFieldDelimiter(char csvFieldDelimiter)
- Parameters:
csvFieldDelimiter- the field delimiter in the output file/s. Default is ",". Relevant only for CSV format.- Returns:
- This builder object
-
getCSVFieldDelimiter
public char getCSVFieldDelimiter()
- Returns:
- the field delimiter in the output file. Default is ','. Relevant only for CSV format.
-
setPrintHeader
public TableExportConfig.Builder setPrintHeader(boolean printHeader)
- Parameters:
printHeader- indicates whether the file should contain the column names. Relevant only for CSV. Default is true.- Returns:
- This builder object
-
isPrintHeader
public boolean isPrintHeader()
- Returns:
- indicates whether the file should contain the column names. Relevant only for CSV. Default is true.
-
getSourceTableReference
public com.google.cloud.bigquery.TableId getSourceTableReference()
- Returns:
- reference to the table to export
-
getDestinationURIs
public Set<String> getDestinationURIs()
- Returns:
- A set of fully-qualified Google Cloud Storage URIs where the extracted table should be written. A URI may contain a wildcard ('*') in the file name part of the path, indicating that a sharded output is required. BigQuery makes it mandatory for large tables.
-
setTimeoutMs
public TableExportConfig.Builder setTimeoutMs(Long timeoutMs)
- Parameters:
timeoutMs- The export execution timeout to set, in milliseconds. Must be positive. Null means no timeout. NOTE: Google's API doesn't seem to always respect this limit, and it's not always clear which timeout applies (The export level timeout here or the global one as provided in theBigQueryConnector's constructor.- Returns:
- This builder object
-
getTimeoutMs
public Long getTimeoutMs()
- Returns:
- The export execution timeout, in milliseconds.
Null means no timeout (default value).
NOTE: Google's API doesn't seem to always respect this limit, and it's not always clear which timeout applies
(The export level timeout here or the global one as provided in the
BigQueryConnector's constructor.
-
build
public TableExportConfig build()
- Returns:
- A new
TableExportConfigusing the current settings
-
-