Source code for airflow.providers.amazon.aws.triggers.redshift_data
# Licensed to the Apache Software Foundation (ASF) under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# "License"); you may not use this file except in compliance# with the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing,# software distributed under the License is distributed on an# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY# KIND, either express or implied. See the License for the# specific language governing permissions and limitations# under the License.from__future__importannotationsimportasynciofromfunctoolsimportcached_propertyfromtypingimportAny,AsyncIteratorfromairflow.providers.amazon.aws.hooks.redshift_dataimport(ABORTED_STATE,FAILED_STATE,RedshiftDataHook,RedshiftDataQueryAbortedError,RedshiftDataQueryFailedError,)fromairflow.triggers.baseimportBaseTrigger,TriggerEvent
[docs]classRedshiftDataTrigger(BaseTrigger):""" RedshiftDataTrigger is fired as deferred class with params to run the task in triggerer. :param statement_id: the UUID of the statement :param task_id: task ID of the Dag :param poll_interval: polling period in seconds to check for the status :param aws_conn_id: AWS connection ID for redshift :param region_name: aws region to use """def__init__(self,statement_id:str,task_id:str,poll_interval:int,aws_conn_id:str|None="aws_default",region_name:str|None=None,verify:bool|str|None=None,botocore_config:dict|None=None,):super().__init__()self.statement_id=statement_idself.task_id=task_idself.poll_interval=poll_intervalself.aws_conn_id=aws_conn_idself.region_name=region_nameself.verify=verifyself.botocore_config=botocore_config
[docs]defserialize(self)->tuple[str,dict[str,Any]]:"""Serialize RedshiftDataTrigger arguments and classpath."""return("airflow.providers.amazon.aws.triggers.redshift_data.RedshiftDataTrigger",{"statement_id":self.statement_id,"task_id":self.task_id,"aws_conn_id":self.aws_conn_id,"poll_interval":self.poll_interval,"region_name":self.region_name,"verify":self.verify,"botocore_config":self.botocore_config,},)