Table: gcp_bigquery_tables

This table shows data for GCP BigQuery Tables.

https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table (opens in a new tab)

The composite primary key for this table is (project_id, id).

Relations

This table depends on gcp_bigquery_datasets.

Columns

NameType
_cq_iduuid
_cq_parent_iduuid
project_id (PK)utf8
clone_definitionjson
clusteringjson
creation_timeint64
default_collationutf8
default_rounding_modeutf8
descriptionutf8
encryption_configurationjson
etagutf8
expiration_timeint64
external_data_configurationjson
friendly_nameutf8
id (PK)utf8
kindutf8
labelsjson
last_modified_timeint64
locationutf8
materialized_viewjson
max_stalenessutf8
modeljson
num_active_logical_bytesint64
num_active_physical_bytesint64
num_bytesint64
num_long_term_bytesint64
num_long_term_logical_bytesint64
num_long_term_physical_bytesint64
num_partitionsint64
num_physical_bytesint64
num_rowsint64
num_time_travel_physical_bytesint64
num_total_logical_bytesint64
num_total_physical_bytesint64
range_partitioningjson
require_partition_filterbool
schemajson
self_linkutf8
snapshot_definitionjson
streaming_bufferjson
table_constraintsjson
table_referencejson
time_partitioningjson
typeutf8
viewjson

Example Queries

These SQL queries are sampled from CloudQuery policies and are compatible with PostgreSQL.

Ensure that a Default Customer-managed encryption key (CMEK) is specified for all BigQuery Data Sets (Automated)

SELECT
  DISTINCT
  d.id AS resource_id,
  'Ensure that a Default Customer-managed encryption key (CMEK) is specified for all BigQuery Data Sets (Automated)'
    AS title,
  d.project_id AS project_id,
  CASE
  WHEN t.encryption_configuration->>'kmsKeyName' = ''
  OR (d.default_encryption_configuration->>'kmsKeyName') IS NULL
  THEN 'fail'
  ELSE 'pass'
  END
    AS status
FROM
  gcp_bigquery_datasets AS d
  JOIN gcp_bigquery_tables AS t ON
      d.dataset_reference->>'datasetId' = t.table_reference->>'datasetId'
      AND d.dataset_reference->>'projectId' = t.table_reference->>'projectId';