version: 2
sources:
- name: awal_riverdeep
  database: awal_sax
  schema: riverdeep
  tables:
# please retain alphabetical order for source table names

  - name: amazon_usage_joined
    description: AWAL report "amazon_usage_joined" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/amazon_usage_joined/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: ='2019-04-12'
        - max:
            value: ='2022-10-24'
        - consecutive:
            period: 1
            config:
              # Actually skipped: 1 day before 2021-01-09, 1 day before 2021-01-02, 1 day before 2020-12-30
              error_if: '<>3'
              warn_if: '<>3'
  - name: applemusic_streams_joined
    description: AWAL report "applemusic_streams_joined" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/applemusic_streams_joined/
    tests:
    - not_transient
    - has_data

  - name: applemusic_summary_streams_joined
    description: AWAL report "applemusic_summary_streams_joined" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/applemusic_summary_streams_joined/
    tests:
    - not_transient
    - has_data
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: ='2018-05-01'
        - max:
            value: ='2022-10-24'
        - consecutive:
            period: 1

  - name: itunes
    description: AWAL report "itunes" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/itunes_final/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day'
      tests:
        - min:
            value: ='2018-01-01'
        - max:
            value: ='2022-11-01'
        - consecutive:
            period: 1

  - name: sax_recording_ownership
    description: AWAL report "sax_recording_ownership" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/sax_recording_ownership/
    tests:
    - not_transient
    - has_data
    columns:
      - name: isrc
        tests:
          - unique

  - name: spotify_metadata_playlist_latest
    description: AWAL report "spotify_metadata_playlist_latest" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/spotify_metadata_playlist_latest/
    tests:
    - not_transient
    - has_data
    columns:
    - name: id
      tests:
        - unique
    - name: day
      tests:
        - dbt_utils.expression_is_true:
            # finally updated data at 2022-10-26
            expression: = '20221026'

  - name: spotify_metadata_playlists_tracks
    description: AWAL report "spotify_metadata_playlists_tracks" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/spotify_metadata_playlists_tracks/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: = '2018-01-01'
        - max:
            value: = '2022-10-25'
        - consecutive:
            period: 1
            config:
              # Actually skipped: 1 day before 2019-06-07
              error_if: '<>1'
              warn_if: '<>1'

  - name: spotify_playlist_summary
    description: AWAL report "spotify_playlist_summary" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/spotify_playlist_summary/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: = '2015-04-01'
        - max:
            value: = '2022-10-25'
        - consecutive:
            period: 1
            config:
              # Actually skipped: 2 days before 2018-05-03
              error_if: '<>1'
              warn_if: '<>1'

  - name: spotify_playlist_territory_summary
    description: AWAL report "spotify_playlist_territory_summary" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/spotify_playlist_territory_summary/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: = '2015-04-01'
        - max:
            value: = '2022-10-25'
        - consecutive:
            period: 1
            config:
              # Actually skipped: 2 days before 2018-05-03
              error_if: '<>1'
              warn_if: '<>1'

  - name: spotify_usage_joined
    description: AWAL report "spotify_usage_joined" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/spotify_usage_joined/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: = '2015-04-01'
        - max:
            value: = '2022-10-25'
        - consecutive:
            period: 1
            config:
              # Actually skipped: 2 days before 2018-05-03
              error_if: '<>1'
              warn_if: '<>1'

  - name: youtube_asset_lifetime_lookup
    description: AWAL report "youtube_asset_lifetime_lookup" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/youtube_asset_lifetime_lookup/
    tests:
    - not_transient
    - has_data

  - name: youtube_usage_joined
    description: AWAL report "youtube_usage_joined" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/youtube_usage_joined/
    tests:
    - not_transient
    - has_data
    - clustered:
        by: download_date
    columns:
    - name: download_date
      description: Original column name was 'day' (clustering key)
      tests:
        - min:
            value: = '2017-01-01'
        - max:
            value: = '2022-10-23'
        - consecutive:
            period: 1
