From bc0d843c1d4bcd975d268db880cde16c7899df9a Mon Sep 17 00:00:00 2001 From: Aryan Verma <54755677+AryanMadhavVerma@users.noreply.github.com> Date: Wed, 28 Sep 2022 11:58:49 +0530 Subject: [PATCH] Update/metrics 0.3.5 (#22) * update to dbt_metrics_0.3.2 * update/metrics_0.3.5 Co-authored-by: Aryan Verma --- README.md | 5 +++++ models/metrics/stripe__monthly_bookings.sql | 4 ++-- models/metrics/stripe__monthly_churned_customer_revenue.sql | 4 ++-- models/metrics/stripe__monthly_churned_customers.sql | 4 ++-- models/metrics/stripe__monthly_new_customer_revenue.sql | 4 ++-- models/metrics/stripe__monthly_new_customers.sql | 4 ++-- models/metrics/stripe__monthly_platform_fees.sql | 4 ++-- .../metrics/stripe__monthly_recovered_customer_revenue.sql | 4 ++-- models/metrics/stripe__monthly_recovered_customers.sql | 4 ++-- models/metrics/stripe__mrr.sql | 4 ++-- packages.yml | 2 +- 11 files changed, 24 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7148f0e..a211956 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Stripe Metrics dbt Package ([Docs](https://housewarehq.github.io/dbt_stripe_metrics)) +# 🛑 Few things to keep in mind +These packages are under active development and are expected to change with dbt metrics as it evolves over time. As of now, dbt metrics requires users to define models to calculate metrics and these models are persisted on the warehouse. Keeping this in mind, we have currently modelled our packages such that metrics and the models calculating these metrics have a 1:1 mapping, which is why you will see multiple metrics for the same conceptual metric entity accounting for different time grains and dimensions. In future, with the roll out of dbt Server and evolution of dbt metrics, we expect to streamline our packages to remove these redundancies. + +The metrics in these packages are transformed on top of source data ETL'd via Fivetran to your warehouse. Make sure you have connected your SaaS source with Fivetran for the packages to work properly. + # 📣 What does this dbt package do? This package provides pre-built metrics for Stripe data from [Fivetran's connector](https://fivetran.com/docs/applications/stripe). It uses data in the format described by [this ERD](https://fivetran.com/docs/applications/stripe#schemainformation). diff --git a/models/metrics/stripe__monthly_bookings.sql b/models/metrics/stripe__monthly_bookings.sql index 5be63ab..99b4d25 100644 --- a/models/metrics/stripe__monthly_bookings.sql +++ b/models/metrics/stripe__monthly_bookings.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__main_transactions') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_bookings', +from {{ metrics.calculate( + metric('stripe__monthly_bookings'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_churned_customer_revenue.sql b/models/metrics/stripe__monthly_churned_customer_revenue.sql index f2a81d5..6926a20 100644 --- a/models/metrics/stripe__monthly_churned_customer_revenue.sql +++ b/models/metrics/stripe__monthly_churned_customer_revenue.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_churned_customer_revenue', +from {{ metrics.calculate( + metric('stripe__monthly_churned_customer_revenue'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_churned_customers.sql b/models/metrics/stripe__monthly_churned_customers.sql index 2b2cf9b..d6f24e9 100644 --- a/models/metrics/stripe__monthly_churned_customers.sql +++ b/models/metrics/stripe__monthly_churned_customers.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_churned_customers', +from {{ metrics.calculate( + metric('stripe__monthly_churned_customers'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_new_customer_revenue.sql b/models/metrics/stripe__monthly_new_customer_revenue.sql index 0f9f138..f25622c 100644 --- a/models/metrics/stripe__monthly_new_customer_revenue.sql +++ b/models/metrics/stripe__monthly_new_customer_revenue.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_new_customer_revenue', +from {{ metrics.calculate( + metric('stripe__monthly_new_customer_revenue'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_new_customers.sql b/models/metrics/stripe__monthly_new_customers.sql index 2b61cda..af9da4e 100644 --- a/models/metrics/stripe__monthly_new_customers.sql +++ b/models/metrics/stripe__monthly_new_customers.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_new_customers', +from {{ metrics.calculate( + metric('stripe__monthly_new_customers'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_platform_fees.sql b/models/metrics/stripe__monthly_platform_fees.sql index 280dae3..23fa578 100644 --- a/models/metrics/stripe__monthly_platform_fees.sql +++ b/models/metrics/stripe__monthly_platform_fees.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__main_transactions') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_platform_fees', +from {{ metrics.calculate( + metric('stripe__monthly_platform_fees'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_recovered_customer_revenue.sql b/models/metrics/stripe__monthly_recovered_customer_revenue.sql index cb2f593..d8e0a60 100644 --- a/models/metrics/stripe__monthly_recovered_customer_revenue.sql +++ b/models/metrics/stripe__monthly_recovered_customer_revenue.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_recovered_customer_revenue', +from {{ metrics.calculate( + metric('stripe__monthly_recovered_customer_revenue'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__monthly_recovered_customers.sql b/models/metrics/stripe__monthly_recovered_customers.sql index d599cbe..bbd2834 100644 --- a/models/metrics/stripe__monthly_recovered_customers.sql +++ b/models/metrics/stripe__monthly_recovered_customers.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__monthly_recovered_customers', +from {{ metrics.calculate( + metric('stripe__monthly_recovered_customers'), grain='month', dimensions=[], secondary_calculations=[] diff --git a/models/metrics/stripe__mrr.sql b/models/metrics/stripe__mrr.sql index 43866b8..d56821d 100644 --- a/models/metrics/stripe__mrr.sql +++ b/models/metrics/stripe__mrr.sql @@ -1,8 +1,8 @@ -- depends_on: {{ ref('stripe__monthly_customer_revenue') }} select * -from {{ metrics.metric( - metric_name='stripe__mrr', +from {{ metrics.calculate( + metric('stripe__mrr'), grain='month', dimensions=[], secondary_calculations=[metrics.rolling(aggregate="average", interval=3, alias="roll_avg_quarter")] diff --git a/packages.yml b/packages.yml index 1d5669c..3f46ba1 100644 --- a/packages.yml +++ b/packages.yml @@ -6,4 +6,4 @@ packages: version: 0.6.0 - package: dbt-labs/metrics - version: 0.1.5 + version: 0.3.5