From 9ba77d3c27ae4cd446f49b6a29ac9925361d1e8e Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:44:06 -0600 Subject: [PATCH] review/jm-final --- .quickstart/quickstart.yml | 18 ++++++++++++++++++ CHANGELOG.md | 3 +-- README.md | 2 +- ...ce_marketing_cloud__subscriber_overview.sql | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 .quickstart/quickstart.yml diff --git a/.quickstart/quickstart.yml b/.quickstart/quickstart.yml new file mode 100644 index 0000000..3ee9bb5 --- /dev/null +++ b/.quickstart/quickstart.yml @@ -0,0 +1,18 @@ +database_key: salesforce_marketing_cloud_database +schema_key: salesforce_marketing_cloud_schema + +dbt_versions: ">=1.3.0 <2.0.0" + +table_variables: + salesforce_marketing_cloud__link_enabled: + - link_send + - link + salesforce_marketing_cloud__list_enabled: + - list_subscriber + - list + +destination_configurations: + databricks: + dispatch: + - macro_namespace: dbt_utils + search_order: [ 'spark_utils', 'dbt_utils' ] \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 694d7ad..f494fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,7 @@ This package models Salesforce Marketing Cloud data from [Fivetran's connector](https://fivetran.com/docs/applications/salesforce_marketing_cloud). It uses data in the format described by [this ERD](https://fivetran.com/docs/applications/salesforce_marketing_cloud#schemainformation). The main focus of the package is to transform the core object tables into analytics-ready models: - - - Materializes [Salesforce Marketing Cloud staging tables](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/overview/salesforce_marketing_cloud_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/salesforce_marketing_cloud/#schemainformation). The staging tables clean, test, and prepare your Salesforce Marketing Cloud data from [Fivetran's connector](https://fivetran.com/docs/applications/salesforce_marketing_cloud_source) for analysis by doing the following: + - Materializes [Salesforce Marketing Cloud staging tables](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/overview/salesforce_marketing_cloud/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/salesforce_marketing_cloud/#schemainformation). The staging tables clean, test, and prepare your Salesforce Marketing Cloud data from [Fivetran's connector](https://fivetran.com/docs/applications/salesforce_marketing_cloud) for analysis by doing the following: - Primary keys are renamed from `id` to `_id`. - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. - Provides insight into your Salesforce Marketing Cloud data across the following grains: diff --git a/README.md b/README.md index 6ed121e..9702114 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The following table provides a detailed list of all models materialized within t | **model** | **description**| | --------- | -------------- | | [salesforce_marketing_cloud__email_overview](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/model/model.salesforce_marketing_cloud.salesforce_marketing_cloud__email_overview) | Each record provides the performance of an email via `total_*` and `*_rate` metrics. | -| [salesforce_marketing_cloud__events_enhanced](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/model/model.salesforce_marketing_cloud.salesforce_marketing_cloud__event_enhanced) | Each record expands the source events information by pivoting the `event_type` options into boolean fields. Each record also has related send and email information added. | +| [salesforce_marketing_cloud__events_enhanced](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/model/model.salesforce_marketing_cloud.salesforce_marketing_cloud__events_enhanced) | Each record expands the source events information by pivoting the `event_type` options into boolean fields. Each record also has related send and email information added. | | [salesforce_marketing_cloud__sends_links](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/model/model.salesforce_marketing_cloud.salesforce_marketing_cloud__sends_links) | Each record provides a link, joined with all corresponding send(s). | | [salesforce_marketing_cloud__sends_overview](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/model/model.salesforce_marketing_cloud.salesforce_marketing_cloud__sends_overview) | Each record provides the performance of a send via `total_*` and `*_rate` metrics. | | [salesforce_marketing_cloud__subscriber_lists](https://fivetran.github.io/dbt_salesforce_marketing_cloud/#!/model/model.salesforce_marketing_cloud.salesforce_marketing_cloud__subscriber_lists) | Each record provides a list, joined with all corresponding subscriber(s). | diff --git a/models/salesforce_marketing_cloud__subscriber_overview.sql b/models/salesforce_marketing_cloud__subscriber_overview.sql index a930063..bb4bc11 100644 --- a/models/salesforce_marketing_cloud__subscriber_overview.sql +++ b/models/salesforce_marketing_cloud__subscriber_overview.sql @@ -21,7 +21,7 @@ with subscribers as ( case when subscribers.unsubscribed_date is not null then {{ dbt.datediff("subscribers.created_date", "subscribers.unsubscribed_date", "day") }} else {{ dbt.datediff("subscribers.created_date", "current_date", "day") }} - end as days_subscribed, + end as days_subscribed, sum(case when events_enhanced.is_sent then 1 else 0 end) as number_of_sends, max(case when events_enhanced.is_sent then events_enhanced.event_date end) as most_recent_send, sum(case when events_enhanced.is_open then 1 else 0 end) as number_of_opens,