### snowflake cursor doesn't support string sseparation, thus this var is adjusted pg_queries_1 = dict( check_1="""select u.report_date ,count(distinct u.unit_of_work_code) "units_count" ,string_agg(distinct u.unit_of_work_code||'-'||cs.content_status, ', ') "units_list" from unit_of_work u join content_status cs on cs.unit_of_work_id = u.unit_of_work_id left outer join report r on r.report_id = u.report_id left outer join data_source ds on ds.data_source_id = r.data_source_id where true and u.report_date >= current_date - 14 and r.report_name in ( 'true' ,'dapd_applemusic_playlists' ,'dapd_spotify_playlists' ,'dapd_buzz_user' ,'dapd_buzz_category' ) and ( cs.content_status not in ('COMPLETE', 'COMPLETE_VOLATILE') or ( cs.content_status in ('ACTIVE') and u.last_updated_at < now() - interval '1 hour' ) ) group by u.report_date ;""" ) pg_queries_2 = dict( check_2 = """select u.report_date ,count(distinct u.unit_of_work_code) "units_count" ,string_agg(distinct u.unit_of_work_code||'-'||cs.content_status, ', ') "units_list" from unit_of_work u left outer join content_status cs on cs.unit_of_work_id = u.unit_of_work_id left outer join report r on r.report_id = u.report_id left outer join data_source ds on ds.data_source_id = r.data_source_id where true and u.report_date >= current_date - 14 and ( ( r.report_name in ( 'true' ,'dapd_rti_starred_playlists' ,'dapd_spotify_top_playlists' ,'dapd_apple_top_playlists' ) and (cs.content_status in ( null ,'ON_HOLD' ,'FAILED' ,'MISSING' ,'CANCELLED' ) or (cs.content_status = 'ACTIVE' and u.last_updated_at < now() - interval '1 hour')) ) or ( r.report_name in ( 'true' ,'stream_milestones_rti' ,'dapd_rti_starred_tracks' ,'dapd_apollo_starred_playlists' ,'dapd_apollo_starred_tracks' ) and (cs.content_status in ( null ,'ON_HOLD' ,'FAILED' ,'CANCELLED' ) or (cs.content_status = 'ACTIVE' and u.last_updated_at < now() - interval '1 hour')) ) ) group by u.report_date ;""" ) pg_queries_3 = dict( check_3 = """select data_source, 'playlist' "entity", max(updated_at) "added_at" from public_2.playlists group by data_source having max(updated_at) < now() - interval '60 minute' union select data_source, 'track' "entity", max(updated_at) "added_at" from public_2.tracks group by data_source having max(updated_at) < now() - interval '60 minute' union select data_source, 'album' "entity", max(updated_at) "added_at" from public_2.albums group by data_source having max(updated_at) < now() - interval '60 minute' union select data_source, 'artist' "entity", max(updated_at) "added_at" from public_2.artists group by data_source having max(updated_at) < now() - interval '60 minute' ;""" ) pg_queries_4 = dict( check_4 = """select dsp_id, 'playlist' "entity", max(updated_at) "added_at" from dim_playlist group by dsp_id having max(updated_at) < now() - interval '10 minute' union select dsp_id, 'playlist_track' "entity", max(created_at) "added_at" from dim_playlist_meta group by dsp_id having max(created_at) < now() - interval '10 minute' union select dsp_id, 'artist' "entity", max(updated_at) "added_at" from dim_artist group by dsp_id having max(updated_at) < now() - interval '1 hour' union select dsp_id, 'album' "entity", max(updated_at) "added_at" from dim_album group by dsp_id having max(updated_at) < now() - interval '1 hour' union select dsp_id, 'track' "entity", max(updated_at) "added_at" from dim_track group by dsp_id having max(updated_at) < now() - interval '1 hour' ;""" ) pg_queries_5 = dict( check_5 = """select distinct u.uow_id "unit_of_work_id", u.project, u.status, u.updated_at from uow_meta.unit_of_work u left outer join uow_meta.audit_log a on a.uow_id = u.uow_id left outer join uow_meta.databricks_executions de on de.unit_of_work_id = u.uow_id where true and u.created_at >= current_date - interval '14 day' and u.project in ( 'dapd_spotify', 'dapd_apple' ) and ( ( u.status not in ('IMPORT_COMPLETED') and u.updated_at < now() - interval '1 hour' ) -- Show issues in DTF units that must have already been completed or ( u.status not in ( 'placeholder' ,'IMPORT_COMPLETED' ,'IMPORT_SCHEDULED' ,'IMPORT_IN_PROGRESS' ,'EXPORT_COMPLETED' ,'EXPORT_IN_PROGRESS' ,'EXPORT_SCHEDULED' ) and u.updated_at >= now() - interval '1 hour' ) -- Show issues in DTF units that are expected to currently be in progress ) order by u.uow_id desc ;""" ) pg_queries_6 = dict( check_6 = """select u.project --,count(u.uow_id) "units_count" ,string_agg('(unit: '|| u.uow_id||', status: '||u.status||', duration: '||updated_at - to_timestamp(first_fact_id)||', updated: '||u.updated_at||')',', ') "units_list" from uow_meta.unit_of_work u where true and u.project in ( '' ,'dapd_spotify' ,'dapd_apple' ) and updated_at >= now() - interval '1 hour' and ( ( updated_at - to_timestamp(first_fact_id) > interval '90 minute' and extract ('hour' from u.created_at) in (23, 00, 01) -- midnight run ) or ( updated_at - to_timestamp(first_fact_id) > interval '60 minute' and extract ('hour' from u.created_at) between 02 and 22 -- regular run ) ) group by u.project limit 100 ;""" ) pg_queries_7 = dict( check_7 = """select 'apollo_playlist_owner_category_upsert_errors' "table", count(*) "count" from staging.apollo_playlist_owner_category_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_dim_apple_album_upsert_errors' "table", count(*) "count" from staging.apple_dim_apple_album_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_dim_apple_playlist_artist_upsert_errors' "table", count(*) "count" from staging.apple_dim_apple_playlist_artist_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_dim_apple_playlist_track_upsert_errors' "table", count(*) "count" from staging.apple_dim_apple_playlist_track_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_dim_playlist_custom_region_upsert_errors' "table", count(*) "count" from staging.apple_dim_playlist_custom_region_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_dim_playlist_upsert_errors' "table", count(*) "count" from staging.apple_dim_playlist_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_fact_public_playlist_lifetime_upsert_errors' "table", count(*) "count" from staging.apple_fact_public_playlist_lifetime_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_link_apple_playlist_track_artist_upsert_errors' "table", count(*) "count" from staging.apple_link_apple_playlist_track_artist_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'apple_playlist_owner_upsert_errors' "table", count(*) "count" from staging.apple_playlist_owner_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_dim_playlist_custom_region_upsert_errors' "table", count(*) "count" from staging.spotify_dim_playlist_custom_region_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_dim_playlist_upsert_errors' "table", count(*) "count" from staging.spotify_dim_playlist_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_dim_spotify_album_upsert_errors' "table", count(*) "count" from staging.spotify_dim_spotify_album_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_dim_spotify_playlist_artist_upsert_errors' "table", count(*) "count" from staging.spotify_dim_spotify_playlist_artist_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_dim_spotify_playlist_track_upsert_errors' "table", count(*) "count" from staging.spotify_dim_spotify_playlist_track_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_fact_public_playlist_lifetime_upsert_errors' "table", count(*) "count" from staging.spotify_fact_public_playlist_lifetime_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_link_spotify_playlist_track_artist_upsert_errors' "table", count(*) "count" from staging.spotify_link_spotify_playlist_track_artist_upsert_errors where error_timestamp >= now() - interval '1 day' union select 'spotify_playlist_owner_upsert_errors' "table", count(*) "count" from staging.spotify_playlist_owner_upsert_errors where error_timestamp >= now() - interval '1 day' ;""" ) sf_queries_9_23 = dict( check_9 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_ALBUM"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_10 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_ALBUM_ARTIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_11 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_ARTIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_12 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_13 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST_EXTRA"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_14 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."FACT_PLAYLIST_TRACKLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_15 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST_OWNER"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_17 = """SELECT count(*) "count" FROM table( "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_TRACK"', start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, end_time => current_timestamp() ) ) where lower(STATUS) = 'loaded';""", check_18 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_TRACK_ALBUM"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_19 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_TRACK_ARTIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_20 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."STARRED_PLAYLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_21 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."STARRED_TRACK"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_22 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DTF_META"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""", check_23 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."TOP_PLAYLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'loaded';""" ) sf_queries_24_41 = dict( check_24 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_ALBUM"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_25 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_ALBUM_ARTIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_26 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_ARTIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_27 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_DSP"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_28 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_MARKET"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_29 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_30 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST_EXTRA"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_31 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."FACT_PLAYLIST_TRACKLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_32 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST_OWNER"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_33 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_PLAYLIST_OWNER_CATEGORY"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_34 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_TRACK"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_35 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_TRACK_ALBUM"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_36 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DTF_META"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_37 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."DIM_TRACK_ARTIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_38 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."STARRED_PLAYLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_39 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."STARRED_TRACK"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_40 = """SELECT \ count(*) "count" \ FROM \ table( \ "DELPHI_PUBLIC_DATA_MAIN".INFORMATION_SCHEMA.COPY_HISTORY( \ table_name => '"DELPHI_PUBLIC_DATA_MAIN"."STAGING"."TOP_PLAYLIST"', \ start_time => dateadd('day', -1, current_timestamp())::TIMESTAMP_LTZ, \ end_time => current_timestamp() \ ) \ ) \ where lower(STATUS) = 'load failed';""", check_41 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.STAGING.TOP_PLAYLIST \ where lower(country_code) not in (select MARKET_CODE from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_MARKET );""" ) sf_queries_42_57 = dict( check_42 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ALBUM \ \ union \ \ select count(distinct ALBUM_ID, DSP_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_ALBUM \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ALBUM ) \ ;""", check_43 = """select count(*) "count" , 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ALBUM_ARTIST \ \ union \ \ select count(distinct ALBUM_ID, DSP_ID, ARTIST_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_ALBUM_ARTIST \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ALBUM_ARTIST) \ ;""", check_44 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ARTIST \ \ union \ \ select count(distinct ARTIST_ID, DSP_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_ARTIST \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ARTIST) \ ;""", check_45 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_DSP \ \ union \ \ select count(distinct DSP_ID) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_DSP \ ;""", check_46 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_MARKET \ \ union \ \ select count(distinct MARKET_ID) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_MARKET \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_MARKET) \ ;""", check_47 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST \ \ union \ \ select count(distinct PLAYLIST_ID, DSP_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_PLAYLIST \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST) \ ;""", check_48 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK_ALBUM \ \ union \ \ select count(distinct TRACK_ID, DSP_ID, ALBUM_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_TRACK_ALBUM \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK_ALBUM) \ ;""", check_49 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK_ARTIST \ \ union \ \ select count(distinct TRACK_ID, DSP_ID, artist_id , iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_TRACK_ARTIST \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK_ARTIST) \ ;""", check_50 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST_EXTRA \ \ union \ \ select count(distinct PLAYLIST_ID, DSP, iff(DSP = 'spotify', '-1', MARKET)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_PLAYLIST_EXTRA \ ;""", check_51 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST_OWNER \ \ union \ \ select count(distinct USERNAME) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_PLAYLIST_OWNER \ ;""", check_52 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST_OWNER_CATEGORY \ \ union \ \ select count(distinct id) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_PLAYLIST_OWNER_CATEGORY \ ;""", check_53 = """select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK \ \ union \ \ select count(distinct TRACK_ID, DSP_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.DIM_TRACK \ where unit_of_work_id <= (select max(unit_of_work_id) from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK) \ ;""", check_54 = """select count (distinct CREATED_AT , PLAYLIST_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.FACT_PLAYLIST_TRACK_HISTORY \ where DATE >=current_date -10 and date < current_date \ \ union \ \ select count (distinct CREATED_AT , PLAYLIST_ID, iff(DSP_ID = 1, -1, MARKET_ID)) "count", 'src; SF staging' "table" \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.FACT_PLAYLIST_TRACKLIST \ where to_date(created_at) >=current_date -10 and to_date(created_at) < current_date \ ;""", check_55 = """with DEDUPED as (select APP_NAME, \ parse_json(CONTENT) as CONTENT, \ CREATED_AT \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.STARRED_TRACK \ qualify dense_rank() over (partition by APP_NAME order by CREATED_AT desc ) < 3) \ select count(*) "count", 'src; SF staging' "table" \ from (select ISRC, APP_NAME \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.STARRED_TRACK \ minus \ select replace(replace(upper(F1.VALUE::STRING), '-', ''), ' ', '') as ISRC, \ APP_NAME \ from DEDUPED, \ lateral flatten(CONTENT:tracks) F1) \ union \ select 0 "count", 'dest; SF public' "table" \ ;""", check_56 = """select count(distinct f1.value ) "count", 'src; SF staging' "table" \ from ( \ select * \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.STARRED_PLAYLIST \ qualify row_number() over (partition by APP_NAME order by created_at desc )=1 \ ) , lateral flatten(CONTENT:playlists) f1 \ \ union \ \ select count(*) "count", 'dest; SF public' "table" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.STARRED_PLAYLIST \ ;""", check_57 = """select count(*) "count", 'src; SF staging' "table" \ from (select PLAYLIST_ID, COUNTRY_CODE \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.TOP_PLAYLIST \ minus \ select distinct PLAYLIST_ID, lower(COUNTRY_CODE) \ from DELPHI_PUBLIC_DATA_MAIN.STAGING.TOP_PLAYLIST \ qualify dense_rank() over (partition by DSP order by CREATED_AT desc) < 3) \ union \ select 0 "count", 'dest; SF public' "table";""" ) sf_queries_58_60 = dict( check_58 = """select count(*) "count" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.PLAYLIST_EVENT_HISTORY \ where created_at > current_timestamp() - interval '1 day' \ ;""", check_59 = """select count(*) "count" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.PLAYLIST_TRACK_EVENT_HISTORY \ where created_at > current_timestamp() - interval '1 day' \ ;""", check_60 = """select count(*) "count" \ from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.FACT_PLAYLIST_TRACKLIST_UPDATES \ where created_at > current_timestamp() - interval '1 day' \ ;""" ) queries_61_67 = dict( check_61 = dict( sf_check_61 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ALBUM;""", pg_check_61 = """select ( select count(*) as count from apple.dim_apple_album) + (select count(*) as count from spotify.dim_spotify_album) "count"; """), check_62 = dict( sf_check_62 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_ARTIST;""", pg_check_62 = """select ( select count(*) as count from apple.dim_apple_playlist_artist ) + (select count(*) as count from spotify.dim_spotify_playlist_artist ) "count"; """), check_63 = dict( sf_check_63="""select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST""", pg_check_63 = """select ( select count(*) as count from apple.dim_playlist where not (country_code='not_defined' and name='null' and num_tracks=0 and is_removed=true)) + (select count(*) as count from spotify.dim_playlist where not (country_code='not_defined' and name='null' and num_tracks=0 and is_removed=true)) "count"; """), check_64 = dict( sf_check_64 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_PLAYLIST_OWNER;""", pg_check_64 = """select ( select count(*) as count from apple.playlist_owner ) + (select count(*) as count from spotify.playlist_owner ) "count";"""), check_65 = dict( sf_check_65 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.DIM_TRACK;""", pg_check_65 = """select ( select count(*) as count from apple.dim_apple_playlist_track ) + (select count(*) as count from spotify.dim_spotify_playlist_track ) "count";"""), check_66 = dict( sf_check_66 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.FACT_PUBLIC_APPLE_PLAYLIST_ISRC_LIFETIME;""", pg_check_66 = """select count(*) "count" from apple.fact_public_apple_playlist_track_lifetime where isrc is not null and isrc not in ('unknown' , '');"""), check_67 = dict( sf_check_67 = """select count(*) "count" from DELPHI_PUBLIC_DATA_MAIN.PLAYLISTS.FACT_PUBLIC_SPOTIFY_PLAYLIST_ISRC_LIFETIME """, pg_check_67 = """select count(*) "count" from spotify.fact_public_spotify_playlist_track_lifetime where isrc is not null and isrc not in ('unknown' , '');""") ) if __name__ == '__main__': pass