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/demo_examples/materialization_incremental.sql b/models/demo_examples/materialization_incremental.sql deleted file mode 100644 index 024a433..0000000 --- a/models/demo_examples/materialization_incremental.sql +++ /dev/null @@ -1,32 +0,0 @@ -{{ config(materialized='incremental') }} - -with source as ( - - select * from {{ source('tpch', 'customer') }} - -), - - -renamed as ( - - select - c_custkey as customer_key, - c_name as name, - c_address as address, - c_nationkey as nation_key, - c_phone as phone_number, - c_acctbal as account_balance, - c_mktsegment as market_segment, - c_comment as comment - - from source - -) - -select * from renamed - -{% if is_incremental() %} - -- this filter will only be applied on an incremental run - where customer_key not in (select customer_key from {{this}} ) - -{% endif %} \ No newline at end of file diff --git a/models/demo_examples/python/forecast_daily_returns.py b/models/demo_examples/python/forecast_daily_returns.py index 07bc898..d09524f 100644 --- a/models/demo_examples/python/forecast_daily_returns.py +++ b/models/demo_examples/python/forecast_daily_returns.py @@ -5,7 +5,7 @@ def model( dbt, session ): dbt.config( materialized="table", - packages=['pandas','Prophet'] # how to import python libraries in dbt's context + packages=['pandas','Prophet','holidays==0.18'] # how to import python libraries in dbt's context ) # use historical data to fit model 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/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