Skip to content

Instantly share code, notes, and snippets.

View cyanred9's full-sized avatar

jieunyyyy cyanred9

View GitHub Profile
@janbenetka
janbenetka / bq_date_loop.sql
Last active November 20, 2022 12:46
[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