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/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: ='2019-04-12'
              - max:
                  arguments:
                    value: ='2022-10-24'
              - consecutive:
                  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'
                  arguments:
                    period: 1
      - name: applemusic_streams_joined
        description: AWAL report "applemusic_streams_joined" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/applemusic_streams_joined/
        data_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/
        data_tests:
          - not_transient
          - has_data
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: ='2018-05-01'
              - max:
                  arguments:
                    value: ='2022-10-24'
              - consecutive:
                  arguments:
                    period: 1
      - name: itunes
        description: AWAL report "itunes" from s3://prod-orcd-awal-drop/AWAL_TO_ORCH/FINANCIAL_REPORTING/itunes_final/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day'
            data_tests:
              - min:
                  arguments:
                    value: ='2018-01-01'
              - max:
                  arguments:
                    value: ='2022-11-01'
              - consecutive:
                  arguments:
                    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/
        data_tests:
          - not_transient
          - has_data
        columns:
          - name: isrc
            data_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/
        data_tests:
          - not_transient
          - has_data
        columns:
          - name: id
            data_tests:
              - unique
          - name: day
            data_tests:
              - dbt_utils.expression_is_true:
            # finally updated data at 2022-10-26
                  arguments:
                    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/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: = '2018-01-01'
              - max:
                  arguments:
                    value: = '2022-10-25'
              - consecutive:
                  config:
              # Actually skipped: 1 day before 2019-06-07
                    error_if: '<>1'
                    warn_if: '<>1'

                  arguments:
                    period: 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/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: = '2015-04-01'
              - max:
                  arguments:
                    value: = '2022-10-25'
              - consecutive:
                  config:
              # Actually skipped: 2 days before 2018-05-03
                    error_if: '<>1'
                    warn_if: '<>1'

                  arguments:
                    period: 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/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: = '2015-04-01'
              - max:
                  arguments:
                    value: = '2022-10-25'
              - consecutive:
                  config:
              # Actually skipped: 2 days before 2018-05-03
                    error_if: '<>1'
                    warn_if: '<>1'

                  arguments:
                    period: 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/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: = '2015-04-01'
              - max:
                  arguments:
                    value: = '2022-10-25'
              - consecutive:
                  config:
              # Actually skipped: 2 days before 2018-05-03
                    error_if: '<>1'
                    warn_if: '<>1'

                  arguments:
                    period: 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/
        data_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/
        data_tests:
          - not_transient
          - has_data
          - clustered:
              arguments:
                by: download_date
        columns:
          - name: download_date
            description: Original column name was 'day' (clustering key)
            data_tests:
              - min:
                  arguments:
                    value: = '2017-01-01'
              - max:
                  arguments:
                    value: = '2022-10-23'
              - consecutive:
                  arguments:
                    period: 1
