From 15bfdfe8e5dca3d9b12522d3bc265c312a341dd9 Mon Sep 17 00:00:00 2001 From: btkcodedev Date: Sun, 8 Sep 2024 18:51:45 +0530 Subject: [PATCH] fix models --- .../models/fivetran_converter/contact.sql | 2 +- .../fivetran_converter/contact_property_history.sql | 2 +- .../models/fivetran_converter/email_events.sql | 12 ++++++------ .../models/fivetran_converter/engagement_call.sql | 2 +- .../models/fivetran_converter/engagement_email.sql | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/connectors/source_hubspot/models/fivetran_converter/contact.sql b/connectors/source_hubspot/models/fivetran_converter/contact.sql index bf6a581..867a392 100644 --- a/connectors/source_hubspot/models/fivetran_converter/contact.sql +++ b/connectors/source_hubspot/models/fivetran_converter/contact.sql @@ -1,7 +1,7 @@ SELECT id AS contact_id, - _fivetran_deleted AS is_contact_deleted, + properties_hs_is_contact AS is_contact_deleted, properties_hs_calculated_merged_vids AS calculated_merged_vids, properties_email AS email, properties_company AS contact_company, diff --git a/connectors/source_hubspot/models/fivetran_converter/contact_property_history.sql b/connectors/source_hubspot/models/fivetran_converter/contact_property_history.sql index ecdd9f7..c72691f 100644 --- a/connectors/source_hubspot/models/fivetran_converter/contact_property_history.sql +++ b/connectors/source_hubspot/models/fivetran_converter/contact_property_history.sql @@ -1,6 +1,6 @@ SELECT {{ dbt.current_timestamp() }} AS _fivetran_synced, - canonical-vid AS contact_id, + source_id AS contact_id, name AS field_name, source AS change_source, source_id AS change_source_id, diff --git a/connectors/source_hubspot/models/fivetran_converter/email_events.sql b/connectors/source_hubspot/models/fivetran_converter/email_events.sql index 672eafe..023bfb5 100644 --- a/connectors/source_hubspot/models/fivetran_converter/email_events.sql +++ b/connectors/source_hubspot/models/fivetran_converter/email_events.sql @@ -3,8 +3,8 @@ SELECT {{ dbt.current_timestamp() }} AS _fivetran_synced, "appId" AS app_id, - CAST(caused_by->>'created' AS {{ dbt.type_timestamp() }}) AS caused_timestamp, - caused_by->>'id' AS caused_by_event_id, + CAST(causedBy->>'created' AS {{ dbt.type_timestamp() }}) AS caused_timestamp, + causedBy->>'id' AS caused_by_event_id, CAST(created AS {{ dbt.type_timestamp() }}) AS created_timestamp, "emailCampaignId" AS email_campaign_id, "filteredEvent" AS is_filtered_event, @@ -24,8 +24,8 @@ FROM SELECT {{ dbt.current_timestamp() }} AS _fivetran_synced, appId AS app_id, - CAST(caused_by:created AS {{ dbt.type_timestamp() }}) AS caused_timestamp, - caused_by:id AS caused_by_event_id, + CAST(causedBy:created AS {{ dbt.type_timestamp() }}) AS caused_timestamp, + causedBy:id AS caused_by_event_id, CAST(created AS {{ dbt.type_timestamp() }}) AS created_timestamp, emailCampaignId AS email_campaign_id, filteredEvent AS is_filtered_event, @@ -45,8 +45,8 @@ FROM SELECT {{ dbt.current_timestamp() }} AS _fivetran_synced, appId AS app_id, - CAST(JSON_EXTRACT_SCALAR(caused_by, '$.created') AS {{ dbt.type_timestamp() }}) AS caused_timestamp, - JSON_EXTRACT_SCALAR(caused_by, '$.id') AS caused_by_event_id, + CAST(JSON_EXTRACT_SCALAR(causedBy, '$.created') AS {{ dbt.type_timestamp() }}) AS caused_timestamp, + JSON_EXTRACT_SCALAR(causedBy, '$.id') AS caused_by_event_id, CAST(created AS {{ dbt.type_timestamp() }}) AS created_timestamp, emailCampaignId AS email_campaign_id, filteredEvent AS is_filtered_event, diff --git a/connectors/source_hubspot/models/fivetran_converter/engagement_call.sql b/connectors/source_hubspot/models/fivetran_converter/engagement_call.sql index 237a54d..fe4c34e 100644 --- a/connectors/source_hubspot/models/fivetran_converter/engagement_call.sql +++ b/connectors/source_hubspot/models/fivetran_converter/engagement_call.sql @@ -1,6 +1,6 @@ SELECT {{ dbt.current_timestamp() }} AS _fivetran_synced, - COALESCE(_fivetran_deleted, FALSE) AS _fivetran_deleted, + 'FALSE' AS _fivetran_deleted, id AS engagement_id, 'CALL' AS engagement_type, createdAt AS created_timestamp, diff --git a/connectors/source_hubspot/models/fivetran_converter/engagement_email.sql b/connectors/source_hubspot/models/fivetran_converter/engagement_email.sql index e143fd0..d9822ff 100644 --- a/connectors/source_hubspot/models/fivetran_converter/engagement_email.sql +++ b/connectors/source_hubspot/models/fivetran_converter/engagement_email.sql @@ -1,6 +1,6 @@ SELECT {{ dbt.current_timestamp() }} AS _fivetran_synced, - COALESCE(_fivetran_deleted, FALSE) AS _fivetran_deleted, + 'FALSE' AS _fivetran_deleted, 'EMAIL' AS engagement_type, id AS engagement_id, createdAt AS created_timestamp,