dbt Parking reservations

Forecast Revenue

Forecast Revenue model for parking reservations.

inferred

Blocks

forecast_revenue.sql · 51 lines
inferred
-- models/forecast_revenue.sql
{{ config(materialized='table') }}

select 1154911 as forecast_gross, 148077 as forecast_net, 'transient' as parking_type, 20160105 as month_start
UNION select 1250857 as forecast_gross, 156413 as forecast_net, 'transient' as parking_type, 20160205 as month_start
UNION select 1600330 as forecast_gross, 195792 as forecast_net, 'transient' as parking_type, 20160305 as month_start
UNION select 1774422 as forecast_gross, 214844 as forecast_net, 'transient' as parking_type, 20160405 as month_start
UNION select 2032615 as forecast_gross, 246014 as forecast_net, 'transient' as parking_type, 20160505 as month_start
UNION select 2200000 as forecast_gross, 267007 as forecast_net, 'transient' as parking_type, 20160605 as month_start
UNION select 2495961 as forecast_gross, 304197 as forecast_net, 'transient' as parking_type, 20160705 as month_start
UNION select 2495013 as forecast_gross, 301473 as forecast_net, 'transient' as parking_type, 20160805 as month_start
UNION select 2547151 as forecast_gross, 306834 as forecast_net, 'transient' as parking_type, 20160905 as month_start
UNION select 2729087 as forecast_gross, 327605 as forecast_net, 'transient' as parking_type, 20161005 as month_start
UNION select 2809798 as forecast_gross, 336609 as forecast_net, 'transient' as parking_type, 20161105 as month_start
UNION select 3924674 as forecast_gross, 467891 as forecast_net, 'transient' as parking_type, 20161205 as month_start
UNION select 645518 as forecast_gross, 129717 as forecast_net, 'event' as parking_type, 20160105 as month_start
UNION select 438946 as forecast_gross, 88520 as forecast_net, 'event' as parking_type, 20160205 as month_start
UNION select 613493 as forecast_gross, 120943 as forecast_net, 'event' as parking_type, 20160305 as month_start
UNION select 1025809 as forecast_gross, 202836 as forecast_net, 'event' as parking_type, 20160405 as month_start
UNION select 1288250 as forecast_gross, 264589 as forecast_net, 'event' as parking_type, 20160505 as month_start
UNION select 1619973 as forecast_gross, 331653 as forecast_net, 'event' as parking_type, 20160605 as month_start
UNION select 2130657 as forecast_gross, 430234 as forecast_net, 'event' as parking_type, 20160705 as month_start
UNION select 2278973 as forecast_gross, 460851 as forecast_net, 'event' as parking_type, 20160805 as month_start
UNION select 2960618 as forecast_gross, 595679 as forecast_net, 'event' as parking_type, 20160905 as month_start
UNION select 3106578 as forecast_gross, 629205 as forecast_net, 'event' as parking_type, 20161005 as month_start
UNION select 3217623 as forecast_gross, 647082 as forecast_net, 'event' as parking_type, 20161105 as month_start
UNION select 3768998 as forecast_gross, 758623 as forecast_net, 'event' as parking_type, 20161205 as month_start
UNION select 111594 as forecast_gross, 44638 as forecast_net, 'monthly' as parking_type, 20160105 as month_start
UNION select 86229 as forecast_gross, 34492 as forecast_net, 'monthly' as parking_type, 20160205 as month_start
UNION select 93159 as forecast_gross, 37264 as forecast_net, 'monthly' as parking_type, 20160305 as month_start
UNION select 98872 as forecast_gross, 39549 as forecast_net, 'monthly' as parking_type, 20160405 as month_start
UNION select 131040 as forecast_gross, 52416 as forecast_net, 'monthly' as parking_type, 20160505 as month_start
UNION select 128892 as forecast_gross, 51557 as forecast_net, 'monthly' as parking_type, 20160605 as month_start
UNION select 126899 as forecast_gross, 50760 as forecast_net, 'monthly' as parking_type, 20160705 as month_start
UNION select 111341 as forecast_gross, 44536 as forecast_net, 'monthly' as parking_type, 20160805 as month_start
UNION select 106166 as forecast_gross, 42466 as forecast_net, 'monthly' as parking_type, 20160905 as month_start
UNION select 87305 as forecast_gross, 34920 as forecast_net, 'monthly' as parking_type, 20161005 as month_start
UNION select 98549 as forecast_gross, 39420 as forecast_net, 'monthly' as parking_type, 20161105 as month_start
UNION select 94376 as forecast_gross, 37750 as forecast_net, 'monthly' as parking_type, 20161205 as month_start

# models/schema.yml
version: 2

models:
  - name: forecast_revenue
    columns:
      - name: parking_type
      - name: month_parking_type
        tests:
          - unique
          - not_null

Assumptions

  • materialized='table' inferred from a LookML persist hint (persist_for / datagroup / sql_trigger_value).
  • schema.yml columns come from view dimensions; a primary_key dimension gets unique + not_null tests.
forecast_revenue.sql · 36 lines
source-preserved validation: parses
select 1154911 as forecast_gross, 148077 as forecast_net, 'transient' as parking_type, 20160105 as month_start
UNION select 1250857 as forecast_gross, 156413 as forecast_net, 'transient' as parking_type, 20160205 as month_start
UNION select 1600330 as forecast_gross, 195792 as forecast_net, 'transient' as parking_type, 20160305 as month_start
UNION select 1774422 as forecast_gross, 214844 as forecast_net, 'transient' as parking_type, 20160405 as month_start
UNION select 2032615 as forecast_gross, 246014 as forecast_net, 'transient' as parking_type, 20160505 as month_start
UNION select 2200000 as forecast_gross, 267007 as forecast_net, 'transient' as parking_type, 20160605 as month_start
UNION select 2495961 as forecast_gross, 304197 as forecast_net, 'transient' as parking_type, 20160705 as month_start
UNION select 2495013 as forecast_gross, 301473 as forecast_net, 'transient' as parking_type, 20160805 as month_start
UNION select 2547151 as forecast_gross, 306834 as forecast_net, 'transient' as parking_type, 20160905 as month_start
UNION select 2729087 as forecast_gross, 327605 as forecast_net, 'transient' as parking_type, 20161005 as month_start
UNION select 2809798 as forecast_gross, 336609 as forecast_net, 'transient' as parking_type, 20161105 as month_start
UNION select 3924674 as forecast_gross, 467891 as forecast_net, 'transient' as parking_type, 20161205 as month_start
UNION select 645518 as forecast_gross, 129717 as forecast_net, 'event' as parking_type, 20160105 as month_start
UNION select 438946 as forecast_gross, 88520 as forecast_net, 'event' as parking_type, 20160205 as month_start
UNION select 613493 as forecast_gross, 120943 as forecast_net, 'event' as parking_type, 20160305 as month_start
UNION select 1025809 as forecast_gross, 202836 as forecast_net, 'event' as parking_type, 20160405 as month_start
UNION select 1288250 as forecast_gross, 264589 as forecast_net, 'event' as parking_type, 20160505 as month_start
UNION select 1619973 as forecast_gross, 331653 as forecast_net, 'event' as parking_type, 20160605 as month_start
UNION select 2130657 as forecast_gross, 430234 as forecast_net, 'event' as parking_type, 20160705 as month_start
UNION select 2278973 as forecast_gross, 460851 as forecast_net, 'event' as parking_type, 20160805 as month_start
UNION select 2960618 as forecast_gross, 595679 as forecast_net, 'event' as parking_type, 20160905 as month_start
UNION select 3106578 as forecast_gross, 629205 as forecast_net, 'event' as parking_type, 20161005 as month_start
UNION select 3217623 as forecast_gross, 647082 as forecast_net, 'event' as parking_type, 20161105 as month_start
UNION select 3768998 as forecast_gross, 758623 as forecast_net, 'event' as parking_type, 20161205 as month_start
UNION select 111594 as forecast_gross, 44638 as forecast_net, 'monthly' as parking_type, 20160105 as month_start
UNION select 86229 as forecast_gross, 34492 as forecast_net, 'monthly' as parking_type, 20160205 as month_start
UNION select 93159 as forecast_gross, 37264 as forecast_net, 'monthly' as parking_type, 20160305 as month_start
UNION select 98872 as forecast_gross, 39549 as forecast_net, 'monthly' as parking_type, 20160405 as month_start
UNION select 131040 as forecast_gross, 52416 as forecast_net, 'monthly' as parking_type, 20160505 as month_start
UNION select 128892 as forecast_gross, 51557 as forecast_net, 'monthly' as parking_type, 20160605 as month_start
UNION select 126899 as forecast_gross, 50760 as forecast_net, 'monthly' as parking_type, 20160705 as month_start
UNION select 111341 as forecast_gross, 44536 as forecast_net, 'monthly' as parking_type, 20160805 as month_start
UNION select 106166 as forecast_gross, 42466 as forecast_net, 'monthly' as parking_type, 20160905 as month_start
UNION select 87305 as forecast_gross, 34920 as forecast_net, 'monthly' as parking_type, 20161005 as month_start
UNION select 98549 as forecast_gross, 39420 as forecast_net, 'monthly' as parking_type, 20161105 as month_start
UNION select 94376 as forecast_gross, 37750 as forecast_net, 'monthly' as parking_type, 20161205 as month_start
forecast_revenue.view.lkml · 73 lines
inferred
view: forecast_revenue {
  derived_table: {
    sql: select 1154911 as forecast_gross, 148077 as forecast_net, 'transient' as parking_type, 20160105 as month_start
UNION select 1250857 as forecast_gross, 156413 as forecast_net, 'transient' as parking_type, 20160205 as month_start
UNION select 1600330 as forecast_gross, 195792 as forecast_net, 'transient' as parking_type, 20160305 as month_start
UNION select 1774422 as forecast_gross, 214844 as forecast_net, 'transient' as parking_type, 20160405 as month_start
UNION select 2032615 as forecast_gross, 246014 as forecast_net, 'transient' as parking_type, 20160505 as month_start
UNION select 2200000 as forecast_gross, 267007 as forecast_net, 'transient' as parking_type, 20160605 as month_start
UNION select 2495961 as forecast_gross, 304197 as forecast_net, 'transient' as parking_type, 20160705 as month_start
UNION select 2495013 as forecast_gross, 301473 as forecast_net, 'transient' as parking_type, 20160805 as month_start
UNION select 2547151 as forecast_gross, 306834 as forecast_net, 'transient' as parking_type, 20160905 as month_start
UNION select 2729087 as forecast_gross, 327605 as forecast_net, 'transient' as parking_type, 20161005 as month_start
UNION select 2809798 as forecast_gross, 336609 as forecast_net, 'transient' as parking_type, 20161105 as month_start
UNION select 3924674 as forecast_gross, 467891 as forecast_net, 'transient' as parking_type, 20161205 as month_start
UNION select 645518 as forecast_gross, 129717 as forecast_net, 'event' as parking_type, 20160105 as month_start
UNION select 438946 as forecast_gross, 88520 as forecast_net, 'event' as parking_type, 20160205 as month_start
UNION select 613493 as forecast_gross, 120943 as forecast_net, 'event' as parking_type, 20160305 as month_start
UNION select 1025809 as forecast_gross, 202836 as forecast_net, 'event' as parking_type, 20160405 as month_start
UNION select 1288250 as forecast_gross, 264589 as forecast_net, 'event' as parking_type, 20160505 as month_start
UNION select 1619973 as forecast_gross, 331653 as forecast_net, 'event' as parking_type, 20160605 as month_start
UNION select 2130657 as forecast_gross, 430234 as forecast_net, 'event' as parking_type, 20160705 as month_start
UNION select 2278973 as forecast_gross, 460851 as forecast_net, 'event' as parking_type, 20160805 as month_start
UNION select 2960618 as forecast_gross, 595679 as forecast_net, 'event' as parking_type, 20160905 as month_start
UNION select 3106578 as forecast_gross, 629205 as forecast_net, 'event' as parking_type, 20161005 as month_start
UNION select 3217623 as forecast_gross, 647082 as forecast_net, 'event' as parking_type, 20161105 as month_start
UNION select 3768998 as forecast_gross, 758623 as forecast_net, 'event' as parking_type, 20161205 as month_start
UNION select 111594 as forecast_gross, 44638 as forecast_net, 'monthly' as parking_type, 20160105 as month_start
UNION select 86229 as forecast_gross, 34492 as forecast_net, 'monthly' as parking_type, 20160205 as month_start
UNION select 93159 as forecast_gross, 37264 as forecast_net, 'monthly' as parking_type, 20160305 as month_start
UNION select 98872 as forecast_gross, 39549 as forecast_net, 'monthly' as parking_type, 20160405 as month_start
UNION select 131040 as forecast_gross, 52416 as forecast_net, 'monthly' as parking_type, 20160505 as month_start
UNION select 128892 as forecast_gross, 51557 as forecast_net, 'monthly' as parking_type, 20160605 as month_start
UNION select 126899 as forecast_gross, 50760 as forecast_net, 'monthly' as parking_type, 20160705 as month_start
UNION select 111341 as forecast_gross, 44536 as forecast_net, 'monthly' as parking_type, 20160805 as month_start
UNION select 106166 as forecast_gross, 42466 as forecast_net, 'monthly' as parking_type, 20160905 as month_start
UNION select 87305 as forecast_gross, 34920 as forecast_net, 'monthly' as parking_type, 20161005 as month_start
UNION select 98549 as forecast_gross, 39420 as forecast_net, 'monthly' as parking_type, 20161105 as month_start
UNION select 94376 as forecast_gross, 37750 as forecast_net, 'monthly' as parking_type, 20161205 as month_start ;;
    persist_for: "12 hours"
  }

  dimension: parking_type {
    type: string
    sql: ${TABLE}.parking_type ;;
  }

  dimension: month_parking_type {
    primary_key: yes
    hidden: yes
    sql: ${TABLE}.month_start||${TABLE}.parking_type ;;
  }

  dimension_group: month_start {
    type: time
    timeframes: [date, month]
    sql: to_date(month_start, 'YYYYMMDD') ;;
  }

  measure: count {
    type: count
    drill_fields: [detail*]
  }

  measure: forecast_gross {
    type: sum
    sql: ${TABLE}.forecast_gross ;;
  }

  measure: forecast_net {
    type: sum
    sql: ${TABLE}.forecast_net ;;
  }
}
forecast_revenue.view.lookml · 63 lines
source-preserved
- view: forecast_revenue
  derived_table:
    sql: select 1154911 as forecast_gross, 148077 as forecast_net, 'transient' as parking_type, 20160105 as month_start
UNION select 1250857 as forecast_gross, 156413 as forecast_net, 'transient' as parking_type, 20160205 as month_start
UNION select 1600330 as forecast_gross, 195792 as forecast_net, 'transient' as parking_type, 20160305 as month_start
UNION select 1774422 as forecast_gross, 214844 as forecast_net, 'transient' as parking_type, 20160405 as month_start
UNION select 2032615 as forecast_gross, 246014 as forecast_net, 'transient' as parking_type, 20160505 as month_start
UNION select 2200000 as forecast_gross, 267007 as forecast_net, 'transient' as parking_type, 20160605 as month_start
UNION select 2495961 as forecast_gross, 304197 as forecast_net, 'transient' as parking_type, 20160705 as month_start
UNION select 2495013 as forecast_gross, 301473 as forecast_net, 'transient' as parking_type, 20160805 as month_start
UNION select 2547151 as forecast_gross, 306834 as forecast_net, 'transient' as parking_type, 20160905 as month_start
UNION select 2729087 as forecast_gross, 327605 as forecast_net, 'transient' as parking_type, 20161005 as month_start
UNION select 2809798 as forecast_gross, 336609 as forecast_net, 'transient' as parking_type, 20161105 as month_start
UNION select 3924674 as forecast_gross, 467891 as forecast_net, 'transient' as parking_type, 20161205 as month_start
UNION select 645518 as forecast_gross, 129717 as forecast_net, 'event' as parking_type, 20160105 as month_start
UNION select 438946 as forecast_gross, 88520 as forecast_net, 'event' as parking_type, 20160205 as month_start
UNION select 613493 as forecast_gross, 120943 as forecast_net, 'event' as parking_type, 20160305 as month_start
UNION select 1025809 as forecast_gross, 202836 as forecast_net, 'event' as parking_type, 20160405 as month_start
UNION select 1288250 as forecast_gross, 264589 as forecast_net, 'event' as parking_type, 20160505 as month_start
UNION select 1619973 as forecast_gross, 331653 as forecast_net, 'event' as parking_type, 20160605 as month_start
UNION select 2130657 as forecast_gross, 430234 as forecast_net, 'event' as parking_type, 20160705 as month_start
UNION select 2278973 as forecast_gross, 460851 as forecast_net, 'event' as parking_type, 20160805 as month_start
UNION select 2960618 as forecast_gross, 595679 as forecast_net, 'event' as parking_type, 20160905 as month_start
UNION select 3106578 as forecast_gross, 629205 as forecast_net, 'event' as parking_type, 20161005 as month_start
UNION select 3217623 as forecast_gross, 647082 as forecast_net, 'event' as parking_type, 20161105 as month_start
UNION select 3768998 as forecast_gross, 758623 as forecast_net, 'event' as parking_type, 20161205 as month_start
UNION select 111594 as forecast_gross, 44638 as forecast_net, 'monthly' as parking_type, 20160105 as month_start
UNION select 86229 as forecast_gross, 34492 as forecast_net, 'monthly' as parking_type, 20160205 as month_start
UNION select 93159 as forecast_gross, 37264 as forecast_net, 'monthly' as parking_type, 20160305 as month_start
UNION select 98872 as forecast_gross, 39549 as forecast_net, 'monthly' as parking_type, 20160405 as month_start
UNION select 131040 as forecast_gross, 52416 as forecast_net, 'monthly' as parking_type, 20160505 as month_start
UNION select 128892 as forecast_gross, 51557 as forecast_net, 'monthly' as parking_type, 20160605 as month_start
UNION select 126899 as forecast_gross, 50760 as forecast_net, 'monthly' as parking_type, 20160705 as month_start
UNION select 111341 as forecast_gross, 44536 as forecast_net, 'monthly' as parking_type, 20160805 as month_start
UNION select 106166 as forecast_gross, 42466 as forecast_net, 'monthly' as parking_type, 20160905 as month_start
UNION select 87305 as forecast_gross, 34920 as forecast_net, 'monthly' as parking_type, 20161005 as month_start
UNION select 98549 as forecast_gross, 39420 as forecast_net, 'monthly' as parking_type, 20161105 as month_start
UNION select 94376 as forecast_gross, 37750 as forecast_net, 'monthly' as parking_type, 20161205 as month_start
    persist_for: 12 hours
  fields:
  - dimension: parking_type
    type: string
    sql: ${TABLE}.parking_type
  - dimension: month_parking_type
    primary_key: true
    hidden: true
    sql: ${TABLE}.month_start||${TABLE}.parking_type
  - dimension_group: month_start
    type: time
    timeframes:
    - date
    - month
    sql: to_date(month_start, 'YYYYMMDD')
  - measure: count
    type: count
    drill_fields:
    - detail*
  - measure: forecast_gross
    type: sum
    sql: ${TABLE}.forecast_gross
  - measure: forecast_net
    type: sum
    sql: ${TABLE}.forecast_net

Contents

  • forecast_revenue.sql
  • forecast_revenue.sql
  • forecast_revenue.view.lkml
  • forecast_revenue.view.lookml