"""Component for loading source files directly to staging_raw via stage.""" from feed_ingestion.common.staging_raw_sf.snowflake_stage_loader \ import StageLoader from feed_ingestion.util import youtube_util class YoutubeWeekly(StageLoader): """StageLoader class.""" def clean_staging_raw_table(self, staging_raw_table, date): """Delete rows from previous unsuccessful workflow run. Args: staging_raw_table (str): A table name in Snowflake. date (str): Date of the data being process (YYYY-MM-DD). """ _, start_date, end_date = youtube_util.get_days(date) self.resolve_sql_loader_and_execute( 'delete_from_staging_raw', params=dict( db=self.executor.sf_config['db'], schema=self.executor.sf_config['schema'], staging_raw_table=staging_raw_table, from_date=start_date, to_date=end_date ) )