From e9f16342e7986de834e4aa024f41aac20bf312aa Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Thu, 3 Oct 2024 12:19:27 +0200 Subject: [PATCH] added tests --- macros/timestamp_to_utc.sql | 5 +++-- models/staging/hubspot/schema.yml | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/macros/timestamp_to_utc.sql b/macros/timestamp_to_utc.sql index 20cac93..59cbefe 100644 --- a/macros/timestamp_to_utc.sql +++ b/macros/timestamp_to_utc.sql @@ -12,11 +12,12 @@ and ensures that the output is properly formatted for further analysis. {% macro timestamp_to_utc(column_name) %} to_timestamp( {{ adapter.quote(column_name) }}::double precision / 1000 - ) at time zone 'UTC' as {{ column_name | replace("At", "") }}_at_utc, + ) at time zone 'UTC' + as {{ column_name | replace("At", "") | replace("Date", "") }}_at_utc, cast( to_timestamp( {{ adapter.quote(column_name) }}::double precision / 1000 ) at time zone 'UTC' as date - ) as {{ column_name | replace("At", "") }}_date_utc + ) as {{ column_name | replace("At", "") | replace("Date", "") }}_date_utc {% endmacro %} diff --git a/models/staging/hubspot/schema.yml b/models/staging/hubspot/schema.yml index cb0f7dd..974c6c2 100644 --- a/models/staging/hubspot/schema.yml +++ b/models/staging/hubspot/schema.yml @@ -121,6 +121,9 @@ models: - name: id_form data_type: character varying description: "Unique id for each form submission." + tests: + - not_null + - unique - name: values data_type: jsonb