apache-airflow-providers-google 12.0.0rc2__py3-none-any.whl → 13.0.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.
- airflow/providers/google/LICENSE +0 -52
- airflow/providers/google/__init__.py +1 -1
- airflow/providers/google/ads/hooks/ads.py +27 -13
- airflow/providers/google/ads/transfers/ads_to_gcs.py +18 -4
- airflow/providers/google/assets/bigquery.py +17 -0
- airflow/providers/google/cloud/_internal_client/secret_manager_client.py +2 -3
- airflow/providers/google/cloud/hooks/alloy_db.py +736 -8
- airflow/providers/google/cloud/hooks/automl.py +10 -4
- airflow/providers/google/cloud/hooks/bigquery.py +125 -22
- airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
- airflow/providers/google/cloud/hooks/bigtable.py +2 -3
- airflow/providers/google/cloud/hooks/cloud_batch.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_build.py +4 -5
- airflow/providers/google/cloud/hooks/cloud_composer.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_run.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_sql.py +7 -3
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +119 -7
- airflow/providers/google/cloud/hooks/compute.py +3 -3
- airflow/providers/google/cloud/hooks/datacatalog.py +3 -4
- airflow/providers/google/cloud/hooks/dataflow.py +12 -12
- airflow/providers/google/cloud/hooks/dataform.py +2 -3
- airflow/providers/google/cloud/hooks/datafusion.py +2 -2
- airflow/providers/google/cloud/hooks/dataplex.py +1032 -11
- airflow/providers/google/cloud/hooks/dataproc.py +4 -5
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +3 -4
- airflow/providers/google/cloud/hooks/dlp.py +3 -4
- airflow/providers/google/cloud/hooks/gcs.py +7 -6
- airflow/providers/google/cloud/hooks/kms.py +2 -3
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +8 -8
- airflow/providers/google/cloud/hooks/life_sciences.py +1 -1
- airflow/providers/google/cloud/hooks/managed_kafka.py +482 -0
- airflow/providers/google/cloud/hooks/natural_language.py +2 -3
- airflow/providers/google/cloud/hooks/os_login.py +2 -3
- airflow/providers/google/cloud/hooks/pubsub.py +6 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +2 -3
- airflow/providers/google/cloud/hooks/spanner.py +2 -2
- airflow/providers/google/cloud/hooks/speech_to_text.py +2 -3
- airflow/providers/google/cloud/hooks/stackdriver.py +4 -4
- airflow/providers/google/cloud/hooks/tasks.py +3 -4
- airflow/providers/google/cloud/hooks/text_to_speech.py +2 -3
- airflow/providers/google/cloud/hooks/translate.py +236 -5
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +9 -4
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +4 -5
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +2 -3
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -181
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +2 -3
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +2 -3
- airflow/providers/google/cloud/hooks/video_intelligence.py +2 -3
- airflow/providers/google/cloud/hooks/vision.py +3 -4
- airflow/providers/google/cloud/hooks/workflows.py +2 -3
- airflow/providers/google/cloud/links/alloy_db.py +46 -0
- airflow/providers/google/cloud/links/bigquery.py +25 -0
- airflow/providers/google/cloud/links/dataplex.py +172 -2
- airflow/providers/google/cloud/links/kubernetes_engine.py +1 -2
- airflow/providers/google/cloud/links/managed_kafka.py +104 -0
- airflow/providers/google/cloud/links/translate.py +28 -0
- airflow/providers/google/cloud/log/gcs_task_handler.py +3 -3
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +11 -10
- airflow/providers/google/cloud/openlineage/facets.py +67 -0
- airflow/providers/google/cloud/openlineage/mixins.py +438 -173
- airflow/providers/google/cloud/openlineage/utils.py +394 -61
- airflow/providers/google/cloud/operators/alloy_db.py +980 -69
- airflow/providers/google/cloud/operators/automl.py +83 -245
- airflow/providers/google/cloud/operators/bigquery.py +377 -74
- airflow/providers/google/cloud/operators/bigquery_dts.py +126 -13
- airflow/providers/google/cloud/operators/bigtable.py +1 -3
- airflow/providers/google/cloud/operators/cloud_base.py +1 -2
- airflow/providers/google/cloud/operators/cloud_batch.py +2 -4
- airflow/providers/google/cloud/operators/cloud_build.py +3 -5
- airflow/providers/google/cloud/operators/cloud_composer.py +5 -7
- airflow/providers/google/cloud/operators/cloud_memorystore.py +4 -6
- airflow/providers/google/cloud/operators/cloud_run.py +6 -5
- airflow/providers/google/cloud/operators/cloud_sql.py +20 -8
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +62 -8
- airflow/providers/google/cloud/operators/compute.py +3 -4
- airflow/providers/google/cloud/operators/datacatalog.py +9 -11
- airflow/providers/google/cloud/operators/dataflow.py +1 -112
- airflow/providers/google/cloud/operators/dataform.py +3 -5
- airflow/providers/google/cloud/operators/datafusion.py +1 -1
- airflow/providers/google/cloud/operators/dataplex.py +2046 -7
- airflow/providers/google/cloud/operators/dataproc.py +102 -17
- airflow/providers/google/cloud/operators/dataproc_metastore.py +7 -9
- airflow/providers/google/cloud/operators/dlp.py +17 -19
- airflow/providers/google/cloud/operators/gcs.py +14 -17
- airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -2
- airflow/providers/google/cloud/operators/managed_kafka.py +788 -0
- airflow/providers/google/cloud/operators/natural_language.py +3 -5
- airflow/providers/google/cloud/operators/pubsub.py +39 -7
- airflow/providers/google/cloud/operators/speech_to_text.py +3 -5
- airflow/providers/google/cloud/operators/stackdriver.py +3 -5
- airflow/providers/google/cloud/operators/tasks.py +4 -6
- airflow/providers/google/cloud/operators/text_to_speech.py +2 -4
- airflow/providers/google/cloud/operators/translate.py +414 -5
- airflow/providers/google/cloud/operators/translate_speech.py +2 -4
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +9 -8
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +6 -8
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +0 -322
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +4 -6
- airflow/providers/google/cloud/operators/video_intelligence.py +3 -5
- airflow/providers/google/cloud/operators/vision.py +4 -6
- airflow/providers/google/cloud/operators/workflows.py +5 -7
- airflow/providers/google/cloud/secrets/secret_manager.py +1 -2
- airflow/providers/google/cloud/sensors/bigquery_dts.py +3 -5
- airflow/providers/google/cloud/sensors/bigtable.py +2 -3
- airflow/providers/google/cloud/sensors/cloud_composer.py +32 -8
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +39 -1
- airflow/providers/google/cloud/sensors/dataplex.py +4 -6
- airflow/providers/google/cloud/sensors/dataproc.py +2 -3
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +1 -2
- airflow/providers/google/cloud/sensors/gcs.py +2 -4
- airflow/providers/google/cloud/sensors/pubsub.py +2 -3
- airflow/providers/google/cloud/sensors/workflows.py +3 -5
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +5 -5
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +10 -12
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +36 -4
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +27 -2
- airflow/providers/google/cloud/transfers/mysql_to_gcs.py +27 -2
- airflow/providers/google/cloud/transfers/postgres_to_gcs.py +27 -2
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +34 -5
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +15 -0
- airflow/providers/google/cloud/transfers/trino_to_gcs.py +25 -2
- airflow/providers/google/cloud/triggers/bigquery_dts.py +1 -2
- airflow/providers/google/cloud/triggers/cloud_batch.py +1 -2
- airflow/providers/google/cloud/triggers/cloud_build.py +1 -2
- airflow/providers/google/cloud/triggers/cloud_composer.py +13 -3
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +102 -4
- airflow/providers/google/cloud/triggers/dataflow.py +2 -3
- airflow/providers/google/cloud/triggers/dataplex.py +1 -2
- airflow/providers/google/cloud/triggers/dataproc.py +2 -3
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +1 -2
- airflow/providers/google/cloud/triggers/vertex_ai.py +7 -8
- airflow/providers/google/cloud/utils/credentials_provider.py +15 -8
- airflow/providers/google/cloud/utils/external_token_supplier.py +1 -0
- airflow/providers/google/common/auth_backend/google_openid.py +4 -4
- airflow/providers/google/common/consts.py +1 -2
- airflow/providers/google/common/hooks/base_google.py +8 -7
- airflow/providers/google/get_provider_info.py +186 -134
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +2 -3
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +5 -7
- {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/METADATA +41 -58
- {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/RECORD +157 -159
- airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.py +0 -141
- airflow/providers/google/cloud/example_dags/example_looker.py +0 -64
- airflow/providers/google/cloud/example_dags/example_presto_to_gcs.py +0 -194
- airflow/providers/google/cloud/example_dags/example_salesforce_to_gcs.py +0 -129
- airflow/providers/google/marketing_platform/example_dags/__init__.py +0 -16
- airflow/providers/google/marketing_platform/example_dags/example_display_video.py +0 -213
- {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/entry_points.txt +0 -0
airflow/providers/google/LICENSE
CHANGED
@@ -199,55 +199,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
200
|
See the License for the specific language governing permissions and
|
201
201
|
limitations under the License.
|
202
|
-
|
203
|
-
============================================================================
|
204
|
-
APACHE AIRFLOW SUBCOMPONENTS:
|
205
|
-
|
206
|
-
The Apache Airflow project contains subcomponents with separate copyright
|
207
|
-
notices and license terms. Your use of the source code for the these
|
208
|
-
subcomponents is subject to the terms and conditions of the following
|
209
|
-
licenses.
|
210
|
-
|
211
|
-
|
212
|
-
========================================================================
|
213
|
-
Third party Apache 2.0 licenses
|
214
|
-
========================================================================
|
215
|
-
|
216
|
-
The following components are provided under the Apache 2.0 License.
|
217
|
-
See project link for details. The text of each license is also included
|
218
|
-
at 3rd-party-licenses/LICENSE-[project].txt.
|
219
|
-
|
220
|
-
(ALv2 License) hue v4.3.0 (https://github.com/cloudera/hue/)
|
221
|
-
(ALv2 License) jqclock v2.3.0 (https://github.com/JohnRDOrazio/jQuery-Clock-Plugin)
|
222
|
-
(ALv2 License) bootstrap3-typeahead v4.0.2 (https://github.com/bassjobsen/Bootstrap-3-Typeahead)
|
223
|
-
(ALv2 License) connexion v2.7.0 (https://github.com/zalando/connexion)
|
224
|
-
|
225
|
-
========================================================================
|
226
|
-
MIT licenses
|
227
|
-
========================================================================
|
228
|
-
|
229
|
-
The following components are provided under the MIT License. See project link for details.
|
230
|
-
The text of each license is also included at 3rd-party-licenses/LICENSE-[project].txt.
|
231
|
-
|
232
|
-
(MIT License) jquery v3.5.1 (https://jquery.org/license/)
|
233
|
-
(MIT License) dagre-d3 v0.6.4 (https://github.com/cpettitt/dagre-d3)
|
234
|
-
(MIT License) bootstrap v3.4.1 (https://github.com/twbs/bootstrap/)
|
235
|
-
(MIT License) d3-tip v0.9.1 (https://github.com/Caged/d3-tip)
|
236
|
-
(MIT License) dataTables v1.10.25 (https://datatables.net)
|
237
|
-
(MIT License) normalize.css v3.0.2 (http://necolas.github.io/normalize.css/)
|
238
|
-
(MIT License) ElasticMock v1.3.2 (https://github.com/vrcmarcos/elasticmock)
|
239
|
-
(MIT License) MomentJS v2.24.0 (http://momentjs.com/)
|
240
|
-
(MIT License) eonasdan-bootstrap-datetimepicker v4.17.49 (https://github.com/eonasdan/bootstrap-datetimepicker/)
|
241
|
-
|
242
|
-
========================================================================
|
243
|
-
BSD 3-Clause licenses
|
244
|
-
========================================================================
|
245
|
-
The following components are provided under the BSD 3-Clause license. See project links for details.
|
246
|
-
The text of each license is also included at 3rd-party-licenses/LICENSE-[project].txt.
|
247
|
-
|
248
|
-
(BSD 3 License) d3 v5.16.0 (https://d3js.org)
|
249
|
-
(BSD 3 License) d3-shape v2.1.0 (https://github.com/d3/d3-shape)
|
250
|
-
(BSD 3 License) cgroupspy 0.2.1 (https://github.com/cloudsigma/cgroupspy)
|
251
|
-
|
252
|
-
========================================================================
|
253
|
-
See 3rd-party-licenses/LICENSES-ui.txt for packages used in `/airflow/www`
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
29
29
|
|
30
30
|
__all__ = ["__version__"]
|
31
31
|
|
32
|
-
__version__ = "
|
32
|
+
__version__ = "13.0.0"
|
33
33
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
35
35
|
"2.9.0"
|
@@ -19,18 +19,18 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
+
import warnings
|
22
23
|
from functools import cached_property
|
23
24
|
from tempfile import NamedTemporaryFile
|
24
25
|
from typing import IO, TYPE_CHECKING, Any, Literal
|
25
26
|
|
27
|
+
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
|
28
|
+
from airflow.hooks.base import BaseHook
|
29
|
+
from airflow.providers.google.common.hooks.base_google import get_field
|
26
30
|
from google.ads.googleads.client import GoogleAdsClient
|
27
31
|
from google.ads.googleads.errors import GoogleAdsException
|
28
32
|
from google.auth.exceptions import GoogleAuthError
|
29
33
|
|
30
|
-
from airflow.exceptions import AirflowException
|
31
|
-
from airflow.hooks.base import BaseHook
|
32
|
-
from airflow.providers.google.common.hooks.base_google import get_field
|
33
|
-
|
34
34
|
if TYPE_CHECKING:
|
35
35
|
from google.ads.googleads.v18.services.services.customer_service import CustomerServiceClient
|
36
36
|
from google.ads.googleads.v18.services.services.google_ads_service import GoogleAdsServiceClient
|
@@ -116,7 +116,7 @@ class GoogleAdsHook(BaseHook):
|
|
116
116
|
self.authentication_method: Literal["service_account", "developer_token"] = "service_account"
|
117
117
|
|
118
118
|
def search(
|
119
|
-
self, client_ids: list[str], query: str, page_size: int =
|
119
|
+
self, client_ids: list[str], query: str, page_size: int | None = None, **kwargs
|
120
120
|
) -> list[GoogleAdsRow]:
|
121
121
|
"""
|
122
122
|
Pull data from the Google Ads API.
|
@@ -133,7 +133,8 @@ class GoogleAdsHook(BaseHook):
|
|
133
133
|
|
134
134
|
:param client_ids: Google Ads client ID(s) to query the API for.
|
135
135
|
:param query: Google Ads Query Language query.
|
136
|
-
:param page_size: Number of results to return per page. Max 10000.
|
136
|
+
:param page_size: Number of results to return per page. Max 10000 (for version 16 and 16.1)
|
137
|
+
This parameter deprecated. After February 05, 2025, it will be removed.
|
137
138
|
:return: Google Ads API response, converted to Google Ads Row objects.
|
138
139
|
"""
|
139
140
|
data_proto_plus = self._search(client_ids, query, page_size, **kwargs)
|
@@ -142,7 +143,7 @@ class GoogleAdsHook(BaseHook):
|
|
142
143
|
return data_native_pb
|
143
144
|
|
144
145
|
def search_proto_plus(
|
145
|
-
self, client_ids: list[str], query: str, page_size: int =
|
146
|
+
self, client_ids: list[str], query: str, page_size: int | None = None, **kwargs
|
146
147
|
) -> list[GoogleAdsRow]:
|
147
148
|
"""
|
148
149
|
Pull data from the Google Ads API.
|
@@ -152,7 +153,8 @@ class GoogleAdsHook(BaseHook):
|
|
152
153
|
|
153
154
|
:param client_ids: Google Ads client ID(s) to query the API for.
|
154
155
|
:param query: Google Ads Query Language query.
|
155
|
-
:param page_size: Number of results to return per page. Max 10000.
|
156
|
+
:param page_size: Number of results to return per page. Max 10000 (for version 16 and 16.1)
|
157
|
+
This parameter is deprecated. After February 05, 2025, it will be removed.
|
156
158
|
:return: Google Ads API response, converted to Google Ads Row objects
|
157
159
|
"""
|
158
160
|
return self._search(client_ids, query, page_size, **kwargs)
|
@@ -267,24 +269,36 @@ class GoogleAdsHook(BaseHook):
|
|
267
269
|
self.google_ads_config["json_key_file_path"] = secrets_temp.name
|
268
270
|
|
269
271
|
def _search(
|
270
|
-
self, client_ids: list[str], query: str, page_size: int =
|
272
|
+
self, client_ids: list[str], query: str, page_size: int | None = None, **kwargs
|
271
273
|
) -> list[GoogleAdsRow]:
|
272
274
|
"""
|
273
275
|
Pull data from the Google Ads API.
|
274
276
|
|
275
277
|
:param client_ids: Google Ads client ID(s) to query the API for.
|
276
278
|
:param query: Google Ads Query Language query.
|
277
|
-
:param page_size: Number of results to return per page. Max 10000.
|
279
|
+
:param page_size: Number of results to return per page. Max 10000 (for version 16 and 16.1)
|
280
|
+
This parameter is deprecated. After February 05, 2025, it will be removed.
|
278
281
|
|
279
282
|
:return: Google Ads API response, converted to Google Ads Row objects
|
280
283
|
"""
|
281
284
|
service = self._get_service
|
282
285
|
|
286
|
+
extra_req_params = {}
|
287
|
+
if self.api_version == "v16": # TODO: remove this after deprecation removal for page_size parameter
|
288
|
+
extra_req_params["page_size"] = page_size or 10000
|
289
|
+
else:
|
290
|
+
if page_size:
|
291
|
+
warnings.warn(
|
292
|
+
"page_size parameter for the GoogleAdsHook.search and "
|
293
|
+
"GoogleAdsHook.search_proto_plus method is deprecated and will be removed "
|
294
|
+
"after February 05, 2025.",
|
295
|
+
AirflowProviderDeprecationWarning,
|
296
|
+
stacklevel=2,
|
297
|
+
)
|
298
|
+
|
283
299
|
iterators = []
|
284
300
|
for client_id in client_ids:
|
285
|
-
iterator = service.search(
|
286
|
-
request={"customer_id": client_id, "query": query, "page_size": page_size}
|
287
|
-
)
|
301
|
+
iterator = service.search(request={"customer_id": client_id, "query": query, **extra_req_params})
|
288
302
|
iterators.append(iterator)
|
289
303
|
|
290
304
|
self.log.info("Fetched Google Ads Iterators")
|
@@ -17,11 +17,13 @@
|
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
19
|
import csv
|
20
|
+
import warnings
|
20
21
|
from collections.abc import Sequence
|
21
22
|
from operator import attrgetter
|
22
23
|
from tempfile import NamedTemporaryFile
|
23
24
|
from typing import TYPE_CHECKING
|
24
25
|
|
26
|
+
from airflow.exceptions import AirflowProviderDeprecationWarning
|
25
27
|
from airflow.models import BaseOperator
|
26
28
|
from airflow.providers.google.ads.hooks.ads import GoogleAdsHook
|
27
29
|
from airflow.providers.google.cloud.hooks.gcs import GCSHook
|
@@ -52,7 +54,8 @@ class GoogleAdsToGcsOperator(BaseOperator):
|
|
52
54
|
:param obj: GCS path to save the object. Must be the full file path (ex. `path/to/file.txt`)
|
53
55
|
:param gcp_conn_id: Airflow Google Cloud connection ID
|
54
56
|
:param google_ads_conn_id: Airflow Google Ads connection ID
|
55
|
-
:param page_size: The number of results per API page request. Max 10,000
|
57
|
+
:param page_size: The number of results per API page request. Max 10,000 (for version 16 and 16.1)
|
58
|
+
This parameter deprecated. After March 01, 2025, it will be removed.
|
56
59
|
:param gzip: Option to compress local file or file data for upload
|
57
60
|
:param impersonation_chain: Optional service account to impersonate using short-term
|
58
61
|
credentials, or chained list of accounts required to get the access_token
|
@@ -84,7 +87,7 @@ class GoogleAdsToGcsOperator(BaseOperator):
|
|
84
87
|
obj: str,
|
85
88
|
gcp_conn_id: str = "google_cloud_default",
|
86
89
|
google_ads_conn_id: str = "google_ads_default",
|
87
|
-
page_size: int =
|
90
|
+
page_size: int | None = None,
|
88
91
|
gzip: bool = False,
|
89
92
|
impersonation_chain: str | Sequence[str] | None = None,
|
90
93
|
api_version: str | None = None,
|
@@ -98,7 +101,8 @@ class GoogleAdsToGcsOperator(BaseOperator):
|
|
98
101
|
self.obj = obj
|
99
102
|
self.gcp_conn_id = gcp_conn_id
|
100
103
|
self.google_ads_conn_id = google_ads_conn_id
|
101
|
-
|
104
|
+
# TODO: remove this after deprecation removal for page_size parameter
|
105
|
+
self.page_size = page_size or 10000 if api_version == "v16" else None
|
102
106
|
self.gzip = gzip
|
103
107
|
self.impersonation_chain = impersonation_chain
|
104
108
|
self.api_version = api_version
|
@@ -109,7 +113,17 @@ class GoogleAdsToGcsOperator(BaseOperator):
|
|
109
113
|
google_ads_conn_id=self.google_ads_conn_id,
|
110
114
|
api_version=self.api_version,
|
111
115
|
)
|
112
|
-
|
116
|
+
|
117
|
+
if self.api_version != "v16" and self.page_size:
|
118
|
+
warnings.warn(
|
119
|
+
"page_size parameter for the GoogleAdsToGcsOperator is deprecated and will be removed "
|
120
|
+
"after March 01, 2025.",
|
121
|
+
AirflowProviderDeprecationWarning,
|
122
|
+
stacklevel=2,
|
123
|
+
)
|
124
|
+
rows = service.search(client_ids=self.client_ids, query=self.query)
|
125
|
+
else:
|
126
|
+
rows = service.search(client_ids=self.client_ids, query=self.query, page_size=self.page_size)
|
113
127
|
|
114
128
|
try:
|
115
129
|
getter = attrgetter(*self.attributes)
|
@@ -19,9 +19,13 @@ from __future__ import annotations
|
|
19
19
|
|
20
20
|
from typing import TYPE_CHECKING
|
21
21
|
|
22
|
+
from airflow.providers.common.compat.assets import Asset
|
23
|
+
|
22
24
|
if TYPE_CHECKING:
|
23
25
|
from urllib.parse import SplitResult
|
24
26
|
|
27
|
+
from airflow.providers.common.compat.openlineage.facet import Dataset as OpenLineageDataset
|
28
|
+
|
25
29
|
|
26
30
|
def sanitize_uri(uri: SplitResult) -> SplitResult:
|
27
31
|
if not uri.netloc:
|
@@ -29,3 +33,16 @@ def sanitize_uri(uri: SplitResult) -> SplitResult:
|
|
29
33
|
if len(uri.path.split("/")) != 3: # Leading slash, database name, and table name.
|
30
34
|
raise ValueError("URI format bigquery:// must contain dataset and table names")
|
31
35
|
return uri
|
36
|
+
|
37
|
+
|
38
|
+
def create_asset(*, project_id: str, dataset_id: str, table_id: str, extra: dict | None = None) -> Asset:
|
39
|
+
return Asset(uri=f"bigquery://{project_id}/{dataset_id}/{table_id}", extra=extra)
|
40
|
+
|
41
|
+
|
42
|
+
def convert_asset_to_openlineage(asset: Asset, lineage_context) -> OpenLineageDataset:
|
43
|
+
"""Translate Asset with valid AIP-60 uri to OpenLineage with assistance from the hook."""
|
44
|
+
from airflow.providers.common.compat.openlineage.facet import Dataset as OpenLineageDataset
|
45
|
+
|
46
|
+
# Expecting valid URI in format: "bigquery://{project_id}/{dataset_id}/{table_id}"
|
47
|
+
project, dataset, table = asset.uri.split("/")[-3:]
|
48
|
+
return OpenLineageDataset(namespace="bigquery", name=f"{project}.{dataset}.{table}")
|
@@ -20,11 +20,10 @@ import re
|
|
20
20
|
from functools import cached_property
|
21
21
|
from typing import TYPE_CHECKING
|
22
22
|
|
23
|
-
from google.api_core.exceptions import InvalidArgument, NotFound, PermissionDenied
|
24
|
-
from google.cloud.secretmanager_v1 import SecretManagerServiceClient
|
25
|
-
|
26
23
|
from airflow.providers.google.common.consts import CLIENT_INFO
|
27
24
|
from airflow.utils.log.logging_mixin import LoggingMixin
|
25
|
+
from google.api_core.exceptions import InvalidArgument, NotFound, PermissionDenied
|
26
|
+
from google.cloud.secretmanager_v1 import SecretManagerServiceClient
|
28
27
|
|
29
28
|
if TYPE_CHECKING:
|
30
29
|
import google
|