From 341e5aefe50ccdc13218ce3e9ab726b39cbeb273 Mon Sep 17 00:00:00 2001 From: Anna Saiapina Date: Thu, 21 Mar 2024 15:18:15 +0000 Subject: [PATCH] Create export tables --- definitions/export/all_interactions_export.sqlx | 10 ++++++++++ definitions/export/calls_export.sqlx | 10 ++++++++++ definitions/export/digital_export.sqlx | 10 ++++++++++ definitions/gold/ALL_INTERACRIONS_SUM.sqlx | 4 ++-- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 definitions/export/all_interactions_export.sqlx create mode 100644 definitions/export/calls_export.sqlx create mode 100644 definitions/export/digital_export.sqlx diff --git a/definitions/export/all_interactions_export.sqlx b/definitions/export/all_interactions_export.sqlx new file mode 100644 index 0000000..19eeed8 --- /dev/null +++ b/definitions/export/all_interactions_export.sqlx @@ -0,0 +1,10 @@ +config { + type: "table", + schema: "pphe_five9_gold", + tags: ["daily"], + description: "Exporting last 5 days of ALL_INTERACRIONS_SUM table" +} + +select * +from ${ref("ALL_INTERACRIONS_SUM")} +where date(timestamp_millisecond) >= date_sub(current_datetime("Europe/Amsterdam"), INTERVAL 5 DAY) \ No newline at end of file diff --git a/definitions/export/calls_export.sqlx b/definitions/export/calls_export.sqlx new file mode 100644 index 0000000..9ac16ff --- /dev/null +++ b/definitions/export/calls_export.sqlx @@ -0,0 +1,10 @@ +config { + type: "table", + schema: "pphe_five9_gold", + tags: ["daily"], + description: "Exporting last 5 days of CALLS table" +} + +select * +from ${ref("CALLS")} +where date(timestamp_millisecond) >= date_sub(current_datetime("Europe/Amsterdam"), INTERVAL 5 DAY) \ No newline at end of file diff --git a/definitions/export/digital_export.sqlx b/definitions/export/digital_export.sqlx new file mode 100644 index 0000000..cf66961 --- /dev/null +++ b/definitions/export/digital_export.sqlx @@ -0,0 +1,10 @@ +config { + type: "table", + schema: "pphe_five9_gold", + tags: ["daily"], + description: "Exporting last 5 days of DIGITAL table" +} + +select * +from ${ref("DIGITAL")} +where date(timestamp_millisecond) >= date_sub(current_datetime("Europe/Amsterdam"), INTERVAL 5 DAY) \ No newline at end of file diff --git a/definitions/gold/ALL_INTERACRIONS_SUM.sqlx b/definitions/gold/ALL_INTERACRIONS_SUM.sqlx index 0a5ed32..498d52a 100644 --- a/definitions/gold/ALL_INTERACRIONS_SUM.sqlx +++ b/definitions/gold/ALL_INTERACRIONS_SUM.sqlx @@ -5,7 +5,7 @@ config { description: "All interactions table for CALLS and DIGITAL" } -select TIMESTAMP, +select TIMESTAMP_MILLISECOND, DATE, HOUR_OF_DAY, MONTH, @@ -15,7 +15,7 @@ select TIMESTAMP, 1 INTERACTIONS from ${ref("CALLS")} union all -select TIMESTAMP, +select TIMESTAMP_MILLISECOND, DATE, HOUR_OF_DAY, MONTH,