version: 2
sources:
- name: youtube_monthly
  database: facts
  schema: prod
  tables:

  - name: staging_raw_youtube_monthly_label_ap_report #Youtube_ad_supported_ajustment_legacy_report
    description: Youtube CMS report from files like "YouTube_263000_theorchardmusic_label_AP_20220801_report.csv"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_adjustment_red_music_rawdata_video_v1_1__video_claim_raw_report
    description: Youtube CMS report "Video Claim Raw Report" from files like "YouTube_dmgi_M_20220801_20220831_adjustment_red_music_rawdata_video_v1-1.csv.gz" #Entertainment CMS Subscription Adjustment revenue
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_rawdata_video_v1_1__video_claim_raw_report
    description: Youtube CMS report "Video Claim Raw Report" from files like "YouTube_dmgi_M_20220801_20220831_red_rawdata_video_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_music_rawdata_video_v1_1__video_claim_raw_report
    description: Youtube CMS report "Video Claim Raw Report" from files like "YouTube_dmgi_M_20220801_20220831_red_music_rawdata_video_v1-1.csv.gz"
    freshness:
          warn_after: { count: 31, period: day }
          error_after: { count: 35, period: day }
          filter: download_date >= current_date()-15
    loaded_at_field: TO_TIMESTAMP(download_date)
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_summary_v1_1__non_music_summary
    description: Youtube CMS report "Non Music Summary" from files like "YouTube_dmgi_M_20220801_20220831_red_summary_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_summary_v1_1__music_summary
    description: Youtube CMS report "Music Summary" from files like "YouTube_dmgi_M_20220801_20220831_red_summary_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_adjustment_red_rawdata_video_v1_1__video_claim_raw_report
    description: Youtube CMS report "Video Claim Raw Report" from files like "YouTube_theorchardmusic_M_20220801_20220831_adjustment_red_rawdata_video_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_videoclaim_rawdata_v1_0
    description: Youtube CMS report from files like "YouTube_theorchardmusic_M_20220801_20220831_videoclaim_rawdata_v1-0.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_adj_claim_summary_v1_1
    description: Youtube CMS report from files like "YouTube_theorchardmusic_M_20220801_ADJ_claim_summary_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_adjustment_red_label_rawdata_video_v1_1__video_claim_raw_report
    description: Youtube CMS report "Video Claim Raw Report" from files like "YouTube_theorchardmusic_M_20220801_20220831_adjustment_red_label_rawdata_video_v1-1.csv.gz" #Subscription adjustment raw data
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_rawdata_v1_0
    description: Youtube CMS report from files like "YouTube_theorchardmusic_M_20220801_20220831_rawdata_v1-0.csv.gz"
    freshness:
          warn_after: { count: 31, period: day }
          error_after: { count: 35, period: day }
          filter: download_date >= current_date()-15
    loaded_at_field: TO_TIMESTAMP(download_date)
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_label_rawdata_video_v1_1__video_claim_raw_report
    description: Youtube CMS report "Video Claim Raw Report" from files like "YouTube_theorchardmusic_M_20220801_20220831_red_label_rawdata_video_v1-1.csv.gz"
    freshness:
          warn_after: { count: 31, period: day }
          error_after: { count: 35, period: day }
          filter: download_date >= current_date()-15
    loaded_at_field: TO_TIMESTAMP(download_date)
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_label_summary_v1_1__subscriber_summary
    description: Youtube CMS report "Subscriber Summary" from files like "YouTube_theorchardmusic_M_20220801_20220831_red_label_summary_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_label_summary_v1_1__music_summary
    description: Youtube CMS report "Music Summary" from files like "YouTube_theorchardmusic_M_20220801_20220831_red_label_summary_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_red_label_summary_v1_1__non_music_summary
    description: Youtube CMS report "Non Music Summary" from files like "YouTube_theorchardmusic_M_20220801_20220831_red_label_summary_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_adj_video_raw_v1_1
    description: Youtube CMS report from files like "YouTube_theorchardmusic_M_20220801_ADJ_video_raw_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_asset_report
    description: Youtube asset report from files like "content_owner_asset_a2"
    freshness:
          warn_after: { count: 1, period: day }
          error_after: { count: 3, period: day }
          filter: download_date >= current_date()-10
    loaded_at_field: TO_TIMESTAMP(download_date)
    tests:
    - not_transient:
        config:
          severity: warn
    - has_data
    - clustered:
        by: download_date
        config:
          severity: warn

  - name: staging_raw_youtube_monthly_adj_claim_raw_v1_1
    description: Youtube CMS report from files like "YouTube_theorchardmusic_M_20220801_ADJ_claim_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_adj_claim_raw_v1_1_dmgi
    description: Youtube CMS report from files like "YouTube_dgmi_M_20220801_ADJ_claim_v1-1.csv.gz"
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date

  - name: staging_raw_youtube_monthly_rawdata_v1_0_dmgi
    description: Youtube CMS report from files like "YouTube_dmgi_M_20220801_20220831_rawdata_v1-0.csv.gz"
    freshness:
          warn_after: { count: 31, period: day }
          error_after: { count: 35, period: day }
          filter: download_date >= current_date()-15
    loaded_at_field: TO_TIMESTAMP(download_date)
    tests:
    - not_transient
    - has_data
    - clustered:
        by: mcn_account,download_date