Hubspot deals
This commit is contained in:
parent
20425495f9
commit
306035d46d
3 changed files with 83 additions and 0 deletions
|
|
@ -6,3 +6,5 @@ sources:
|
||||||
tables:
|
tables:
|
||||||
- name: contacts
|
- name: contacts
|
||||||
identifier: contacts
|
identifier: contacts
|
||||||
|
- name: deals
|
||||||
|
identifier: deals
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,64 @@ models:
|
||||||
description: "Timestamp of when data was extracted to DWH."
|
description: "Timestamp of when data was extracted to DWH."
|
||||||
tests:
|
tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
- name: stg_hubspot__deals
|
||||||
|
description: "Table with deal information stored in Hubspot."
|
||||||
|
columns:
|
||||||
|
- name: id_deal
|
||||||
|
data_type: character varying
|
||||||
|
description: "Unique id for each contact information."
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: archived
|
||||||
|
data_type: boolean
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
- name: contacts
|
||||||
|
data_type: jsonb
|
||||||
|
description: "List of contact ids for the deal"
|
||||||
|
|
||||||
|
- name: companies
|
||||||
|
data_type: jsonb
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
- name: line_items
|
||||||
|
data_type: jsonb
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
- name: properties
|
||||||
|
data_type: jsonb
|
||||||
|
description: "Json with all information for this deal."
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_at_utc
|
||||||
|
data_type: timestamp with time zone
|
||||||
|
description: "Timestamp of when this record was created."
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_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
|
||||||
|
|
|
||||||
20
models/staging/hubspot/stg_hubspot__deals.sql
Normal file
20
models/staging/hubspot/stg_hubspot__deals.sql
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
with
|
||||||
|
raw_deals as (select * from {{ source("hubspot", "deals") }}),
|
||||||
|
stg_core__deals as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("id") }} as id_deal,
|
||||||
|
{{ adapter.quote("archived") }} as archived,
|
||||||
|
{{ adapter.quote("contacts") }} as contacts,
|
||||||
|
{{ adapter.quote("companies") }} as companies,
|
||||||
|
{{ adapter.quote("line_items") }} as line_items,
|
||||||
|
{{ adapter.quote("properties") }} as properties,
|
||||||
|
{{ adapter.quote("createdAt") }} as created_at_utc,
|
||||||
|
cast({{ adapter.quote("createdAt") }} as date) as created_date_utc,
|
||||||
|
{{ adapter.quote("updatedAt") }} as updated_at_utc,
|
||||||
|
cast({{ adapter.quote("updatedAt") }} as date) as updated_date_utc,
|
||||||
|
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||||
|
|
||||||
|
from raw_deals
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_core__deals
|
||||||
Loading…
Add table
Add a link
Reference in a new issue