apache-airflow-providers-amazon 8.6.0__py3-none-any.whl → 8.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. airflow/providers/amazon/__init__.py +1 -1
  2. airflow/providers/amazon/aws/hooks/appflow.py +2 -5
  3. airflow/providers/amazon/aws/hooks/athena.py +4 -3
  4. airflow/providers/amazon/aws/hooks/base_aws.py +28 -41
  5. airflow/providers/amazon/aws/hooks/batch_client.py +8 -6
  6. airflow/providers/amazon/aws/hooks/batch_waiters.py +4 -2
  7. airflow/providers/amazon/aws/hooks/chime.py +13 -8
  8. airflow/providers/amazon/aws/hooks/cloud_formation.py +5 -1
  9. airflow/providers/amazon/aws/hooks/datasync.py +9 -16
  10. airflow/providers/amazon/aws/hooks/ecr.py +4 -1
  11. airflow/providers/amazon/aws/hooks/ecs.py +4 -1
  12. airflow/providers/amazon/aws/hooks/redshift_cluster.py +8 -12
  13. airflow/providers/amazon/aws/hooks/redshift_data.py +1 -1
  14. airflow/providers/amazon/aws/hooks/s3.py +4 -6
  15. airflow/providers/amazon/aws/hooks/sagemaker.py +7 -8
  16. airflow/providers/amazon/aws/hooks/sns.py +0 -1
  17. airflow/providers/amazon/aws/links/emr.py +4 -3
  18. airflow/providers/amazon/aws/log/cloudwatch_task_handler.py +4 -1
  19. airflow/providers/amazon/aws/log/s3_task_handler.py +1 -1
  20. airflow/providers/amazon/aws/notifications/chime.py +4 -1
  21. airflow/providers/amazon/aws/notifications/sns.py +94 -0
  22. airflow/providers/amazon/aws/notifications/sqs.py +100 -0
  23. airflow/providers/amazon/aws/operators/ecs.py +5 -5
  24. airflow/providers/amazon/aws/operators/glue.py +1 -1
  25. airflow/providers/amazon/aws/operators/rds.py +2 -2
  26. airflow/providers/amazon/aws/sensors/batch.py +7 -2
  27. airflow/providers/amazon/aws/sensors/dynamodb.py +1 -1
  28. airflow/providers/amazon/aws/sensors/ecs.py +2 -2
  29. airflow/providers/amazon/aws/sensors/s3.py +2 -2
  30. airflow/providers/amazon/aws/sensors/sqs.py +7 -6
  31. airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py +2 -2
  32. airflow/providers/amazon/aws/transfers/ftp_to_s3.py +1 -1
  33. airflow/providers/amazon/aws/transfers/mongo_to_s3.py +3 -2
  34. airflow/providers/amazon/aws/transfers/redshift_to_s3.py +1 -3
  35. airflow/providers/amazon/aws/transfers/sql_to_s3.py +4 -2
  36. airflow/providers/amazon/aws/triggers/athena.py +5 -1
  37. airflow/providers/amazon/aws/triggers/base.py +4 -2
  38. airflow/providers/amazon/aws/triggers/batch.py +10 -11
  39. airflow/providers/amazon/aws/triggers/ecs.py +9 -6
  40. airflow/providers/amazon/aws/triggers/eks.py +4 -2
  41. airflow/providers/amazon/aws/triggers/emr.py +6 -4
  42. airflow/providers/amazon/aws/triggers/glue_crawler.py +4 -1
  43. airflow/providers/amazon/aws/triggers/lambda_function.py +5 -1
  44. airflow/providers/amazon/aws/triggers/rds.py +4 -2
  45. airflow/providers/amazon/aws/triggers/redshift_cluster.py +4 -1
  46. airflow/providers/amazon/aws/triggers/s3.py +4 -2
  47. airflow/providers/amazon/aws/triggers/sqs.py +6 -2
  48. airflow/providers/amazon/aws/triggers/step_function.py +5 -1
  49. airflow/providers/amazon/aws/utils/__init__.py +4 -2
  50. airflow/providers/amazon/aws/utils/redshift.py +3 -1
  51. airflow/providers/amazon/aws/utils/sqs.py +7 -12
  52. airflow/providers/amazon/aws/utils/suppress.py +74 -0
  53. airflow/providers/amazon/aws/utils/task_log_fetcher.py +4 -2
  54. airflow/providers/amazon/aws/utils/waiter_with_logging.py +4 -2
  55. airflow/providers/amazon/aws/waiters/base_waiter.py +5 -1
  56. airflow/providers/amazon/get_provider_info.py +20 -5
  57. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/METADATA +6 -14
  58. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/RECORD +63 -60
  59. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/WHEEL +1 -1
  60. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/LICENSE +0 -0
  61. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/NOTICE +0 -0
  62. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/entry_points.txt +0 -0
  63. {apache_airflow_providers_amazon-8.6.0.dist-info → apache_airflow_providers_amazon-8.7.0.dist-info}/top_level.txt +0 -0
@@ -16,10 +16,14 @@
16
16
  # under the License.
17
17
  from __future__ import annotations
18
18
 
19
- from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
19
+ from typing import TYPE_CHECKING
20
+
20
21
  from airflow.providers.amazon.aws.hooks.lambda_function import LambdaHook
21
22
  from airflow.providers.amazon.aws.triggers.base import AwsBaseWaiterTrigger
22
23
 
24
+ if TYPE_CHECKING:
25
+ from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
26
+
23
27
 
24
28
  class LambdaCreateFunctionCompleteTrigger(AwsBaseWaiterTrigger):
25
29
  """
@@ -17,16 +17,18 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import warnings
20
- from typing import Any
20
+ from typing import TYPE_CHECKING, Any
21
21
 
22
22
  from airflow.exceptions import AirflowProviderDeprecationWarning
23
- from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
24
23
  from airflow.providers.amazon.aws.hooks.rds import RdsHook
25
24
  from airflow.providers.amazon.aws.triggers.base import AwsBaseWaiterTrigger
26
25
  from airflow.providers.amazon.aws.utils.rds import RdsDbType
27
26
  from airflow.providers.amazon.aws.utils.waiter_with_logging import async_wait
28
27
  from airflow.triggers.base import BaseTrigger, TriggerEvent
29
28
 
29
+ if TYPE_CHECKING:
30
+ from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
31
+
30
32
 
31
33
  class RdsDbInstanceTrigger(BaseTrigger):
32
34
  """
@@ -17,12 +17,15 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import warnings
20
+ from typing import TYPE_CHECKING
20
21
 
21
22
  from airflow.exceptions import AirflowProviderDeprecationWarning
22
- from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
23
23
  from airflow.providers.amazon.aws.hooks.redshift_cluster import RedshiftHook
24
24
  from airflow.providers.amazon.aws.triggers.base import AwsBaseWaiterTrigger
25
25
 
26
+ if TYPE_CHECKING:
27
+ from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
28
+
26
29
 
27
30
  class RedshiftCreateClusterTrigger(AwsBaseWaiterTrigger):
28
31
  """
@@ -17,13 +17,15 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import asyncio
20
- from datetime import datetime
21
20
  from functools import cached_property
22
- from typing import Any, AsyncIterator
21
+ from typing import TYPE_CHECKING, Any, AsyncIterator
23
22
 
24
23
  from airflow.providers.amazon.aws.hooks.s3 import S3Hook
25
24
  from airflow.triggers.base import BaseTrigger, TriggerEvent
26
25
 
26
+ if TYPE_CHECKING:
27
+ from datetime import datetime
28
+
27
29
 
28
30
  class S3KeyTrigger(BaseTrigger):
29
31
  """
@@ -17,14 +17,18 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import asyncio
20
- from typing import Any, AsyncIterator, Collection, Literal
20
+ from typing import TYPE_CHECKING, Any, AsyncIterator, Collection
21
+
22
+ from typing_extensions import Literal
21
23
 
22
24
  from airflow.exceptions import AirflowException
23
- from airflow.providers.amazon.aws.hooks.base_aws import BaseAwsConnection
24
25
  from airflow.providers.amazon.aws.hooks.sqs import SqsHook
25
26
  from airflow.providers.amazon.aws.utils.sqs import process_response
26
27
  from airflow.triggers.base import BaseTrigger, TriggerEvent
27
28
 
29
+ if TYPE_CHECKING:
30
+ from airflow.providers.amazon.aws.hooks.base_aws import BaseAwsConnection
31
+
28
32
 
29
33
  class SqsSensorTrigger(BaseTrigger):
30
34
  """
@@ -16,10 +16,14 @@
16
16
  # under the License.
17
17
  from __future__ import annotations
18
18
 
19
- from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
19
+ from typing import TYPE_CHECKING
20
+
20
21
  from airflow.providers.amazon.aws.hooks.step_function import StepFunctionHook
21
22
  from airflow.providers.amazon.aws.triggers.base import AwsBaseWaiterTrigger
22
23
 
24
+ if TYPE_CHECKING:
25
+ from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
26
+
23
27
 
24
28
  class StepFunctionsExecutionCompleteTrigger(AwsBaseWaiterTrigger):
25
29
  """
@@ -66,8 +66,10 @@ def datetime_to_epoch_us(date_time: datetime) -> int:
66
66
 
67
67
 
68
68
  def get_airflow_version() -> tuple[int, ...]:
69
- val = re.sub(r"(\d+\.\d+\.\d+).*", lambda x: x.group(1), version)
70
- return tuple(int(x) for x in val.split("."))
69
+ match = re.match(r"(\d+)\.(\d+)\.(\d+)", version)
70
+ if match is None: # Not theoratically possible.
71
+ raise RuntimeError(f"Broken Airflow version: {version}")
72
+ return tuple(int(x) for x in match.groups())
71
73
 
72
74
 
73
75
  class _StringCompareEnum(Enum):
@@ -17,8 +17,10 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import logging
20
+ from typing import TYPE_CHECKING
20
21
 
21
- from botocore.credentials import ReadOnlyCredentials
22
+ if TYPE_CHECKING:
23
+ from botocore.credentials import ReadOnlyCredentials
22
24
 
23
25
  log = logging.getLogger(__name__)
24
26
 
@@ -18,9 +18,10 @@ from __future__ import annotations
18
18
 
19
19
  import json
20
20
  import logging
21
- from typing import Any, Literal
21
+ from typing import Any
22
22
 
23
23
  from jsonpath_ng import parse
24
+ from typing_extensions import Literal
24
25
 
25
26
  log = logging.getLogger(__name__)
26
27
 
@@ -37,9 +38,7 @@ def process_response(
37
38
  :param response: The response from SQS
38
39
  :return: The processed response
39
40
  """
40
- if not isinstance(response, dict):
41
- return []
42
- elif "Messages" not in response:
41
+ if not isinstance(response, dict) or "Messages" not in response:
43
42
  return []
44
43
 
45
44
  messages = response["Messages"]
@@ -78,13 +77,9 @@ def filter_messages_jsonpath(messages, message_filtering_match_values, message_f
78
77
  # Body is a string, deserialize to an object and then parse
79
78
  body = json.loads(body)
80
79
  results = jsonpath_expr.find(body)
81
- if not results:
82
- continue
83
- if message_filtering_match_values is None:
80
+ if results and (
81
+ message_filtering_match_values is None
82
+ or any(result.value in message_filtering_match_values for result in results)
83
+ ):
84
84
  filtered_messages.append(message)
85
- continue
86
- for result in results:
87
- if result.value in message_filtering_match_values:
88
- filtered_messages.append(message)
89
- break
90
85
  return filtered_messages
@@ -0,0 +1,74 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ """
19
+ Module for suppress errors in Amazon Provider.
20
+
21
+ .. warning::
22
+ Only for internal usage, this module might be changed or removed in the future
23
+ without any further notice.
24
+
25
+ :meta: private
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ import logging
31
+ from functools import wraps
32
+ from typing import Callable, TypeVar
33
+
34
+ from airflow.typing_compat import ParamSpec
35
+
36
+ PS = ParamSpec("PS")
37
+ RT = TypeVar("RT")
38
+
39
+ log = logging.getLogger(__name__)
40
+
41
+
42
+ def return_on_error(return_value: RT):
43
+ """
44
+ Helper decorator which suppress any ``Exception`` raised in decorator function.
45
+
46
+ Main use-case when functional is optional, however any error on functions/methods might
47
+ raise any error which are subclass of ``Exception``.
48
+
49
+ .. note::
50
+ Decorator doesn't intend to catch ``BaseException``,
51
+ e.g. ``GeneratorExit``, ``KeyboardInterrupt``, ``SystemExit`` and others.
52
+
53
+ .. warning::
54
+ Only for internal usage, this decorator might be changed or removed in the future
55
+ without any further notice.
56
+
57
+ :param return_value: Return value if decorated function/method raise any ``Exception``.
58
+ :meta: private
59
+ """
60
+
61
+ def decorator(func: Callable[PS, RT]) -> Callable[PS, RT]:
62
+ @wraps(func)
63
+ def wrapper(*args, **kwargs) -> RT:
64
+ try:
65
+ return func(*args, **kwargs)
66
+ except Exception:
67
+ log.debug(
68
+ "Encountered error during execution function/method %r", func.__name__, exc_info=True
69
+ )
70
+ return return_value
71
+
72
+ return wrapper
73
+
74
+ return decorator
@@ -19,14 +19,16 @@ from __future__ import annotations
19
19
 
20
20
  import time
21
21
  from datetime import datetime, timedelta
22
- from logging import Logger
23
22
  from threading import Event, Thread
24
- from typing import Generator
23
+ from typing import TYPE_CHECKING, Generator
25
24
 
26
25
  from botocore.exceptions import ClientError, ConnectionClosedError
27
26
 
28
27
  from airflow.providers.amazon.aws.hooks.logs import AwsLogsHook
29
28
 
29
+ if TYPE_CHECKING:
30
+ from logging import Logger
31
+
30
32
 
31
33
  class AwsTaskLogFetcher(Thread):
32
34
  """Fetch Cloudwatch log events with specific interval and send the log events to the logger.info."""
@@ -20,14 +20,16 @@ from __future__ import annotations
20
20
  import asyncio
21
21
  import logging
22
22
  import time
23
- from typing import Any
23
+ from typing import TYPE_CHECKING, Any
24
24
 
25
25
  import jmespath
26
26
  from botocore.exceptions import WaiterError
27
- from botocore.waiter import Waiter
28
27
 
29
28
  from airflow.exceptions import AirflowException
30
29
 
30
+ if TYPE_CHECKING:
31
+ from botocore.waiter import Waiter
32
+
31
33
 
32
34
  def wait(
33
35
  waiter: Waiter,
@@ -17,9 +17,13 @@
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- import boto3
20
+ from typing import TYPE_CHECKING
21
+
21
22
  from botocore.waiter import Waiter, WaiterModel, create_waiter_with_client
22
23
 
24
+ if TYPE_CHECKING:
25
+ import boto3
26
+
23
27
 
24
28
  class BaseBotoWaiter:
25
29
  """
@@ -29,6 +29,7 @@ def get_provider_info():
29
29
  "description": "Amazon integration (including `Amazon Web Services (AWS) <https://aws.amazon.com/>`__).\n",
30
30
  "suspended": False,
31
31
  "versions": [
32
+ "8.7.0",
32
33
  "8.6.0",
33
34
  "8.5.1",
34
35
  "8.5.0",
@@ -75,10 +76,6 @@ def get_provider_info():
75
76
  "apache-airflow-providers-common-sql>=1.3.1",
76
77
  "apache-airflow-providers-http",
77
78
  "boto3>=1.28.0",
78
- "mypy-boto3-rds>=1.28.0",
79
- "mypy-boto3-redshift-data>=1.28.0",
80
- "mypy-boto3-s3>=1.28.0",
81
- "mypy-boto3-appflow>=1.28.0",
82
79
  "botocore>=1.31.0",
83
80
  "asgiref",
84
81
  "watchtower~=2.0.1",
@@ -873,7 +870,11 @@ def get_provider_info():
873
870
  "connection-type": "redshift",
874
871
  },
875
872
  ],
876
- "notifications": ["airflow.providers.amazon.aws.notifications.chime.ChimeNotifier"],
873
+ "notifications": [
874
+ "airflow.providers.amazon.aws.notifications.chime.ChimeNotifier",
875
+ "airflow.providers.amazon.aws.notifications.sns.SnsNotifier",
876
+ "airflow.providers.amazon.aws.notifications.sqs.SqsNotifier",
877
+ ],
877
878
  "secrets-backends": [
878
879
  "airflow.providers.amazon.aws.secrets.secrets_manager.SecretsManagerBackend",
879
880
  "airflow.providers.amazon.aws.secrets.systems_manager.SystemsManagerParameterStoreBackend",
@@ -887,4 +888,18 @@ def get_provider_info():
887
888
  {"name": "aiobotocore", "dependencies": ["aiobotocore[boto3]>=2.5.3"]},
888
889
  {"name": "cncf.kubernetes", "dependencies": ["apache-airflow-providers-cncf-kubernetes>=7.2.0"]},
889
890
  ],
891
+ "config": {
892
+ "aws": {
893
+ "description": "This section contains settings for Amazon Web Services (AWS) integration.",
894
+ "options": {
895
+ "session_factory": {
896
+ "description": "Full import path to the class which implements a custom session factory for\n``boto3.session.Session``. For more details please have a look at\n:ref:`howto/connection:aws:session-factory`.\n",
897
+ "default": None,
898
+ "example": "my_company.aws.MyCustomSessionFactory",
899
+ "type": "string",
900
+ "version_added": "3.1.1",
901
+ }
902
+ },
903
+ }
904
+ },
890
905
  }
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-amazon
3
- Version: 8.6.0
3
+ Version: 8.7.0
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-amazon package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.6.0/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.6.0/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.7.0/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.7.0/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -38,10 +38,6 @@ Requires-Dist: asgiref
38
38
  Requires-Dist: boto3 >=1.28.0
39
39
  Requires-Dist: botocore >=1.31.0
40
40
  Requires-Dist: jsonpath-ng >=1.5.3
41
- Requires-Dist: mypy-boto3-appflow >=1.28.0
42
- Requires-Dist: mypy-boto3-rds >=1.28.0
43
- Requires-Dist: mypy-boto3-redshift-data >=1.28.0
44
- Requires-Dist: mypy-boto3-s3 >=1.28.0
45
41
  Requires-Dist: redshift-connector >=2.0.888
46
42
  Requires-Dist: sqlalchemy-redshift >=0.8.6
47
43
  Requires-Dist: watchtower ~=2.0.1
@@ -114,7 +110,7 @@ Requires-Dist: apache-airflow-providers-ssh ; extra == 'ssh'
114
110
 
115
111
  Package ``apache-airflow-providers-amazon``
116
112
 
117
- Release: ``8.6.0``
113
+ Release: ``8.7.0``
118
114
 
119
115
 
120
116
  Amazon integration (including `Amazon Web Services (AWS) <https://aws.amazon.com/>`__).
@@ -127,7 +123,7 @@ This is a provider package for ``amazon`` provider. All classes for this provide
127
123
  are in ``airflow.providers.amazon`` python package.
128
124
 
129
125
  You can find package information and changelog for the provider
130
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.6.0/>`_.
126
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.7.0/>`_.
131
127
 
132
128
 
133
129
  Installation
@@ -149,10 +145,6 @@ PIP package Version required
149
145
  ``apache-airflow-providers-common-sql`` ``>=1.3.1``
150
146
  ``apache-airflow-providers-http``
151
147
  ``boto3`` ``>=1.28.0``
152
- ``mypy-boto3-rds`` ``>=1.28.0``
153
- ``mypy-boto3-redshift-data`` ``>=1.28.0``
154
- ``mypy-boto3-s3`` ``>=1.28.0``
155
- ``mypy-boto3-appflow`` ``>=1.28.0``
156
148
  ``botocore`` ``>=1.31.0``
157
149
  ``asgiref``
158
150
  ``watchtower`` ``~=2.0.1``
@@ -194,4 +186,4 @@ Dependent package
194
186
  ====================================================================================================================== ===================
195
187
 
196
188
  The changelog for the provider package can be found in the
197
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.6.0/changelog.html>`_.
189
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-amazon/8.7.0/changelog.html>`_.