apache-airflow-providers-standard 0.1.0rc1__py3-none-any.whl → 0.1.1__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.
- airflow/providers/standard/__init__.py +1 -1
- airflow/providers/standard/get_provider_info.py +5 -4
- airflow/providers/standard/operators/latest_only.py +4 -3
- airflow/providers/standard/operators/python.py +1 -3
- airflow/providers/standard/operators/smooth.py +38 -0
- airflow/providers/standard/operators/trigger_dagrun.py +16 -4
- airflow/providers/standard/sensors/external_task.py +16 -4
- {apache_airflow_providers_standard-0.1.0rc1.dist-info → apache_airflow_providers_standard-0.1.1.dist-info}/METADATA +30 -33
- {apache_airflow_providers_standard-0.1.0rc1.dist-info → apache_airflow_providers_standard-0.1.1.dist-info}/RECORD +11 -11
- {apache_airflow_providers_standard-0.1.0rc1.dist-info → apache_airflow_providers_standard-0.1.1.dist-info}/WHEEL +1 -1
- airflow/providers/standard/operators/generic_transfer.py +0 -138
- {apache_airflow_providers_standard-0.1.0rc1.dist-info → apache_airflow_providers_standard-0.1.1.dist-info}/entry_points.txt +0 -0
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "0.1.
|
|
32
|
+
__version__ = "0.1.1"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
35
|
"2.9.0"
|
|
@@ -27,8 +27,8 @@ def get_provider_info():
|
|
|
27
27
|
"name": "Standard",
|
|
28
28
|
"description": "Airflow Standard Provider\n",
|
|
29
29
|
"state": "ready",
|
|
30
|
-
"source-date-epoch":
|
|
31
|
-
"versions": ["0.1.0", "0.0.3", "0.0.2", "0.0.1"],
|
|
30
|
+
"source-date-epoch": 1741509906,
|
|
31
|
+
"versions": ["0.1.1", "0.1.0", "0.0.3", "0.0.2", "0.0.1"],
|
|
32
32
|
"integrations": [
|
|
33
33
|
{
|
|
34
34
|
"integration-name": "Standard",
|
|
@@ -50,9 +50,9 @@ def get_provider_info():
|
|
|
50
50
|
"airflow.providers.standard.operators.bash",
|
|
51
51
|
"airflow.providers.standard.operators.python",
|
|
52
52
|
"airflow.providers.standard.operators.empty",
|
|
53
|
-
"airflow.providers.standard.operators.generic_transfer",
|
|
54
53
|
"airflow.providers.standard.operators.trigger_dagrun",
|
|
55
54
|
"airflow.providers.standard.operators.latest_only",
|
|
55
|
+
"airflow.providers.standard.operators.smooth",
|
|
56
56
|
],
|
|
57
57
|
}
|
|
58
58
|
],
|
|
@@ -105,5 +105,6 @@ def get_provider_info():
|
|
|
105
105
|
},
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
|
-
"dependencies": ["apache-airflow>=2.9.0"
|
|
108
|
+
"dependencies": ["apache-airflow>=2.9.0"],
|
|
109
|
+
"devel-dependencies": [],
|
|
109
110
|
}
|
|
@@ -25,6 +25,7 @@ from typing import TYPE_CHECKING
|
|
|
25
25
|
import pendulum
|
|
26
26
|
|
|
27
27
|
from airflow.operators.branch import BaseBranchOperator
|
|
28
|
+
from airflow.utils.types import DagRunType
|
|
28
29
|
|
|
29
30
|
if TYPE_CHECKING:
|
|
30
31
|
from airflow.models import DAG, DagRun
|
|
@@ -40,7 +41,7 @@ class LatestOnlyOperator(BaseBranchOperator):
|
|
|
40
41
|
"""
|
|
41
42
|
Skip tasks that are not running during the most recent schedule interval.
|
|
42
43
|
|
|
43
|
-
If the task is run outside the latest schedule interval (i.e.
|
|
44
|
+
If the task is run outside the latest schedule interval (i.e. run_type == DagRunType.MANUAL),
|
|
44
45
|
all directly downstream tasks will be skipped.
|
|
45
46
|
|
|
46
47
|
Note that downstream tasks are never skipped if the given DAG_Run is
|
|
@@ -53,8 +54,8 @@ class LatestOnlyOperator(BaseBranchOperator):
|
|
|
53
54
|
# If the DAG Run is externally triggered, then return without
|
|
54
55
|
# skipping downstream tasks
|
|
55
56
|
dag_run: DagRun = context["dag_run"] # type: ignore[assignment]
|
|
56
|
-
if dag_run.
|
|
57
|
-
self.log.info("
|
|
57
|
+
if dag_run.run_type == DagRunType.MANUAL:
|
|
58
|
+
self.log.info("Manually triggered DAG_Run: allowing execution to proceed.")
|
|
58
59
|
return list(context["task"].get_direct_relative_ids(upstream=False))
|
|
59
60
|
|
|
60
61
|
dag: DAG = context["dag"] # type: ignore[assignment]
|
|
@@ -394,8 +394,6 @@ class _BasePythonVirtualenvOperator(PythonOperator, metaclass=ABCMeta):
|
|
|
394
394
|
"prev_execution_date",
|
|
395
395
|
"prev_execution_date_success",
|
|
396
396
|
}
|
|
397
|
-
if AIRFLOW_V_3_0_PLUS:
|
|
398
|
-
PENDULUM_SERIALIZABLE_CONTEXT_KEYS.add("start_date")
|
|
399
397
|
|
|
400
398
|
AIRFLOW_SERIALIZABLE_CONTEXT_KEYS = {
|
|
401
399
|
"macros",
|
|
@@ -793,7 +791,7 @@ class PythonVirtualenvOperator(_BasePythonVirtualenvOperator):
|
|
|
793
791
|
if hash_marker.exists():
|
|
794
792
|
previous_hash_data = hash_marker.read_text(encoding="utf8")
|
|
795
793
|
if previous_hash_data == hash_data:
|
|
796
|
-
self.log.info("
|
|
794
|
+
self.log.info("Reusing cached Python virtual environment in %s", venv_path)
|
|
797
795
|
return venv_path
|
|
798
796
|
|
|
799
797
|
_, hash_data_before_upgrade = self._calculate_cache_hash(exclude_cloudpickle=True)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
|
4
|
+
# distributed with this work for additional information
|
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
|
7
|
+
# "License"); you may not use this file except in compliance
|
|
8
|
+
# with the License. You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
|
13
|
+
# software distributed under the License is distributed on an
|
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
# KIND, either express or implied. See the License for the
|
|
16
|
+
# specific language governing permissions and limitations
|
|
17
|
+
# under the License.
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing import TYPE_CHECKING
|
|
21
|
+
|
|
22
|
+
from airflow.models.baseoperator import BaseOperator
|
|
23
|
+
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from airflow.sdk.definitions.context import Context
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SmoothOperator(BaseOperator):
|
|
29
|
+
"""Operator that logs a YouTube link to Sade song "Smooth Operator"."""
|
|
30
|
+
|
|
31
|
+
ui_color = "#e8f7e4"
|
|
32
|
+
yt_link: str = "https://www.youtube.com/watch?v=4TYv2PhG89A"
|
|
33
|
+
|
|
34
|
+
def __init__(self, **kwargs) -> None:
|
|
35
|
+
super().__init__(**kwargs)
|
|
36
|
+
|
|
37
|
+
def execute(self, context: Context):
|
|
38
|
+
self.log.info("Enjoy Sade - Smooth Operator: %s", self.yt_link)
|
|
@@ -34,14 +34,14 @@ from airflow.exceptions import (
|
|
|
34
34
|
DagNotFound,
|
|
35
35
|
DagRunAlreadyExists,
|
|
36
36
|
)
|
|
37
|
-
from airflow.models import BaseOperator
|
|
37
|
+
from airflow.models import BaseOperator
|
|
38
38
|
from airflow.models.dag import DagModel
|
|
39
39
|
from airflow.models.dagbag import DagBag
|
|
40
40
|
from airflow.models.dagrun import DagRun
|
|
41
41
|
from airflow.models.xcom import XCom
|
|
42
42
|
from airflow.providers.standard.triggers.external_task import DagStateTrigger
|
|
43
|
+
from airflow.providers.standard.version_compat import AIRFLOW_V_3_0_PLUS
|
|
43
44
|
from airflow.utils import timezone
|
|
44
|
-
from airflow.utils.helpers import build_airflow_url_with_query
|
|
45
45
|
from airflow.utils.session import provide_session
|
|
46
46
|
from airflow.utils.state import DagRunState
|
|
47
47
|
from airflow.utils.types import DagRunTriggeredByType, DagRunType
|
|
@@ -61,6 +61,11 @@ if TYPE_CHECKING:
|
|
|
61
61
|
# TODO: Remove once provider drops support for Airflow 2
|
|
62
62
|
from airflow.utils.context import Context
|
|
63
63
|
|
|
64
|
+
if AIRFLOW_V_3_0_PLUS:
|
|
65
|
+
from airflow.sdk import BaseOperatorLink
|
|
66
|
+
else:
|
|
67
|
+
from airflow.models.baseoperatorlink import BaseOperatorLink # type: ignore[no-redef]
|
|
68
|
+
|
|
64
69
|
|
|
65
70
|
class TriggerDagRunLink(BaseOperatorLink):
|
|
66
71
|
"""
|
|
@@ -86,8 +91,15 @@ class TriggerDagRunLink(BaseOperatorLink):
|
|
|
86
91
|
# stored in xcom during execution of the triggerING task.
|
|
87
92
|
triggered_dag_run_id = XCom.get_value(ti_key=ti_key, key=XCOM_RUN_ID)
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
if AIRFLOW_V_3_0_PLUS:
|
|
95
|
+
from airflow.utils.helpers import build_airflow_dagrun_url
|
|
96
|
+
|
|
97
|
+
return build_airflow_dagrun_url(dag_id=trigger_dag_id, run_id=triggered_dag_run_id)
|
|
98
|
+
else:
|
|
99
|
+
from airflow.utils.helpers import build_airflow_url_with_query # type:ignore[attr-defined]
|
|
100
|
+
|
|
101
|
+
query = {"dag_id": trigger_dag_id, "dag_run_id": triggered_dag_run_id}
|
|
102
|
+
return build_airflow_url_with_query(query)
|
|
91
103
|
|
|
92
104
|
|
|
93
105
|
class TriggerDagRunOperator(BaseOperator):
|
|
@@ -25,15 +25,14 @@ from typing import TYPE_CHECKING, Any, Callable, ClassVar
|
|
|
25
25
|
|
|
26
26
|
from airflow.configuration import conf
|
|
27
27
|
from airflow.exceptions import AirflowException, AirflowSkipException
|
|
28
|
-
from airflow.models.baseoperatorlink import BaseOperatorLink
|
|
29
28
|
from airflow.models.dag import DagModel
|
|
30
29
|
from airflow.models.dagbag import DagBag
|
|
31
30
|
from airflow.providers.standard.operators.empty import EmptyOperator
|
|
32
31
|
from airflow.providers.standard.triggers.external_task import WorkflowTrigger
|
|
33
32
|
from airflow.providers.standard.utils.sensor_helper import _get_count, _get_external_task_group_task_ids
|
|
33
|
+
from airflow.providers.standard.version_compat import AIRFLOW_V_3_0_PLUS
|
|
34
34
|
from airflow.sensors.base import BaseSensorOperator
|
|
35
35
|
from airflow.utils.file import correct_maybe_zipped
|
|
36
|
-
from airflow.utils.helpers import build_airflow_url_with_query
|
|
37
36
|
from airflow.utils.session import NEW_SESSION, provide_session
|
|
38
37
|
from airflow.utils.state import State, TaskInstanceState
|
|
39
38
|
|
|
@@ -50,6 +49,12 @@ if TYPE_CHECKING:
|
|
|
50
49
|
from airflow.utils.context import Context
|
|
51
50
|
|
|
52
51
|
|
|
52
|
+
if AIRFLOW_V_3_0_PLUS:
|
|
53
|
+
from airflow.sdk import BaseOperatorLink
|
|
54
|
+
else:
|
|
55
|
+
from airflow.models.baseoperatorlink import BaseOperatorLink # type: ignore[no-redef]
|
|
56
|
+
|
|
57
|
+
|
|
53
58
|
class ExternalDagLink(BaseOperatorLink):
|
|
54
59
|
"""
|
|
55
60
|
Operator link for ExternalTaskSensor and ExternalTaskMarker.
|
|
@@ -70,8 +75,15 @@ class ExternalDagLink(BaseOperatorLink):
|
|
|
70
75
|
else:
|
|
71
76
|
external_dag_id = operator.external_dag_id
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
if AIRFLOW_V_3_0_PLUS:
|
|
79
|
+
from airflow.utils.helpers import build_airflow_dagrun_url
|
|
80
|
+
|
|
81
|
+
return build_airflow_dagrun_url(dag_id=external_dag_id, run_id=ti_key.run_id)
|
|
82
|
+
else:
|
|
83
|
+
from airflow.utils.helpers import build_airflow_url_with_query # type:ignore[attr-defined]
|
|
84
|
+
|
|
85
|
+
query = {"dag_id": external_dag_id, "run_id": ti_key.run_id}
|
|
86
|
+
return build_airflow_url_with_query(query)
|
|
75
87
|
|
|
76
88
|
|
|
77
89
|
class ExternalTaskSensor(BaseSensorOperator):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-airflow-providers-standard
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Provider package apache-airflow-providers-standard for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,standard,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
@@ -20,43 +20,41 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
|
23
|
-
Requires-Dist: apache-airflow>=2.9.
|
|
24
|
-
Requires-Dist: apache-airflow-providers-common-sql>=1.20.0rc0
|
|
23
|
+
Requires-Dist: apache-airflow>=2.9.0
|
|
25
24
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
26
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.
|
|
27
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.
|
|
25
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.1/changelog.html
|
|
26
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.1
|
|
28
27
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
29
28
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
30
29
|
Project-URL: Twitter, https://x.com/ApacheAirflow
|
|
31
30
|
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
32
31
|
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
|
34
|
+
or more contributor license agreements. See the NOTICE file
|
|
35
|
+
distributed with this work for additional information
|
|
36
|
+
regarding copyright ownership. The ASF licenses this file
|
|
37
|
+
to you under the Apache License, Version 2.0 (the
|
|
38
|
+
"License"); you may not use this file except in compliance
|
|
39
|
+
with the License. You may obtain a copy of the License at
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
.. Unless required by applicable law or agreed to in writing,
|
|
44
|
+
software distributed under the License is distributed on an
|
|
45
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
46
|
+
KIND, either express or implied. See the License for the
|
|
47
|
+
specific language governing permissions and limitations
|
|
48
|
+
under the License.
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
54
|
-
`PROVIDER_README_TEMPLATE.rst.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
|
|
50
|
+
.. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
|
|
55
51
|
|
|
52
|
+
.. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
53
|
+
``PROVIDER_README_TEMPLATE.rst.jinja2`` IN the ``dev/breeze/src/airflow_breeze/templates`` DIRECTORY
|
|
56
54
|
|
|
57
55
|
Package ``apache-airflow-providers-standard``
|
|
58
56
|
|
|
59
|
-
Release: ``0.1.
|
|
57
|
+
Release: ``0.1.1``
|
|
60
58
|
|
|
61
59
|
|
|
62
60
|
Airflow Standard Provider
|
|
@@ -69,7 +67,7 @@ This is a provider package for ``standard`` provider. All classes for this provi
|
|
|
69
67
|
are in ``airflow.providers.standard`` python package.
|
|
70
68
|
|
|
71
69
|
You can find package information and changelog for the provider
|
|
72
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.
|
|
70
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.1/>`_.
|
|
73
71
|
|
|
74
72
|
Installation
|
|
75
73
|
------------
|
|
@@ -83,13 +81,12 @@ The package supports the following python versions: 3.9,3.10,3.11,3.12
|
|
|
83
81
|
Requirements
|
|
84
82
|
------------
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
PIP package
|
|
88
|
-
|
|
89
|
-
``apache-airflow``
|
|
90
|
-
|
|
91
|
-
======================================= ==================
|
|
84
|
+
================== ==================
|
|
85
|
+
PIP package Version required
|
|
86
|
+
================== ==================
|
|
87
|
+
``apache-airflow`` ``>=2.9.0``
|
|
88
|
+
================== ==================
|
|
92
89
|
|
|
93
90
|
The changelog for the provider package can be found in the
|
|
94
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.
|
|
91
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-standard/0.1.1/changelog.html>`_.
|
|
95
92
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
airflow/providers/standard/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
|
|
2
|
-
airflow/providers/standard/__init__.py,sha256=
|
|
3
|
-
airflow/providers/standard/get_provider_info.py,sha256=
|
|
2
|
+
airflow/providers/standard/__init__.py,sha256=oKPXyaF0Nga5JSyyp76PexiS-ziduggLTXve8T5s6kQ,1495
|
|
3
|
+
airflow/providers/standard/get_provider_info.py,sha256=sfKYpLnXfvTkEo96DyJbJdc0C5EW5QTIMzAiFXreZRU,4925
|
|
4
4
|
airflow/providers/standard/version_compat.py,sha256=aHg90_DtgoSnQvILFICexMyNlHlALBdaeWqkX3dFDug,1605
|
|
5
5
|
airflow/providers/standard/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
6
6
|
airflow/providers/standard/hooks/filesystem.py,sha256=fDZwW_EYD8z1QXnReqI7gIwSbDPZNTKtqQvgktiP02o,2870
|
|
@@ -10,15 +10,15 @@ airflow/providers/standard/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOF
|
|
|
10
10
|
airflow/providers/standard/operators/bash.py,sha256=AMSTPCgtArDE78XQ01b5jf1d3HEbZuP8_xz9dyXQgKc,13664
|
|
11
11
|
airflow/providers/standard/operators/datetime.py,sha256=vsn2eaeVvUZBLXTzrEIC5Bd9svk81gM2VlxXCcmZhHY,4749
|
|
12
12
|
airflow/providers/standard/operators/empty.py,sha256=C7_uLWJK6kExzlNc7xdMo8VAQ_ONWITvEQ2FImrMepM,1324
|
|
13
|
-
airflow/providers/standard/operators/
|
|
14
|
-
airflow/providers/standard/operators/
|
|
15
|
-
airflow/providers/standard/operators/
|
|
16
|
-
airflow/providers/standard/operators/trigger_dagrun.py,sha256=
|
|
13
|
+
airflow/providers/standard/operators/latest_only.py,sha256=iENi2PkJoQH-S_xP6v-vW1UtIM5srfjJz4ho-vPeTeI,3358
|
|
14
|
+
airflow/providers/standard/operators/python.py,sha256=3M_i160nXjRRNpCLJkno2k8GvaLyw6vEkiDBG--4W2o,49158
|
|
15
|
+
airflow/providers/standard/operators/smooth.py,sha256=d3OV38EzV_wlfMYN3JGWGwyzsFonx8VbqgGfXSw0_bM,1382
|
|
16
|
+
airflow/providers/standard/operators/trigger_dagrun.py,sha256=MO4im8m1PbM8G_HYxx4rNeRzK54683CNslAYyl9BYxw,12785
|
|
17
17
|
airflow/providers/standard/operators/weekday.py,sha256=XL1fMejCoCrifl52t9QmlrnavL3Nm3_VYbhUMWhI10I,4841
|
|
18
18
|
airflow/providers/standard/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
19
19
|
airflow/providers/standard/sensors/bash.py,sha256=afyz1m-1qzAp1fE5ta71rXhpTrKcCH7bNfwUU2Hv7GQ,5025
|
|
20
20
|
airflow/providers/standard/sensors/date_time.py,sha256=hRUuLaNgqDh4jqaIaD8zdyq2BUXkpWM2NzJN5YkwTJI,6077
|
|
21
|
-
airflow/providers/standard/sensors/external_task.py,sha256=
|
|
21
|
+
airflow/providers/standard/sensors/external_task.py,sha256=LJhmPg0dSxcZQ7OfNf5CmBNfujOss-bV7cVlwCA1IRU,24276
|
|
22
22
|
airflow/providers/standard/sensors/filesystem.py,sha256=rfupSeHtFGdAcL6cw3H6u6ttBxogSThYiPqsUKgABMU,6029
|
|
23
23
|
airflow/providers/standard/sensors/python.py,sha256=kvgpHN8hiyxJPlw9HsVpna0X6NRt0iTDvFFjqt3KFtQ,3405
|
|
24
24
|
airflow/providers/standard/sensors/time.py,sha256=Pc9BZqqTQy3Qqz7uME9yF4qmWsXYCzAoAlsmwgpAraY,5007
|
|
@@ -32,7 +32,7 @@ airflow/providers/standard/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xS
|
|
|
32
32
|
airflow/providers/standard/utils/python_virtualenv.py,sha256=FR3241l5Obuo2BBwwBs-s87pRpCLyJnh3sUtHxrgRuM,7759
|
|
33
33
|
airflow/providers/standard/utils/python_virtualenv_script.jinja2,sha256=bn_QOYOj8Q2k-RE77LKgCy3iDTuv9vllyBAD4yeCb-A,2502
|
|
34
34
|
airflow/providers/standard/utils/sensor_helper.py,sha256=BeaWt9X4PUE49V3QAG8WPHj3fWwUGeZngS5_Y8g_auA,4401
|
|
35
|
-
apache_airflow_providers_standard-0.1.
|
|
36
|
-
apache_airflow_providers_standard-0.1.
|
|
37
|
-
apache_airflow_providers_standard-0.1.
|
|
38
|
-
apache_airflow_providers_standard-0.1.
|
|
35
|
+
apache_airflow_providers_standard-0.1.1.dist-info/entry_points.txt,sha256=mW2YRh3mVdZdaP5-iGSNgmcCh3YYdALIn28BCLBZZ40,104
|
|
36
|
+
apache_airflow_providers_standard-0.1.1.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
|
|
37
|
+
apache_airflow_providers_standard-0.1.1.dist-info/METADATA,sha256=X1kssJUc5on81RSs1saVOPnQOGIipO_qqaBoZU0TUO0,3782
|
|
38
|
+
apache_airflow_providers_standard-0.1.1.dist-info/RECORD,,
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
|
4
|
-
# distributed with this work for additional information
|
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
|
7
|
-
# "License"); you may not use this file except in compliance
|
|
8
|
-
# with the License. You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
|
13
|
-
# software distributed under the License is distributed on an
|
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
# KIND, either express or implied. See the License for the
|
|
16
|
-
# specific language governing permissions and limitations
|
|
17
|
-
# under the License.
|
|
18
|
-
from __future__ import annotations
|
|
19
|
-
|
|
20
|
-
from collections.abc import Sequence
|
|
21
|
-
from typing import TYPE_CHECKING
|
|
22
|
-
|
|
23
|
-
from airflow.hooks.base import BaseHook
|
|
24
|
-
from airflow.models import BaseOperator
|
|
25
|
-
|
|
26
|
-
if TYPE_CHECKING:
|
|
27
|
-
try:
|
|
28
|
-
from airflow.sdk.definitions.context import Context
|
|
29
|
-
except ImportError:
|
|
30
|
-
# TODO: Remove once provider drops support for Airflow 2
|
|
31
|
-
from airflow.utils.context import Context
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class GenericTransfer(BaseOperator):
|
|
35
|
-
"""
|
|
36
|
-
Moves data from a connection to another.
|
|
37
|
-
|
|
38
|
-
Assuming that they both provide the required methods in their respective hooks.
|
|
39
|
-
The source hook needs to expose a `get_records` method, and the destination a
|
|
40
|
-
`insert_rows` method.
|
|
41
|
-
|
|
42
|
-
This is meant to be used on small-ish datasets that fit in memory.
|
|
43
|
-
|
|
44
|
-
:param sql: SQL query to execute against the source database. (templated)
|
|
45
|
-
:param destination_table: target table. (templated)
|
|
46
|
-
:param source_conn_id: source connection. (templated)
|
|
47
|
-
:param destination_conn_id: destination connection. (templated)
|
|
48
|
-
:param preoperator: sql statement or list of statements to be
|
|
49
|
-
executed prior to loading the data. (templated)
|
|
50
|
-
:param insert_args: extra params for `insert_rows` method.
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
template_fields: Sequence[str] = (
|
|
54
|
-
"source_conn_id",
|
|
55
|
-
"destination_conn_id",
|
|
56
|
-
"sql",
|
|
57
|
-
"destination_table",
|
|
58
|
-
"preoperator",
|
|
59
|
-
"insert_args",
|
|
60
|
-
)
|
|
61
|
-
template_ext: Sequence[str] = (
|
|
62
|
-
".sql",
|
|
63
|
-
".hql",
|
|
64
|
-
)
|
|
65
|
-
template_fields_renderers = {"preoperator": "sql"}
|
|
66
|
-
ui_color = "#b0f07c"
|
|
67
|
-
|
|
68
|
-
def __init__(
|
|
69
|
-
self,
|
|
70
|
-
*,
|
|
71
|
-
sql: str,
|
|
72
|
-
destination_table: str,
|
|
73
|
-
source_conn_id: str,
|
|
74
|
-
source_hook_params: dict | None = None,
|
|
75
|
-
destination_conn_id: str,
|
|
76
|
-
destination_hook_params: dict | None = None,
|
|
77
|
-
preoperator: str | list[str] | None = None,
|
|
78
|
-
insert_args: dict | None = None,
|
|
79
|
-
**kwargs,
|
|
80
|
-
) -> None:
|
|
81
|
-
super().__init__(**kwargs)
|
|
82
|
-
self.sql = sql
|
|
83
|
-
self.destination_table = destination_table
|
|
84
|
-
self.source_conn_id = source_conn_id
|
|
85
|
-
self.source_hook_params = source_hook_params
|
|
86
|
-
self.destination_conn_id = destination_conn_id
|
|
87
|
-
self.destination_hook_params = destination_hook_params
|
|
88
|
-
self.preoperator = preoperator
|
|
89
|
-
self.insert_args = insert_args or {}
|
|
90
|
-
|
|
91
|
-
@classmethod
|
|
92
|
-
def get_hook(cls, conn_id: str, hook_params: dict | None = None) -> BaseHook:
|
|
93
|
-
"""
|
|
94
|
-
Return default hook for this connection id.
|
|
95
|
-
|
|
96
|
-
:param conn_id: connection id
|
|
97
|
-
:param hook_params: hook parameters
|
|
98
|
-
:return: default hook for this connection
|
|
99
|
-
"""
|
|
100
|
-
connection = BaseHook.get_connection(conn_id)
|
|
101
|
-
return connection.get_hook(hook_params=hook_params)
|
|
102
|
-
|
|
103
|
-
def execute(self, context: Context):
|
|
104
|
-
source_hook = self.get_hook(conn_id=self.source_conn_id, hook_params=self.source_hook_params)
|
|
105
|
-
destination_hook = self.get_hook(
|
|
106
|
-
conn_id=self.destination_conn_id, hook_params=self.destination_hook_params
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
self.log.info("Extracting data from %s", self.source_conn_id)
|
|
110
|
-
self.log.info("Executing: \n %s", self.sql)
|
|
111
|
-
get_records = getattr(source_hook, "get_records", None)
|
|
112
|
-
if not callable(get_records):
|
|
113
|
-
raise RuntimeError(
|
|
114
|
-
f"Hook for connection {self.source_conn_id!r} "
|
|
115
|
-
f"({type(source_hook).__name__}) has no `get_records` method"
|
|
116
|
-
)
|
|
117
|
-
else:
|
|
118
|
-
results = get_records(self.sql)
|
|
119
|
-
|
|
120
|
-
if self.preoperator:
|
|
121
|
-
run = getattr(destination_hook, "run", None)
|
|
122
|
-
if not callable(run):
|
|
123
|
-
raise RuntimeError(
|
|
124
|
-
f"Hook for connection {self.destination_conn_id!r} "
|
|
125
|
-
f"({type(destination_hook).__name__}) has no `run` method"
|
|
126
|
-
)
|
|
127
|
-
self.log.info("Running preoperator")
|
|
128
|
-
self.log.info(self.preoperator)
|
|
129
|
-
run(self.preoperator)
|
|
130
|
-
|
|
131
|
-
insert_rows = getattr(destination_hook, "insert_rows", None)
|
|
132
|
-
if not callable(insert_rows):
|
|
133
|
-
raise RuntimeError(
|
|
134
|
-
f"Hook for connection {self.destination_conn_id!r} "
|
|
135
|
-
f"({type(destination_hook).__name__}) has no `insert_rows` method"
|
|
136
|
-
)
|
|
137
|
-
self.log.info("Inserting rows into %s", self.destination_conn_id)
|
|
138
|
-
insert_rows(table=self.destination_table, rows=results, **self.insert_args)
|