airflow.providers.amazon.aws.triggers.dynamodb¶
Classes¶
Asynchronously poll a DynamoDB item until the given attribute matches one of the expected values. |
Module Contents¶
- class airflow.providers.amazon.aws.triggers.dynamodb.DynamoDBValueSensorTrigger(table_name, partition_key_name, partition_key_value, attribute_name, attribute_value, sort_key_name=None, sort_key_value=None, waiter_delay=60, aws_conn_id='aws_default', region_name=None, verify=None, botocore_config=None)[source]¶
Bases:
airflow.triggers.base.BaseEventTriggerAsynchronously poll a DynamoDB item until the given attribute matches one of the expected values.
The polling uses the low-level DynamoDB client (aiobotocore exposes clients only, not the boto3 resource API used by
DynamoDBHook), so keys are sent as typed string attributes, matching the string-typed key parameters ofDynamoDBValueSensor.- Parameters:
table_name (str) – DynamoDB table name
partition_key_name (str) – DynamoDB partition key name
partition_key_value (str) – DynamoDB partition key value
attribute_name (str) – DynamoDB attribute name
attribute_value (str | collections.abc.Iterable[str]) – expected DynamoDB attribute value (or values, any of which matches)
sort_key_name (str | None) – (optional) DynamoDB sort key name
sort_key_value (str | None) – (optional) DynamoDB sort key value
waiter_delay (int) – The time in seconds to wait between DynamoDB API calls
aws_conn_id (str | None) – The Airflow connection used for AWS credentials.
region_name (str | None) – AWS region_name. If not specified then the default boto3 behaviour is used.
verify (bool | str | None) – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html
botocore_config (dict | None) – Configuration dictionary (key-values) for botocore client. See: https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html
- async poke(client)[source]¶
Test the DynamoDB item for a matching attribute value, mirroring the sensor’s poke.
- async run()[source]¶
Run the trigger in an asynchronous context.
The trigger should yield an Event whenever it wants to fire off an event, and return None if it is finished. Single-event triggers should thus yield and then immediately return.
If it yields, it is likely that it will be resumed very quickly, but it may not be (e.g. if the workload is being moved to another triggerer process, or a multi-event trigger was being used for a single-event task defer).
In either case, Trigger classes should assume they will be persisted, and then rely on cleanup() being called when they are no longer needed.