Skip to main content

Command Palette

Search for a command to run...

System variables in BigQuery

Updated
1 min read
System variables in BigQuery
C

Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified

Today's quick post is about system variables in BigQuery. What are they?

They are a special type of variables, available in scripts (multi-statement queries). You can use them to read (and sometimes write) query metadata during query execution.

Here's a couple of examples:
- @@query_label - read/write query labels, making easier for you to group your queries based on they are used for
- @@time_zone - read/write default time zone to use
- @@script.job_id - the job id of the current job

Check out below an example with slot_ms (returns slot time in millis), bytes_billed and creation_date.

Found it useful? Subscribe to my Analytics newsletter at notjustsql.com.

More from this blog

D

Datawise: A blog on SQL, BigQuery, Analytics, Python Tips and Tricks

204 posts

Data Engineer with a passion for transforming complex data landscapes into insightful stories. Here on my blog, I share insights, challenges, and the ever-evolving dance of technology and business.