Stg Hubspot form_submissions

This commit is contained in:
Joaquin Ossa 2024-09-27 17:30:25 +02:00
parent 306035d46d
commit ee6b613887
3 changed files with 77 additions and 0 deletions

View file

@ -8,3 +8,5 @@ sources:
identifier: contacts
- name: deals
identifier: deals
- name: form_submissions
identifier: form_submissions

View file

@ -115,3 +115,49 @@ models:
description: "Timestamp of when data was extracted to DWH."
tests:
- not_null
- name: stg_hubspot__form_submissions
description: "Table with forms values that have been submitted in the forms"
columns:
- name: id_form
data_type: character varying
description: "Unique id for each form submission."
- name: values
data_type: jsonb
description: "Json with value information for each form"
tests:
- not_null
- name: page_url
data_type: character varying
description: ""
- name: submitted_at_utc
data_type: timestamp with time zone
description: "Timestamp of when this record was created."
tests:
- not_null
- name: submitted_date_utc
data_type: timestamp without time zone
description: "Date of when this record was created."
tests:
- not_null
- name: updated_at_utc
data_type: timestamp with time zone
description: "Timestamp of when this record was last updated."
tests:
- not_null
- name: updated_date_utc
data_type: timestamp without time zone
description: "Date of when this record was last updated."
tests:
- not_null
- name: dwh_extracted_at_utc
data_type: timestamp with time zone
description: "Timestamp of when data was extracted to DWH."
tests:
- not_null

View file

@ -0,0 +1,29 @@
with
raw_form_submissions as (select * from {{ source("hubspot", "form_submissions") }}),
stg_core__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("_airbyte_extracted_at") }} as dwh_extracted_at_utc
from raw_form_submissions
)
select *
from stg_core__form_submissions