From 02e4d3bb0c2dd53ebde92c6c98aadfa31d99f259 Mon Sep 17 00:00:00 2001 From: Anna Saiapina Date: Tue, 8 Oct 2024 08:28:17 +0000 Subject: [PATCH] Add timestamp change for 2023 --- definitions/staging/stg_calls.sqlx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/definitions/staging/stg_calls.sqlx b/definitions/staging/stg_calls.sqlx index be6f73d..2bde833 100644 --- a/definitions/staging/stg_calls.sqlx +++ b/definitions/staging/stg_calls.sqlx @@ -66,7 +66,16 @@ select DAY_OF_WEEK, r'^\d\d', cast(extract(hour from time(timestamp_seconds(cast(TIME_TO_ABANDON as int)))) + 24 * unix_date(date(timestamp_seconds(cast(TIME_TO_ABANDON as int)))) as string) ) as TIME_TO_ABANDON_FORMATTED, - TIMESTAMP, + case + when (timestamp >= timestamp('2023-01-01 00:00:00') and timestamp < timestamp('2023-03-12 02:00:00')) or + (timestamp >= timestamp('2023-03-26 02:00:00') and timestamp < timestamp('2023-10-29 03:00:00')) or + (timestamp >= timestamp('2023-11-05 02:00:00') and timestamp < timestamp('2024-01-01 00:00:00')) + then TIMESTAMP_ADD(timestamp, interval 8 HOUR) + when (timestamp >= timestamp('2023-03-12 02:00:00') and timestamp < timestamp('2023-03-26 02:00:00')) or + (timestamp >= timestamp('2023-10-29 03:00:00') and timestamp < timestamp('2023-11-05 02:00:00')) + then TIMESTAMP_ADD(timestamp, interval 7 HOUR) + else timestamp + end TIMESTAMP, -- 2023 timestamps are in PT (and there time changes are on different dates) TIME_INTERVAL, ABANDON_RATE, ANI_AREA_CODE,