staging Hubspot contacts
This commit is contained in:
parent
a280f79d18
commit
20425495f9
3 changed files with 82 additions and 0 deletions
8
models/staging/hubspot/_hubspot_sources.yml
Normal file
8
models/staging/hubspot/_hubspot_sources.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
sources:
|
||||||
|
- name: hubspot
|
||||||
|
schema: sync_hubspot
|
||||||
|
tables:
|
||||||
|
- name: contacts
|
||||||
|
identifier: contacts
|
||||||
56
models/staging/hubspot/schema.yml
Normal file
56
models/staging/hubspot/schema.yml
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
models:
|
||||||
|
- name: stg_hubspot__contacts
|
||||||
|
description: "Table with contact information of user in Hubspot."
|
||||||
|
columns:
|
||||||
|
- name: id_contact
|
||||||
|
data_type: character varying
|
||||||
|
description: "Unique id for each contact information."
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: archived
|
||||||
|
data_type: boolean
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
- name: companies
|
||||||
|
data_type: jsonb
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
- name: properties
|
||||||
|
data_type: jsonb
|
||||||
|
description: "Json with all contact information for this record."
|
||||||
|
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
|
||||||
18
models/staging/hubspot/stg_hubspot__contacts.sql
Normal file
18
models/staging/hubspot/stg_hubspot__contacts.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
with
|
||||||
|
raw_contacts as (select * from {{ source("hubspot", "contacts") }}),
|
||||||
|
stg_core__contacts as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("id") }} as id_contact,
|
||||||
|
{{ adapter.quote("archived") }} as archived,
|
||||||
|
{{ adapter.quote("companies") }} as companies,
|
||||||
|
{{ 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_contacts
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_core__contacts
|
||||||
Loading…
Add table
Add a link
Reference in a new issue