"""Task to copy approved mech deductions from staging to the 'final' snowflake table.""" from hooks.royalty_snowflake_hook import RoyaltySnowflakeHook from lib import config from tasks.accounting_run_commit.helpers import get_event_from_params from templates.accounting_run_commit.snowflake_copy_mech_deductions import \ copy_mech_deductions_template def copy_mech_deductions(dag_run: dict, **kwargs) -> None: """Copy over mech deductions from staging table to final table.""" event = get_event_from_params(dag_run, **kwargs) hook = RoyaltySnowflakeHook(snowflake_conn_id=config.SNOWFLAKE_CONN_NAME) copy_statement = copy_mech_deductions_template().render( accounting_run_id=event.target_id, environment=config.OWS_ENV, ) hook.run(copy_statement, autocommit=True)