Merged PR 3000: Stg Hubspot form_submissions

# Description

Creation on stg_hubspot__form_submissions model

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Stg Hubspot form_submissions
This commit is contained in:
Joaquin Ossa 2024-10-04 09:49:54 +00:00 committed by Pablo Martín
commit b8caa18352
4 changed files with 84 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,52 @@ 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."
tests:
- not_null
- unique
- 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,19 @@
with
raw_form_submissions as (select * from {{ source("hubspot", "form_submissions") }}),
stg_hubspot__form_submissions as (
select
{{ adapter.quote("formId") }} as id_form,
{{ adapter.quote("values") }} as "values",
{{ unix_ms_timestamp_to_utc("submittedAt") }} as submitted_at_utc,
cast(
{{ unix_ms_timestamp_to_utc("submittedAt") }} as date
) as submitted_date_utc,
{{ unix_ms_timestamp_to_utc("updatedAt") }} as updated_at_utc,
cast(
{{ unix_ms_timestamp_to_utc("updatedAt") }} as date
) as updated_date_utc,
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
from raw_form_submissions
)
select *
from stg_hubspot__form_submissions