Class TableCreateOptions.Builder

java.lang.Object
io.github.flink.gcp.connector.bigquery.sink.TableCreateOptions.Builder
Enclosing class:
TableCreateOptions

@Public public static final class TableCreateOptions.Builder extends Object
Builder for TableCreateOptions.
  • Method Details

    • timePartitioning

      Partitions the table on ingestion time with the given granularity.
      Parameters:
      type - the partitioning granularity
      Returns:
      this builder
    • timePartitioning

      Partitions the table on the given TIMESTAMP, DATE or DATETIME column with the given granularity — the three column types BigQuery partitions on.
      Parameters:
      type - the partitioning granularity
      field - the column to partition on
      Returns:
      this builder
    • timePartitioningExpiration

      public TableCreateOptions.Builder timePartitioningExpiration(Duration expiration)
      Sets the partition expiration; partitions older than this are deleted by BigQuery. Requires time partitioning to be configured.
      Parameters:
      expiration - the partition expiration, at least 1 ms
      Returns:
      this builder
    • clusteredFields

      public TableCreateOptions.Builder clusteredFields(List<String> fields)
      Clusters the table on the given columns, in precedence order (at most four).
      Parameters:
      fields - the clustering columns
      Returns:
      this builder
    • description

      public TableCreateOptions.Builder description(String description)
      Sets the description of a created table.
      Parameters:
      description - the table description, not blank
      Returns:
      this builder
    • labels

      public TableCreateOptions.Builder labels(Map<String,String> labels)
      Sets the labels of a created table, replacing any set before.

      Keys must not be blank and values must not be null; an empty value is a label with no value. Whether a key or value is one BigQuery accepts is BigQuery's answer, given when the table is created. The key flink_gcp_cdc is rejected: the sink's CDC table provisioning owns it.

      Parameters:
      labels - the table labels
      Returns:
      this builder
    • kmsKeyName

      public TableCreateOptions.Builder kmsKeyName(String kmsKeyName)
      Sets the Cloud KMS key that encrypts a created table, as the key's resource name projects/<project>/locations/<location>/keyRings/<ring>/cryptoKeys/<key>.

      The key encrypts a table the sink creates, and FILE_LOADS states it on the jobs that fill the temporary tables it stages that table's data in. It is never applied to a table that already exists. The key must be in the dataset's location, and BigQuery's encryption service account needs the roles/cloudkms.cryptoKeyEncrypterDecrypter role on it; both are BigQuery's answer, given when the table is created.

      Parameters:
      kmsKeyName - the key's resource name, not blank
      Returns:
      this builder
    • build

      public TableCreateOptions build()
      Builds the options.
      Returns:
      the options