Skip to content

Instantly share code, notes, and snippets.

View cyanred9's full-sized avatar

jieunyyyy cyanred9

View GitHub Profile
@cyanred9
cyanred9 / bq_date_loop.sql
Created November 20, 2022 12:45 — forked from janbenetka/bq_date_loop.sql
[BQ Loop over days] Date loop for backfills #bigquery #sql #date #loop
DECLARE i INT64 DEFAULT 0;
DECLARE DATES ARRAY<DATE>;
DECLARE event_date DATE;
SET DATES = GENERATE_DATE_ARRAY(DATE(2019,1,1), DATE(2019, 12, 31), INTERVAL 1 DAY);
LOOP
SET i = i + 1;
IF i > ARRAY_LENGTH(DATES) THEN