"""AWA generators.""" from feed_ingestion.flows.awa import config def reports_generator(context): """Generate parameters for reports. Args: context (dict): The current context. Yields: dict: Dictionary of table names. """ licensor = context['bootstrap.licensor'] date = context['bootstrap.date'] date_nodash = date.replace('-', '') licensor_reports = config.licensors[licensor]['reports'] for report_name, report_config in licensor_reports.items(): staging_raw_table = report_config['staging_raw_table'] temp_staging_raw_table = f'temp_{staging_raw_table}_{date_nodash}' file_name = report_config['target_filename'].format(date=date_nodash) s3_dir_path = '/'.join([ config.data_bucket, report_config['s3_path'].format(date=date), ]) s3_dir_path = f's3://{s3_dir_path}' yield dict( temp_staging_raw_table=temp_staging_raw_table, staging_raw_table=staging_raw_table, s3_dir_path=s3_dir_path, source_files=[ file_name ], kwargs=dict( licensor=licensor, report=report_name, ) )