created macro and fixed naming

This commit is contained in:
Joaquin Ossa 2024-10-02 14:50:34 +02:00
parent ee6b613887
commit 0a880a138b
2 changed files with 28 additions and 22 deletions

View file

@ -1,29 +1,13 @@
with
raw_form_submissions as (select * from {{ source("hubspot", "form_submissions") }}),
stg_core__form_submissions as (
stg_hubspot__form_submissions as (
select
{{ adapter.quote("formId") }} as id_form, {{ adapter.quote("values") }} as
values
,
{{ adapter.quote("pageUrl") }} as page_url,
to_timestamp(
{{ adapter.quote("submittedAt") }}::double precision / 1000
) at time zone 'UTC' as submitted_at_utc,
cast(
to_timestamp(
{{ adapter.quote("submittedAt") }}::double precision / 1000
) at time zone 'UTC' as date
) as submitted_date_utc,
to_timestamp(
{{ adapter.quote("updatedAt") }}::double precision / 1000
) at time zone 'UTC' as updated_at_utc,
cast(
to_timestamp(
{{ adapter.quote("updatedAt") }}::double precision / 1000
) at time zone 'UTC' as date
) as updated_date_utc,
{{ adapter.quote("formId") }} as id_form,
{{ adapter.quote("values") }} as "values",
{{ timestamp_to_utc("submittedAt") }},
{{ timestamp_to_utc("updatedAt") }},
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
from raw_form_submissions
)
select *
from stg_core__form_submissions
from stg_hubspot__form_submissions