Syntax

A google_bigquery_table is used to test a Google Table resource

Examples

describe google_bigquery_table(project: 'chef-gcp-inspec', dataset: 'inspec_gcp_dataset', name: 'inspec_gcp_bigquery_table') do
  it { should exist }

  its('expiration_time') { should cmp '1738882264000' }
  its('time_partitioning.type') { should eq 'DAY' }
  its('description') { should eq 'A BigQuery table' }
end

describe google_bigquery_table(project: 'chef-gcp-inspec', dataset: 'inspec_gcp_dataset', name: 'nonexistent') do
  it { should_not exist }
end

Properties

Properties that can be accessed from the google_bigquery_table resource:

  • table_reference: Reference describing the ID of this table

    • datasetId: The ID of the dataset containing this table
    • projectId: The ID of the project containing this table
    • tableId: The ID of the the table
  • creation_time: The time when this dataset was created, in milliseconds since the epoch.

  • description: A user-friendly description of the dataset

  • friendly_name: A descriptive name for this table

  • id: An opaque ID uniquely identifying the table.

  • labels: The labels associated with this dataset. You can use these to organize and group your datasets

  • last_modified_time: The time when this table was last modified, in milliseconds since the epoch.

  • location: The geographic location where the table resides. This value is inherited from the dataset.

  • name: Name of the table

  • num_bytes: The size of this table in bytes, excluding any data in the streaming buffer.

  • num_long_term_bytes: The number of bytes in the table that are considered “long-term storage”.

  • num_rows: The number of rows of data in this table, excluding any data in the streaming buffer.

  • type: Describes the table type

  • view: The view definition.

    • useLegacySql: Specifies whether to use BigQuery’s legacy SQL for this view
    • userDefinedFunctionResources: Describes user-defined function resources used in the query.
  • time_partitioning: If specified, configures time-based partitioning for this table.

    • expirationMs: Number of milliseconds for which to keep the storage for a partition.
    • type: The only type supported is DAY, which will generate one partition per day.
  • streaming_buffer: Contains information regarding this table’s streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer.

    • estimatedBytes: A lower-bound estimate of the number of bytes currently in the streaming buffer.
    • estimatedRows: A lower-bound estimate of the number of rows currently in the streaming buffer.
    • oldestEntryTime: Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds since the epoch, if the streaming buffer is available.
  • schema: Describes the schema of this table

    • fields: Describes the fields in a table.
  • encryption_configuration: Custom encryption configuration

    • kmsKeyName: Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
  • expiration_time: The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely.

  • external_data_configuration: Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.

    • autodetect: Try to detect schema and format options automatically. Any option specified explicitly will be honored.
    • compression: The compression type of the data source
    • ignoreUnknownValues: Indicates if BigQuery should allow extra values that are not represented in the table schema
    • maxBadRecords: The maximum number of bad records that BigQuery can ignore when reading data
    • sourceFormat: The data format
    • sourceUris: The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one ‘’ wildcard character and it must come after the ‘bucket’ name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the ‘’ wildcard character is not allowed.
    • schema: The schema for the data. Schema is required for CSV and JSON formats
    • googleSheetsOptions: Additional options if sourceFormat is set to GOOGLE_SHEETS.
    • csvOptions: Additional properties to set if sourceFormat is set to CSV.
    • bigtableOptions: Additional options if sourceFormat is set to BIGTABLE.
  • dataset: Name of the dataset

GCP Permissions

Ensure the BigQuery API is enabled for the current project.