Arrays in BigQuery

Arrays in BigQuery

Create an Array

create table test_dataset_av.test_dataset_av as 

WITH
a as (
  select ('first','second', 'third') as sequence_num
)
select a.sequence_num from a

Create a dataset

CREATE SCHEMA my-sandbox.test_dataset_av

  OPTIONS (

    default_kms_key_name = 'KMS_KEY_NAME',

    default_partition_expiration_days = PARTITION_EXPIRATION,

    default_table_expiration_days = TABLE_EXPIRATION,

    description = 'test_billing_queries',

    labels = [('test1','VALUE_1'),('test2','VALUE_2')],

    location = 'us-central1',

    max_time_travel_hours = HOURS,

    storage_billing_model = STORAGE_BILLING_MODEL);

How to tell if a data type is an Array?

create table dataset_test.test_array as 

WITH

a as (

  select ('first','second', 'third') as sequence_num

)

select a.sequence_num from a

Summary

Arrays and Structs are an important part of any data analytics platform. This post discusses array basics in BigQuery.

 

Need an experienced Cloud Professional to help out with your Public Cloud Strategy? Set up a time with Anuj Varma.

anuj

I am passionate about getting cloud solutions right the first time. I help customers transition to the public cloud with the appropriate security controls and guardrails. GCP, AWS and Azure Security Specialist. <a href="https://calendly.com/anujvarma/google-cloud-architect-initial-consultation">Initial Consultation</a>

Leave a reply

Your email address will not be published. Required fields are marked *