apache-airflow-providers-google 19.1.0rc1__py3-none-any.whl → 19.3.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 (137) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/ads/hooks/ads.py +1 -2
  3. airflow/providers/google/cloud/bundles/gcs.py +1 -1
  4. airflow/providers/google/cloud/hooks/alloy_db.py +1 -1
  5. airflow/providers/google/cloud/hooks/bigquery.py +15 -17
  6. airflow/providers/google/cloud/hooks/cloud_batch.py +1 -1
  7. airflow/providers/google/cloud/hooks/cloud_build.py +1 -1
  8. airflow/providers/google/cloud/hooks/cloud_composer.py +1 -1
  9. airflow/providers/google/cloud/hooks/cloud_memorystore.py +1 -1
  10. airflow/providers/google/cloud/hooks/cloud_run.py +1 -1
  11. airflow/providers/google/cloud/hooks/cloud_sql.py +1 -1
  12. airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +2 -1
  13. airflow/providers/google/cloud/hooks/compute.py +1 -1
  14. airflow/providers/google/cloud/hooks/compute_ssh.py +1 -1
  15. airflow/providers/google/cloud/hooks/datacatalog.py +2 -1
  16. airflow/providers/google/cloud/hooks/dataflow.py +2 -2
  17. airflow/providers/google/cloud/hooks/dataform.py +1 -1
  18. airflow/providers/google/cloud/hooks/datafusion.py +20 -18
  19. airflow/providers/google/cloud/hooks/dataplex.py +1 -1
  20. airflow/providers/google/cloud/hooks/dataproc.py +1 -1
  21. airflow/providers/google/cloud/hooks/dataproc_metastore.py +1 -1
  22. airflow/providers/google/cloud/hooks/dlp.py +1 -1
  23. airflow/providers/google/cloud/hooks/functions.py +1 -1
  24. airflow/providers/google/cloud/hooks/gcs.py +2 -2
  25. airflow/providers/google/cloud/hooks/gdm.py +1 -1
  26. airflow/providers/google/cloud/hooks/kubernetes_engine.py +1 -1
  27. airflow/providers/google/cloud/hooks/looker.py +1 -2
  28. airflow/providers/google/cloud/hooks/managed_kafka.py +1 -1
  29. airflow/providers/google/cloud/hooks/mlengine.py +1 -1
  30. airflow/providers/google/cloud/hooks/pubsub.py +3 -0
  31. airflow/providers/google/cloud/hooks/spanner.py +1 -1
  32. airflow/providers/google/cloud/hooks/stackdriver.py +1 -1
  33. airflow/providers/google/cloud/hooks/tasks.py +1 -1
  34. airflow/providers/google/cloud/hooks/translate.py +1 -1
  35. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +2 -1
  36. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +1 -1
  37. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +1 -1
  38. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +1 -1
  39. airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +1 -1
  40. airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +1 -1
  41. airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +1 -1
  42. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +1 -1
  43. airflow/providers/google/cloud/hooks/vision.py +1 -1
  44. airflow/providers/google/cloud/log/gcs_task_handler.py +41 -13
  45. airflow/providers/google/cloud/operators/alloy_db.py +1 -1
  46. airflow/providers/google/cloud/operators/bigquery.py +2 -2
  47. airflow/providers/google/cloud/operators/bigquery_dts.py +1 -1
  48. airflow/providers/google/cloud/operators/bigtable.py +1 -1
  49. airflow/providers/google/cloud/operators/cloud_batch.py +1 -1
  50. airflow/providers/google/cloud/operators/cloud_build.py +1 -1
  51. airflow/providers/google/cloud/operators/cloud_composer.py +1 -1
  52. airflow/providers/google/cloud/operators/cloud_logging_sink.py +1 -1
  53. airflow/providers/google/cloud/operators/cloud_run.py +1 -1
  54. airflow/providers/google/cloud/operators/cloud_sql.py +1 -2
  55. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +1 -1
  56. airflow/providers/google/cloud/operators/compute.py +1 -1
  57. airflow/providers/google/cloud/operators/dataflow.py +2 -1
  58. airflow/providers/google/cloud/operators/datafusion.py +1 -1
  59. airflow/providers/google/cloud/operators/dataplex.py +1 -1
  60. airflow/providers/google/cloud/operators/dataproc.py +2 -1
  61. airflow/providers/google/cloud/operators/dataproc_metastore.py +1 -1
  62. airflow/providers/google/cloud/operators/datastore.py +1 -1
  63. airflow/providers/google/cloud/operators/functions.py +1 -1
  64. airflow/providers/google/cloud/operators/gcs.py +2 -1
  65. airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -1
  66. airflow/providers/google/cloud/operators/looker.py +1 -1
  67. airflow/providers/google/cloud/operators/managed_kafka.py +1 -1
  68. airflow/providers/google/cloud/operators/pubsub.py +8 -1
  69. airflow/providers/google/cloud/operators/spanner.py +1 -1
  70. airflow/providers/google/cloud/operators/speech_to_text.py +1 -1
  71. airflow/providers/google/cloud/operators/text_to_speech.py +1 -1
  72. airflow/providers/google/cloud/operators/translate.py +1 -1
  73. airflow/providers/google/cloud/operators/translate_speech.py +1 -1
  74. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +1 -1
  75. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +1 -1
  76. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +1 -1
  77. airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +1 -1
  78. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +1 -1
  79. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +2 -1
  80. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +1 -1
  81. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +1 -1
  82. airflow/providers/google/cloud/operators/vertex_ai/ray.py +1 -1
  83. airflow/providers/google/cloud/secrets/secret_manager.py +3 -2
  84. airflow/providers/google/cloud/sensors/bigquery.py +2 -2
  85. airflow/providers/google/cloud/sensors/bigquery_dts.py +1 -2
  86. airflow/providers/google/cloud/sensors/cloud_composer.py +1 -2
  87. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +1 -2
  88. airflow/providers/google/cloud/sensors/dataflow.py +1 -2
  89. airflow/providers/google/cloud/sensors/dataform.py +1 -2
  90. airflow/providers/google/cloud/sensors/datafusion.py +1 -2
  91. airflow/providers/google/cloud/sensors/dataplex.py +1 -2
  92. airflow/providers/google/cloud/sensors/dataproc.py +1 -2
  93. airflow/providers/google/cloud/sensors/dataproc_metastore.py +1 -2
  94. airflow/providers/google/cloud/sensors/gcs.py +1 -2
  95. airflow/providers/google/cloud/sensors/looker.py +1 -2
  96. airflow/providers/google/cloud/sensors/pubsub.py +1 -2
  97. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +1 -2
  98. airflow/providers/google/cloud/sensors/workflows.py +1 -2
  99. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -1
  100. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +6 -1
  101. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
  102. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +1 -1
  103. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -1
  104. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -1
  105. airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
  106. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
  107. airflow/providers/google/cloud/transfers/s3_to_gcs.py +1 -1
  108. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
  109. airflow/providers/google/cloud/triggers/bigquery.py +1 -1
  110. airflow/providers/google/cloud/triggers/cloud_composer.py +1 -1
  111. airflow/providers/google/cloud/triggers/cloud_run.py +1 -1
  112. airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +1 -1
  113. airflow/providers/google/cloud/triggers/dataproc.py +1 -1
  114. airflow/providers/google/cloud/triggers/kubernetes_engine.py +2 -1
  115. airflow/providers/google/cloud/triggers/vertex_ai.py +1 -1
  116. airflow/providers/google/cloud/utils/credentials_provider.py +1 -1
  117. airflow/providers/google/cloud/utils/field_sanitizer.py +1 -1
  118. airflow/providers/google/cloud/utils/field_validator.py +1 -1
  119. airflow/providers/google/common/hooks/base_google.py +1 -2
  120. airflow/providers/google/common/hooks/operation_helpers.py +1 -1
  121. airflow/providers/google/firebase/hooks/firestore.py +1 -1
  122. airflow/providers/google/firebase/operators/firestore.py +1 -1
  123. airflow/providers/google/leveldb/hooks/leveldb.py +2 -2
  124. airflow/providers/google/marketing_platform/hooks/campaign_manager.py +1 -1
  125. airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
  126. airflow/providers/google/marketing_platform/operators/analytics_admin.py +1 -1
  127. airflow/providers/google/marketing_platform/operators/campaign_manager.py +1 -1
  128. airflow/providers/google/marketing_platform/sensors/display_video.py +1 -2
  129. airflow/providers/google/suite/hooks/calendar.py +1 -1
  130. airflow/providers/google/suite/hooks/sheets.py +1 -1
  131. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
  132. {apache_airflow_providers_google-19.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/METADATA +17 -17
  133. {apache_airflow_providers_google-19.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/RECORD +137 -137
  134. {apache_airflow_providers_google-19.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/WHEEL +0 -0
  135. {apache_airflow_providers_google-19.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/entry_points.txt +0 -0
  136. {apache_airflow_providers_google-19.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/licenses/LICENSE +0 -0
  137. {apache_airflow_providers_google-19.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/licenses/NOTICE +0 -0
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "19.1.0"
32
+ __version__ = "19.3.0"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.11.0"
@@ -27,8 +27,7 @@ from google.ads.googleads.client import GoogleAdsClient
27
27
  from google.ads.googleads.errors import GoogleAdsException
28
28
  from google.auth.exceptions import GoogleAuthError
29
29
 
30
- from airflow.exceptions import AirflowException
31
- from airflow.providers.common.compat.sdk import BaseHook
30
+ from airflow.providers.common.compat.sdk import AirflowException, BaseHook
32
31
  from airflow.providers.google.common.hooks.base_google import get_field
33
32
 
34
33
  if TYPE_CHECKING:
@@ -23,7 +23,7 @@ import structlog
23
23
  from google.api_core.exceptions import NotFound
24
24
 
25
25
  from airflow.dag_processing.bundles.base import BaseDagBundle
26
- from airflow.exceptions import AirflowException
26
+ from airflow.providers.common.compat.sdk import AirflowException
27
27
  from airflow.providers.google.cloud.hooks.gcs import GCSHook
28
28
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
29
29
 
@@ -27,7 +27,7 @@ import tenacity
27
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
28
  from google.cloud import alloydb_v1
29
29
 
30
- from airflow.exceptions import AirflowException
30
+ from airflow.providers.common.compat.sdk import AirflowException
31
31
  from airflow.providers.google.common.consts import CLIENT_INFO
32
32
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
33
33
 
@@ -59,12 +59,9 @@ from pandas_gbq import read_gbq
59
59
  from pandas_gbq.gbq import GbqConnector # noqa: F401 used in ``airflow.contrib.hooks.bigquery``
60
60
  from sqlalchemy import create_engine
61
61
 
62
- from airflow.exceptions import (
63
- AirflowException,
64
- AirflowOptionalProviderFeatureException,
65
- AirflowProviderDeprecationWarning,
66
- )
62
+ from airflow.exceptions import AirflowOptionalProviderFeatureException, AirflowProviderDeprecationWarning
67
63
  from airflow.providers.common.compat.lineage.hook import get_hook_lineage_collector
64
+ from airflow.providers.common.compat.sdk import AirflowException
68
65
  from airflow.providers.common.sql.hooks.sql import DbApiHook
69
66
  from airflow.providers.google.cloud.utils.bigquery import bq_cast
70
67
  from airflow.providers.google.cloud.utils.credentials_provider import _get_scopes
@@ -1993,18 +1990,19 @@ def _format_schema_for_description(schema: dict) -> list:
1993
1990
  internal_size, precision, scale, null_ok.
1994
1991
  """
1995
1992
  description = []
1996
- for field in schema["fields"]:
1997
- mode = field.get("mode", "NULLABLE")
1998
- field_description = (
1999
- field["name"],
2000
- field["type"],
2001
- None,
2002
- None,
2003
- None,
2004
- None,
2005
- mode == "NULLABLE",
2006
- )
2007
- description.append(field_description)
1993
+ if "fields" in schema:
1994
+ for field in schema["fields"]:
1995
+ mode = field.get("mode", "NULLABLE")
1996
+ field_description = (
1997
+ field["name"],
1998
+ field["type"],
1999
+ None,
2000
+ None,
2001
+ None,
2002
+ None,
2003
+ mode == "NULLABLE",
2004
+ )
2005
+ description.append(field_description)
2008
2006
  return description
2009
2007
 
2010
2008
 
@@ -33,7 +33,7 @@ from google.cloud.batch_v1 import (
33
33
  Task,
34
34
  )
35
35
 
36
- from airflow.exceptions import AirflowException
36
+ from airflow.providers.common.compat.sdk import AirflowException
37
37
  from airflow.providers.google.common.consts import CLIENT_INFO
38
38
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
39
39
 
@@ -27,7 +27,7 @@ from google.api_core.exceptions import AlreadyExists
27
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
28
  from google.cloud.devtools.cloudbuild_v1 import CloudBuildAsyncClient, CloudBuildClient, GetBuildRequest
29
29
 
30
- from airflow.exceptions import AirflowException
30
+ from airflow.providers.common.compat.sdk import AirflowException
31
31
  from airflow.providers.google.common.consts import CLIENT_INFO
32
32
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
33
33
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -35,7 +35,7 @@ from google.cloud.orchestration.airflow.service_v1 import (
35
35
  PollAirflowCommandResponse,
36
36
  )
37
37
 
38
- from airflow.exceptions import AirflowException
38
+ from airflow.providers.common.compat.sdk import AirflowException
39
39
  from airflow.providers.google.common.consts import CLIENT_INFO
40
40
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
41
41
 
@@ -45,7 +45,7 @@ from google.cloud.redis_v1 import (
45
45
  )
46
46
 
47
47
  from airflow import version
48
- from airflow.exceptions import AirflowException
48
+ from airflow.providers.common.compat.sdk import AirflowException
49
49
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
50
50
 
51
51
  if TYPE_CHECKING:
@@ -40,7 +40,7 @@ from google.cloud.run_v2 import (
40
40
  )
41
41
  from google.longrunning import operations_pb2
42
42
 
43
- from airflow.exceptions import AirflowException
43
+ from airflow.providers.common.compat.sdk import AirflowException
44
44
  from airflow.providers.google.common.consts import CLIENT_INFO
45
45
  from airflow.providers.google.common.hooks.base_google import (
46
46
  PROVIDE_PROJECT_ID,
@@ -49,7 +49,7 @@ from googleapiclient.errors import HttpError
49
49
 
50
50
  # Number of retries - used by googleapiclient method calls to perform retries
51
51
  # For requests that are "retriable"
52
- from airflow.exceptions import AirflowException
52
+ from airflow.providers.common.compat.sdk import AirflowException
53
53
  from airflow.providers.google.version_compat import AIRFLOW_V_3_1_PLUS
54
54
 
55
55
  if AIRFLOW_V_3_1_PLUS:
@@ -47,7 +47,8 @@ from google.protobuf.json_format import MessageToDict
47
47
  from googleapiclient.discovery import Resource, build
48
48
  from googleapiclient.errors import HttpError
49
49
 
50
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
50
+ from airflow.exceptions import AirflowProviderDeprecationWarning
51
+ from airflow.providers.common.compat.sdk import AirflowException
51
52
  from airflow.providers.google.common.consts import CLIENT_INFO
52
53
  from airflow.providers.google.common.hooks.base_google import (
53
54
  PROVIDE_PROJECT_ID,
@@ -28,7 +28,7 @@ from google.cloud.compute_v1.services.instance_templates import InstanceTemplate
28
28
  from google.cloud.compute_v1.services.instances import InstancesClient
29
29
  from googleapiclient.discovery import build
30
30
 
31
- from airflow.exceptions import AirflowException
31
+ from airflow.providers.common.compat.sdk import AirflowException
32
32
  from airflow.providers.google.common.consts import CLIENT_INFO
33
33
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
34
34
 
@@ -26,7 +26,7 @@ from typing import Any
26
26
  from googleapiclient.errors import HttpError
27
27
  from paramiko.ssh_exception import SSHException
28
28
 
29
- from airflow.exceptions import AirflowException
29
+ from airflow.providers.common.compat.sdk import AirflowException
30
30
  from airflow.providers.google.cloud.hooks.compute import ComputeEngineHook
31
31
  from airflow.providers.google.cloud.hooks.os_login import OSLoginHook
32
32
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
@@ -32,7 +32,8 @@ from google.cloud.datacatalog import (
32
32
  TagTemplateField,
33
33
  )
34
34
 
35
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
35
+ from airflow.exceptions import AirflowProviderDeprecationWarning
36
+ from airflow.providers.common.compat.sdk import AirflowException
36
37
  from airflow.providers.google.common.consts import CLIENT_INFO
37
38
  from airflow.providers.google.common.deprecated import deprecated
38
39
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
@@ -49,9 +49,9 @@ from google.cloud.dataflow_v1beta3.types import (
49
49
  from google.cloud.dataflow_v1beta3.types.jobs import ListJobsRequest
50
50
  from googleapiclient.discovery import Resource, build
51
51
 
52
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
52
+ from airflow.exceptions import AirflowProviderDeprecationWarning
53
53
  from airflow.providers.apache.beam.hooks.beam import BeamHook, BeamRunnerType, beam_options_to_args
54
- from airflow.providers.common.compat.sdk import timeout
54
+ from airflow.providers.common.compat.sdk import AirflowException, timeout
55
55
  from airflow.providers.google.common.hooks.base_google import (
56
56
  PROVIDE_PROJECT_ID,
57
57
  GoogleBaseAsyncHook,
@@ -31,7 +31,7 @@ from google.cloud.dataform_v1beta1.types import (
31
31
  WriteFileResponse,
32
32
  )
33
33
 
34
- from airflow.exceptions import AirflowException
34
+ from airflow.providers.common.compat.sdk import AirflowException
35
35
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
36
36
 
37
37
  if TYPE_CHECKING:
@@ -32,7 +32,7 @@ from gcloud.aio.auth import AioSession, Token
32
32
  from google.api_core.retry import exponential_sleep_generator
33
33
  from googleapiclient.discovery import Resource, build
34
34
 
35
- from airflow.exceptions import AirflowException, AirflowNotFoundException
35
+ from airflow.providers.common.compat.sdk import AirflowException, AirflowNotFoundException
36
36
  from airflow.providers.google.cloud.utils.datafusion import DataFusionPipelineType
37
37
  from airflow.providers.google.common.hooks.base_google import (
38
38
  PROVIDE_PROJECT_ID,
@@ -469,31 +469,33 @@ class DataFusionHook(GoogleBaseHook):
469
469
  is always default. If your pipeline belongs to an Enterprise edition instance, you
470
470
  can create a namespace.
471
471
  """
472
- # TODO: This API endpoint starts multiple pipelines. There will eventually be a fix
473
- # return the run Id as part of the API request to run a single pipeline.
474
- # https://github.com/apache/airflow/pull/8954#discussion_r438223116
472
+ # Use the single-program start endpoint for better error handling
473
+ # https://cdap.atlassian.net/wiki/spaces/DOCS/pages/477560983/Lifecycle+Microservices#Start-a-Program
474
+ program_type = self.cdap_program_type(pipeline_type=pipeline_type)
475
+ program_id = self.cdap_program_id(pipeline_type=pipeline_type)
475
476
  url = os.path.join(
476
- instance_url,
477
- "v3",
478
- "namespaces",
479
- quote(namespace),
477
+ self._base_url(instance_url, namespace),
478
+ quote(pipeline_name),
479
+ f"{program_type}s",
480
+ program_id,
480
481
  "start",
481
482
  )
482
483
  runtime_args = runtime_args or {}
483
- body = [
484
- {
485
- "appId": pipeline_name,
486
- "runtimeargs": runtime_args,
487
- "programType": self.cdap_program_type(pipeline_type=pipeline_type),
488
- "programId": self.cdap_program_id(pipeline_type=pipeline_type),
489
- }
490
- ]
491
- response = self._cdap_request(url=url, method="POST", body=body)
484
+ response = self._cdap_request(url=url, method="POST", body=runtime_args)
492
485
  self._check_response_status_and_data(
493
486
  response, f"Starting a pipeline failed with code {response.status}"
494
487
  )
495
488
  response_json = json.loads(response.data)
496
- return response_json[0]["runId"]
489
+
490
+ # Extract and validate runId from response
491
+ if "runId" not in response_json:
492
+ error_message = response_json.get("error", "Unknown error")
493
+ raise AirflowException(
494
+ f"Failed to start pipeline '{pipeline_name}'. "
495
+ f"The response does not contain a runId. Error: {error_message}"
496
+ )
497
+
498
+ return str(response_json["runId"])
497
499
 
498
500
  def stop_pipeline(self, pipeline_name: str, instance_url: str, namespace: str = "default") -> None:
499
501
  """
@@ -46,7 +46,7 @@ from google.cloud.dataplex_v1.types import (
46
46
  )
47
47
  from google.protobuf.field_mask_pb2 import FieldMask
48
48
 
49
- from airflow.exceptions import AirflowException
49
+ from airflow.providers.common.compat.sdk import AirflowException
50
50
  from airflow.providers.google.common.consts import CLIENT_INFO
51
51
  from airflow.providers.google.common.hooks.base_google import (
52
52
  PROVIDE_PROJECT_ID,
@@ -45,7 +45,7 @@ from google.cloud.dataproc_v1 import (
45
45
  WorkflowTemplateServiceClient,
46
46
  )
47
47
 
48
- from airflow.exceptions import AirflowException
48
+ from airflow.providers.common.compat.sdk import AirflowException
49
49
  from airflow.providers.google.common.consts import CLIENT_INFO
50
50
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
51
51
  from airflow.version import version as airflow_version
@@ -26,7 +26,7 @@ from google.api_core.client_options import ClientOptions
26
26
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
27
  from google.cloud.metastore_v1 import DataprocMetastoreClient
28
28
 
29
- from airflow.exceptions import AirflowException
29
+ from airflow.providers.common.compat.sdk import AirflowException
30
30
  from airflow.providers.google.common.consts import CLIENT_INFO
31
31
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
32
32
 
@@ -55,7 +55,7 @@ from google.cloud.dlp_v2.types import (
55
55
  )
56
56
  from google.protobuf.field_mask_pb2 import FieldMask
57
57
 
58
- from airflow.exceptions import AirflowException
58
+ from airflow.providers.common.compat.sdk import AirflowException
59
59
  from airflow.providers.google.common.consts import CLIENT_INFO
60
60
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
61
61
 
@@ -25,7 +25,7 @@ from collections.abc import Sequence
25
25
  import requests
26
26
  from googleapiclient.discovery import build
27
27
 
28
- from airflow.exceptions import AirflowException
28
+ from airflow.providers.common.compat.sdk import AirflowException
29
29
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
30
30
 
31
31
  # Time to sleep between active checks of the operation results
@@ -43,9 +43,9 @@ from google.api_core.exceptions import GoogleAPICallError, NotFound
43
43
  from google.cloud.exceptions import GoogleCloudError
44
44
  from google.cloud.storage.retry import DEFAULT_RETRY
45
45
 
46
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
46
+ from airflow.exceptions import AirflowProviderDeprecationWarning
47
47
  from airflow.providers.common.compat.lineage.hook import get_hook_lineage_collector
48
- from airflow.providers.common.compat.sdk import timezone
48
+ from airflow.providers.common.compat.sdk import AirflowException, timezone
49
49
  from airflow.providers.google.cloud.utils.helpers import normalize_directory_path
50
50
  from airflow.providers.google.common.consts import CLIENT_INFO
51
51
  from airflow.providers.google.common.hooks.base_google import (
@@ -21,7 +21,7 @@ from typing import Any
21
21
 
22
22
  from googleapiclient.discovery import Resource, build
23
23
 
24
- from airflow.exceptions import AirflowException
24
+ from airflow.providers.common.compat.sdk import AirflowException
25
25
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
26
26
 
27
27
 
@@ -38,9 +38,9 @@ from kubernetes_asyncio import client as async_client
38
38
  from kubernetes_asyncio.config.kube_config import FileOrData
39
39
 
40
40
  from airflow import version
41
- from airflow.exceptions import AirflowException
42
41
  from airflow.providers.cncf.kubernetes.hooks.kubernetes import AsyncKubernetesHook, KubernetesHook
43
42
  from airflow.providers.cncf.kubernetes.kube_client import _enable_tcp_keepalive
43
+ from airflow.providers.common.compat.sdk import AirflowException
44
44
  from airflow.providers.google.common.consts import CLIENT_INFO
45
45
  from airflow.providers.google.common.hooks.base_google import (
46
46
  PROVIDE_PROJECT_ID,
@@ -28,8 +28,7 @@ from looker_sdk.rtl import api_settings, auth_session, requests_transport, seria
28
28
  from looker_sdk.sdk.api40 import methods as methods40
29
29
  from packaging.version import parse as parse_version
30
30
 
31
- from airflow.exceptions import AirflowException
32
- from airflow.providers.common.compat.sdk import BaseHook
31
+ from airflow.providers.common.compat.sdk import AirflowException, BaseHook
33
32
  from airflow.version import version
34
33
 
35
34
  if TYPE_CHECKING:
@@ -31,7 +31,7 @@ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
31
31
  from google.auth.transport import requests as google_requests
32
32
  from google.cloud.managedkafka_v1 import Cluster, ConsumerGroup, ManagedKafkaClient, Topic, types
33
33
 
34
- from airflow.exceptions import AirflowException
34
+ from airflow.providers.common.compat.sdk import AirflowException
35
35
  from airflow.providers.google.common.consts import CLIENT_INFO
36
36
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
37
37
 
@@ -31,7 +31,7 @@ from gcloud.aio.auth import AioSession, Token
31
31
  from googleapiclient.discovery import Resource, build
32
32
  from googleapiclient.errors import HttpError
33
33
 
34
- from airflow.exceptions import AirflowException
34
+ from airflow.providers.common.compat.sdk import AirflowException
35
35
  from airflow.providers.google.common.hooks.base_google import (
36
36
  PROVIDE_PROJECT_ID,
37
37
  GoogleBaseAsyncHook,
@@ -82,6 +82,7 @@ class PubSubHook(GoogleBaseHook):
82
82
  gcp_conn_id: str = "google_cloud_default",
83
83
  impersonation_chain: str | Sequence[str] | None = None,
84
84
  enable_message_ordering: bool = False,
85
+ enable_open_telemetry_tracing: bool = False,
85
86
  **kwargs,
86
87
  ) -> None:
87
88
  super().__init__(
@@ -90,6 +91,7 @@ class PubSubHook(GoogleBaseHook):
90
91
  **kwargs,
91
92
  )
92
93
  self.enable_message_ordering = enable_message_ordering
94
+ self.enable_open_telemetry_tracing = enable_open_telemetry_tracing
93
95
  self._client = None
94
96
 
95
97
  def get_conn(self) -> PublisherClient:
@@ -104,6 +106,7 @@ class PubSubHook(GoogleBaseHook):
104
106
  client_info=CLIENT_INFO,
105
107
  publisher_options=PublisherOptions(
106
108
  enable_message_ordering=self.enable_message_ordering,
109
+ enable_open_telemetry_tracing=self.enable_open_telemetry_tracing,
107
110
  ),
108
111
  )
109
112
  return self._client
@@ -27,7 +27,7 @@ from google.api_core.exceptions import AlreadyExists, GoogleAPICallError
27
27
  from google.cloud.spanner_v1.client import Client
28
28
  from sqlalchemy import create_engine
29
29
 
30
- from airflow.exceptions import AirflowException
30
+ from airflow.providers.common.compat.sdk import AirflowException
31
31
  from airflow.providers.common.sql.hooks.sql import DbApiHook
32
32
  from airflow.providers.google.common.consts import CLIENT_INFO
33
33
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook, get_field
@@ -31,7 +31,7 @@ from google.cloud.monitoring_v3 import AlertPolicy, NotificationChannel
31
31
  from google.protobuf.field_mask_pb2 import FieldMask
32
32
  from googleapiclient.errors import HttpError
33
33
 
34
- from airflow.exceptions import AirflowException
34
+ from airflow.providers.common.compat.sdk import AirflowException
35
35
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
36
36
 
37
37
  if TYPE_CHECKING:
@@ -26,7 +26,7 @@ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
26
26
  from google.cloud.tasks_v2 import CloudTasksClient
27
27
  from google.cloud.tasks_v2.types import Queue, Task
28
28
 
29
- from airflow.exceptions import AirflowException
29
+ from airflow.providers.common.compat.sdk import AirflowException
30
30
  from airflow.providers.google.common.consts import CLIENT_INFO
31
31
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
32
32
 
@@ -32,7 +32,7 @@ from google.cloud.translate_v2 import Client
32
32
  from google.cloud.translate_v3 import TranslationServiceClient
33
33
  from google.cloud.translate_v3.types.translation_service import GlossaryInputConfig
34
34
 
35
- from airflow.exceptions import AirflowException
35
+ from airflow.providers.common.compat.sdk import AirflowException
36
36
  from airflow.providers.google.common.consts import CLIENT_INFO
37
37
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
38
38
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -36,7 +36,8 @@ from google.cloud.aiplatform import (
36
36
  )
37
37
  from google.cloud.aiplatform_v1 import JobServiceClient, PipelineServiceClient
38
38
 
39
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
39
+ from airflow.exceptions import AirflowProviderDeprecationWarning
40
+ from airflow.providers.common.compat.sdk import AirflowException
40
41
  from airflow.providers.google.common.consts import CLIENT_INFO
41
42
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
42
43
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -28,7 +28,7 @@ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
28
  from google.cloud.aiplatform import BatchPredictionJob, Model, explain
29
29
  from google.cloud.aiplatform_v1 import JobServiceAsyncClient, JobServiceClient, JobState, types
30
30
 
31
- from airflow.exceptions import AirflowException
31
+ from airflow.providers.common.compat.sdk import AirflowException
32
32
  from airflow.providers.google.common.consts import CLIENT_INFO
33
33
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
34
34
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -42,7 +42,7 @@ from google.cloud.aiplatform_v1 import (
42
42
  types,
43
43
  )
44
44
 
45
- from airflow.exceptions import AirflowException
45
+ from airflow.providers.common.compat.sdk import AirflowException
46
46
  from airflow.providers.google.common.consts import CLIENT_INFO
47
47
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
48
48
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -30,7 +30,7 @@ from google.cloud.aiplatform_v1beta1 import (
30
30
  FeatureOnlineStoreServiceClient,
31
31
  )
32
32
 
33
- from airflow.exceptions import AirflowException
33
+ from airflow.providers.common.compat.sdk import AirflowException
34
34
  from airflow.providers.google.common.consts import CLIENT_INFO
35
35
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
36
36
 
@@ -34,7 +34,7 @@ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
34
34
  from google.cloud.aiplatform import CustomJob, HyperparameterTuningJob, gapic, hyperparameter_tuning
35
35
  from google.cloud.aiplatform_v1 import JobServiceAsyncClient, JobServiceClient, JobState, types
36
36
 
37
- from airflow.exceptions import AirflowException
37
+ from airflow.providers.common.compat.sdk import AirflowException
38
38
  from airflow.providers.google.common.consts import CLIENT_INFO
39
39
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
40
40
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -27,7 +27,7 @@ from google.api_core.client_options import ClientOptions
27
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
28
  from google.cloud.aiplatform_v1 import ModelServiceClient
29
29
 
30
- from airflow.exceptions import AirflowException
30
+ from airflow.providers.common.compat.sdk import AirflowException
31
31
  from airflow.providers.google.common.consts import CLIENT_INFO
32
32
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
33
33
 
@@ -39,7 +39,7 @@ from google.cloud.aiplatform_v1 import (
39
39
  types,
40
40
  )
41
41
 
42
- from airflow.exceptions import AirflowException
42
+ from airflow.providers.common.compat.sdk import AirflowException
43
43
  from airflow.providers.google.common.consts import CLIENT_INFO
44
44
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
45
45
  from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
@@ -52,7 +52,7 @@ class RayHook(GoogleBaseHook):
52
52
  return [__encode_value(nested_value) for nested_value in value]
53
53
  if not isinstance(value, dict) and isinstance(value, MutableMapping):
54
54
  return {key: __encode_value(nested_value) for key, nested_value in dict(value).items()}
55
- if dataclasses.is_dataclass(value):
55
+ if dataclasses.is_dataclass(value) and not isinstance(value, type):
56
56
  return dataclasses.asdict(value)
57
57
  return value
58
58
 
@@ -36,7 +36,7 @@ from google.cloud.vision_v1 import (
36
36
  )
37
37
  from google.protobuf.json_format import MessageToDict
38
38
 
39
- from airflow.exceptions import AirflowException
39
+ from airflow.providers.common.compat.sdk import AirflowException
40
40
  from airflow.providers.google.common.consts import CLIENT_INFO
41
41
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
42
42