From efb66e8a9d8b71cebc2c79b45070dd57e8943386 Mon Sep 17 00:00:00 2001 From: Taylor Dunlap Date: Tue, 22 Aug 2023 19:49:46 +0000 Subject: [PATCH] making change --- analyses/metric_query.sql | 6 -- models/metrics/metrics.yml | 61 ------------- models/metrics/reporting_metrics.yml | 99 ---------------------- models/staging/tpch/stg_tpch_customers.sql | 7 ++ packages.yml | 4 +- 5 files changed, 8 insertions(+), 169 deletions(-) delete mode 100644 analyses/metric_query.sql delete mode 100644 models/metrics/metrics.yml delete mode 100644 models/metrics/reporting_metrics.yml diff --git a/analyses/metric_query.sql b/analyses/metric_query.sql deleted file mode 100644 index e8eaec3..0000000 --- a/analyses/metric_query.sql +++ /dev/null @@ -1,6 +0,0 @@ -select * -from {{ metrics.calculate( - metric('revenue'), - grain='week', - dimensions=['status_code', 'priority_code'] -) }} \ No newline at end of file diff --git a/models/metrics/metrics.yml b/models/metrics/metrics.yml deleted file mode 100644 index 8f11899..0000000 --- a/models/metrics/metrics.yml +++ /dev/null @@ -1,61 +0,0 @@ - -version: 2 - -metrics: - - name: revenue - label: Revenue - model: ref('fct_orders') - description: "Income from all orders less tax" - - type: sum - sql: gross_item_sales_amount - item_tax_amount - - timestamp: order_date - time_grains: [day, week, month, quarter, year] - - dimensions: - - status_code - - priority_code - - - name: customers - label: Customers - model: ref('fct_orders') - description: "Number of customers with a sale" - - type: count_distinct - sql: customer_key - - timestamp: order_date - time_grains: [day, week, month, quarter, year] - - dimensions: - - priority_code - - - name: discounts - label: Discounts - model: ref('fct_orders') - description: "Total discount amount per order" - - type: sum - sql: item_discount_amount - - timestamp: order_date - time_grains: [day, week, month, quarter, year] - - dimensions: - - status_code - - priority_code - - - name: gross_profit - label: Gross Profit - description: "Revenue minus expenses" - - type: expression - sql: "{{ metric('revenue') }} - {{ metric('discounts') }}" - - timestamp: ordered_date - time_grains: [day, week, month, quarter, year] - - dimensions: - - status_code - - priority_code diff --git a/models/metrics/reporting_metrics.yml b/models/metrics/reporting_metrics.yml deleted file mode 100644 index f4118d1..0000000 --- a/models/metrics/reporting_metrics.yml +++ /dev/null @@ -1,99 +0,0 @@ - -version: 2 - -metrics: - -# Gross Revenue Metric - - name: gross_revenue - label: Gross Revenue - model: ref('curated_revenue_table') - description: "Gross revenue from all orders" - - type: sum - sql: gross_revenue - - timestamp: order_date - time_grains: [month, quarter, year] - - dimensions: - - region_name - - nation_key - - - filters: - - field: order_date - operator: '>=' - value: "'1993-01-01'" - - field: order_date - operator: '<=' - value: "'1997-12-31'" - - meta: - team: Finance - -# Cost of Goods Sold Metric - - name: cogs - label: Cost of Goods Sold - model: ref('curated_revenue_table') - description: "COGS from all orders" - - type: sum - sql: cost_of_goods_sold - - timestamp: order_date - time_grains: [month, quarter, year] - - dimensions: - - region_name - - nation_key - - - filters: - - field: order_date - operator: '>=' - value: "'1993-01-01'" - - field: order_date - operator: '<=' - value: "'1997-12-31'" - - - -# Net Profit Metric One - - name: net_profit_one - label: Net Profit One - model: ref('curated_revenue_table') - description: "Calculting Net Profit Way One" - - type: sum - sql: gross_revenue - cost_of_goods_sold - - timestamp: order_date - time_grains: [month, quarter, year] - - dimensions: - - region_name - - nation_key - - - filters: - - field: order_date - operator: '>=' - value: "'1993-01-01'" - - field: order_date - operator: '<=' - value: "'1997-12-31'" - -# Net Profit Metric Two (showing derived metrics) - - name: net_profit_two - label: Net Profit Two - description: "Calculting Net Profit Way Two" - - type: derived - sql: "{{metric('gross_revenue')}} - {{metric('cogs')}}" - - timestamp: order_date - time_grains: [month, quarter, year] - - dimensions: - - region_name - - nation_key \ No newline at end of file diff --git a/models/staging/tpch/stg_tpch_customers.sql b/models/staging/tpch/stg_tpch_customers.sql index ffa7c9b..933324b 100644 --- a/models/staging/tpch/stg_tpch_customers.sql +++ b/models/staging/tpch/stg_tpch_customers.sql @@ -1,3 +1,10 @@ +{{ + config( + materialized='table' + ,post_hook="Select * from foobar" + ) +}} + with source as ( select * from {{ source('tpch', 'customer') }} diff --git a/packages.yml b/packages.yml index 81be1d9..976ad58 100644 --- a/packages.yml +++ b/packages.yml @@ -8,6 +8,4 @@ packages: - package: tnightengale/dbt_meta_testing version: 0.3.5 - package: brooklyn-data/dbt_artifacts - version: 1.1.2 - - package: dbt-labs/metrics - version: 1.4.1 \ No newline at end of file + version: 1.1.2 \ No newline at end of file