airflow.providers.amazon.aws.hooks.rds

Interact with AWS RDS.

Module Contents

Classes

RdsHook

Interact with Amazon Relational Database Service (RDS).

class airflow.providers.amazon.aws.hooks.rds.RdsHook(*args, **kwargs)[source]

Bases: airflow.providers.amazon.aws.hooks.base_aws.AwsGenericHook[mypy_boto3_rds.RDSClient]

Interact with Amazon Relational Database Service (RDS).

Provide thin wrapper around boto3.client("rds").

Additional arguments (such as aws_conn_id) may be specified and are passed down to the underlying AwsBaseHook.

get_db_snapshot_state(snapshot_id)[source]

Get the current state of a DB instance snapshot.

Parameters

snapshot_id (str) – The ID of the target DB instance snapshot

Returns

Returns the status of the DB snapshot as a string (eg. “available”)

Raises

AirflowNotFoundException – If the DB instance snapshot does not exist.

Return type

str

wait_for_db_snapshot_state(snapshot_id, target_state, check_interval=30, max_attempts=40)[source]

Poll DB Snapshots until target_state is reached; raise AirflowException after max_attempts.

Parameters
  • snapshot_id (str) – The ID of the target DB instance snapshot

  • target_state (str) – Wait until this state is reached

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

get_db_cluster_snapshot_state(snapshot_id)[source]

Get the current state of a DB cluster snapshot.

Parameters

snapshot_id (str) – The ID of the target DB cluster.

Returns

Returns the status of the DB cluster snapshot as a string (eg. “available”)

Raises

AirflowNotFoundException – If the DB cluster snapshot does not exist.

Return type

str

wait_for_db_cluster_snapshot_state(snapshot_id, target_state, check_interval=30, max_attempts=40)[source]

Poll DB Cluster Snapshots until target_state is reached; raise AirflowException after a max_attempts.

Parameters
  • snapshot_id (str) – The ID of the target DB cluster snapshot

  • target_state (str) – Wait until this state is reached

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

get_export_task_state(export_task_id)[source]

Get the current state of an RDS snapshot export to Amazon S3.

Parameters

export_task_id (str) – The identifier of the target snapshot export task.

Returns

Returns the status of the snapshot export task as a string (eg. “canceled”)

Raises

AirflowNotFoundException – If the export task does not exist.

Return type

str

wait_for_export_task_state(export_task_id, target_state, check_interval=30, max_attempts=40)[source]

Poll export tasks until target_state is reached; raise AirflowException after max_attempts.

Parameters
  • export_task_id (str) – The identifier of the target snapshot export task.

  • target_state (str) – Wait until this state is reached

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

get_event_subscription_state(subscription_name)[source]

Get the current state of an RDS snapshot export to Amazon S3.

Parameters

subscription_name (str) – The name of the target RDS event notification subscription.

Returns

Returns the status of the event subscription as a string (eg. “active”)

Raises

AirflowNotFoundException – If the event subscription does not exist.

Return type

str

wait_for_event_subscription_state(subscription_name, target_state, check_interval=30, max_attempts=40)[source]

Poll Event Subscriptions until target_state is reached; raise AirflowException after max_attempts.

Parameters
  • subscription_name (str) – The name of the target RDS event notification subscription.

  • target_state (str) – Wait until this state is reached

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

get_db_instance_state(db_instance_id)[source]

Get the current state of a DB instance.

Parameters

db_instance_id (str) – The ID of the target DB instance.

Returns

Returns the status of the DB instance as a string (eg. “available”)

Raises

AirflowNotFoundException – If the DB instance does not exist.

Return type

str

wait_for_db_instance_state(db_instance_id, target_state, check_interval=30, max_attempts=40)[source]

Poll DB Instances until target_state is reached; raise AirflowException after max_attempts.

Parameters
  • db_instance_id (str) – The ID of the target DB instance.

  • target_state (str) – Wait until this state is reached

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

get_db_cluster_state(db_cluster_id)[source]

Get the current state of a DB cluster.

Parameters

db_cluster_id (str) – The ID of the target DB cluster.

Returns

Returns the status of the DB cluster as a string (eg. “available”)

Raises

AirflowNotFoundException – If the DB cluster does not exist.

Return type

str

wait_for_db_cluster_state(db_cluster_id, target_state, check_interval=30, max_attempts=40)[source]

Poll DB Clusters until target_state is reached; raise AirflowException after max_attempts.

Parameters
  • db_cluster_id (str) – The ID of the target DB cluster.

  • target_state (str) – Wait until this state is reached

  • check_interval (int) – The amount of time in seconds to wait between attempts

  • max_attempts (int) – The maximum number of attempts to be made

Was this entry helpful?