Skip to content

Commit

Permalink
Merge pull request #6 from MisterClean/bugfix/trycast-on-revenue-metrics
Browse files Browse the repository at this point in the history
Bugfix/trycast on revenue metrics
  • Loading branch information
fivetran-joemarkiewicz authored May 4, 2022
2 parents f137de1 + 321eee8 commit ae60f82
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# dbt_shopify_holistic_reporting v0.1.1
## Bug Fixes
Incorporate the try_cast macro from fivetran_utils to ensure that the numeric_value field in int__daily_klaviyo_user_metrics is the same data type as '0'. ([#6](https://github.com/fivetran/dbt_shopify_holistic_reporting/pull/6))

## Contributors
- [@MisterClean](https://github.com/MisterClean) ([#6](https://github.com/fivetran/dbt_shopify_holistic_reporting/pull/6))


# dbt_shopify_holistic_reporting v0.1.0

The original release! This package currently models Shopify and Klaviyo data to achieve the following:
- Tie e-commerce revenue to your email and SMS marketing via last-touch attribution.
- Consolidate customers, their information, and activity across platforms.
- Create a rich portrait of customer personas based on how customers are engaging with and responding to specific marketing efforts.

This package works off of dependencies on Fivetran's individual [Shopify](https://github.com/fivetran/dbt_shopify) and [Klaviyo](https://github.com/fivetran/dbt_klaviyo) dbt packages.
This package works off of dependencies on Fivetran's individual [Shopify](https://github.com/fivetran/dbt_shopify) and [Klaviyo](https://github.com/fivetran/dbt_klaviyo) dbt packages.
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'shopify_holistic_reporting'
version: '0.1.0'
version: '0.1.1'
config-version: 2

require-dbt-version: [">=1.0.0", "<2.0.0"]
Expand Down Expand Up @@ -43,4 +43,4 @@ vars:
- 'Placed Order'
- 'Ordered Product'
- 'checkout started'
- 'cancelled order'
- 'cancelled order'
4 changes: 2 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'shopify_holistic_reporting_integration_tests'
version: '0.1.0'
version: '0.1.1'
profile: 'integration_tests'
config-version: 2

Expand Down Expand Up @@ -149,4 +149,4 @@ seeds:
event:
+column_types:
flow_id: "{{ 'string' if target.type in ('bigquery', 'spark') else 'varchar' }}"
campaign_id: "{{ 'string' if target.type in ('bigquery', 'spark') else 'varchar' }}"
campaign_id: "{{ 'string' if target.type in ('bigquery', 'spark') else 'varchar' }}"
6 changes: 4 additions & 2 deletions models/intermediate/int__daily_klaviyo_user_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ with events as (

-- sum up the numeric value associated with events (most likely will mean revenue)
{% for rm in var('klaviyo__sum_revenue_metrics') %}
, sum(case when lower(type) = '{{ rm | lower }}' then numeric_value else 0 end)
, sum(case when lower(type) = '{{ rm | lower }}' then
coalesce({{ fivetran_utils.try_cast("numeric_value", "numeric") }}, 0)
else 0 end)
as {{ 'sum_revenue_' ~ rm | replace(' ', '_') | replace('(', '') | replace(')', '') | lower }} -- removing special characters that I have seen in different integration events
{% endfor %}

Expand All @@ -37,4 +39,4 @@ with events as (

-- the grain will be person-flow-campaign-variation-day
select *
from pivot_out_events
from pivot_out_events

0 comments on commit ae60f82

Please sign in to comment.