"""Config for Apple Financial Workflow.""" import os feed_name = 'apple_financial' secrets_path = 'itunes_marketshare' feed_version = '1.0' s3_feed_name = 'AppleFinancial' expected_bucket_owner = os.environ.get('EXPECTED_BUCKET_OWNER', '437795906767') # environment to run in environment = os.environ.get('ENVIRONMENT', 'dev') # bucket for archived data data_bucket = os.environ.get('FEED_INGESTION_DATA_BUCKET', 'dev-cucumbers') # bucket for dropped data drop_bucket = os.environ.get( 'FEED_INGESTION_DROP_BUCKET', 'dev-feed-drop') apple_reports = ( ('ORCHARD', 'AppleMusicSummary'), ('IODA', 'AppleMusicSummary'), ('BFM_IODA', 'AppleMusicSummary'), ('FINETUNES', 'AppleMusicSummary'), ('RELAPSE', 'AppleMusicSummary'), ('IRIS', 'AppleMusicSummary'), ('PHONOFILE', 'AppleMusicSummary'), ('DKUA', 'AppleMusicSummary'), ('BFM_ORCHARD', 'AppleMusicSummary'), ('PRIDDIS', 'AppleMusicSummary'), ('RDA', 'AppleMusicSummary'), ) # S3 locations for dropped and archived files s3 = { 'archive': ( 's3://{data_bucket}/{feed_name}/archives/{{date:%Y-%m}}/'.format( data_bucket=data_bucket, feed_name=s3_feed_name)) } file_pattern = '.+S2.+ZZ.txt.gz' expected_report_header = 'Apple Music Summary Sheet' temp_table_name = '{report}_{reporter_account}_{date:%Y%m%d}' report_feed_name = '{feed_name}_{reporter_account}_{report}' create_temp_table_query_name = 'create_temp_table_{report}' load_query_name = 'load_staging_raw_{report}' snowflake_error_limit = 10 expected_reports = { 'LinearRadioService': { 'staging_raw_table': 'staging_raw_apple_music_linear_radio_service', 'expected_columns': [ 'Currency', 'Storefront Name', 'Total Royalty Bearing Broadcast Plays', 'Label Royalty Bearing Broadcast Plays', 'Label Market Share', 'Total Listener Hours', 'Revenue Per Thousand Listener Hours Gurantee', 'Divisor', 'Revenue Per Thousand Listener Hour', 'RPM Amount', 'Royalty Amount', 'Effective Per Play Rate', 'Fiscal Month', 'Period' ] }, 'AppleMusicSummary': { 'staging_raw_table': 'staging_raw_apple_music_summary', 'expected_columns': [ 'Currency', 'Product', 'Storefront Name', 'Total Royalty Bearing Plays', 'Total Spatial Available Royalty Bearing Plays', 'Total Non Spatial Available Royalty Bearing Plays', 'Spatial Available Factor', 'Label Spatial Available Royalty Bearing Plays', 'Label Non Spatial Available Royalty Bearing Plays', 'Spatial Available Per Play Royalty', 'Non Spatial Available Per Play Royalty', 'Fiscal Month', 'Period' ] }, 'AppleMusicRoyaltyCalculation': { 'staging_raw_table': 'staging_raw_apple_music_royalty_calculation', 'expected_columns': [ 'Currency', 'Product', 'Storefront Name', 'Effective Rate Dates', 'Market Share (Label/ Paid Subscriber)', 'Total Revenue', 'Percentage of Revenue', 'Revenue Share Royalty Amount', 'Total Subscription Days', 'Per Subscription Daily Minimum', 'Subscription Minima Royalty Amount', 'Per Play Rate', 'Trial Royalty Pool', 'Trial Share Royalty Amount', 'Royalty Amount', 'Fiscal Month', 'Period' ] }, 'AppleMusicFooter': { 'staging_raw_table': 'staging_raw_apple_music_footer', 'expected_columns': [ 'Currency', 'Storefront Name', 'Total Royalty Amount', 'Stream Manipulation Adjustments', 'Fiscal Month', 'Period' ] }, }