apache-airflow-providers-google 10.12.0rc1__py3-none-any.whl → 10.13.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 (40) hide show
  1. airflow/providers/google/__init__.py +3 -3
  2. airflow/providers/google/cloud/fs/gcs.py +16 -13
  3. airflow/providers/google/cloud/hooks/bigquery_dts.py +2 -1
  4. airflow/providers/google/cloud/hooks/cloud_build.py +2 -1
  5. airflow/providers/google/cloud/hooks/cloud_composer.py +4 -3
  6. airflow/providers/google/cloud/hooks/compute_ssh.py +18 -6
  7. airflow/providers/google/cloud/hooks/dataflow.py +61 -3
  8. airflow/providers/google/cloud/hooks/dataplex.py +2 -1
  9. airflow/providers/google/cloud/hooks/dataproc.py +19 -18
  10. airflow/providers/google/cloud/hooks/gcs.py +10 -6
  11. airflow/providers/google/cloud/hooks/pubsub.py +3 -2
  12. airflow/providers/google/cloud/log/gcs_task_handler.py +2 -39
  13. airflow/providers/google/cloud/log/stackdriver_task_handler.py +2 -11
  14. airflow/providers/google/cloud/operators/bigquery.py +47 -47
  15. airflow/providers/google/cloud/operators/cloud_composer.py +1 -1
  16. airflow/providers/google/cloud/operators/cloud_run.py +3 -3
  17. airflow/providers/google/cloud/operators/dataflow.py +6 -0
  18. airflow/providers/google/cloud/operators/dataplex.py +530 -1
  19. airflow/providers/google/cloud/operators/dataproc.py +11 -11
  20. airflow/providers/google/cloud/operators/gcs.py +90 -15
  21. airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -3
  22. airflow/providers/google/cloud/operators/pubsub.py +47 -55
  23. airflow/providers/google/cloud/secrets/secret_manager.py +22 -1
  24. airflow/providers/google/cloud/sensors/cloud_composer.py +14 -1
  25. airflow/providers/google/cloud/sensors/dataplex.py +118 -0
  26. airflow/providers/google/cloud/sensors/gcs.py +10 -1
  27. airflow/providers/google/cloud/transfers/adls_to_gcs.py +5 -5
  28. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +42 -42
  29. airflow/providers/google/cloud/transfers/mssql_to_gcs.py +9 -9
  30. airflow/providers/google/cloud/triggers/cloud_run.py +7 -7
  31. airflow/providers/google/cloud/triggers/dataplex.py +82 -0
  32. airflow/providers/google/cloud/triggers/dataproc.py +2 -5
  33. airflow/providers/google/cloud/triggers/gcs.py +13 -3
  34. airflow/providers/google/cloud/triggers/kubernetes_engine.py +3 -1
  35. airflow/providers/google/common/hooks/base_google.py +6 -4
  36. airflow/providers/google/get_provider_info.py +14 -13
  37. {apache_airflow_providers_google-10.12.0rc1.dist-info → apache_airflow_providers_google-10.13.0.dist-info}/METADATA +31 -31
  38. {apache_airflow_providers_google-10.12.0rc1.dist-info → apache_airflow_providers_google-10.13.0.dist-info}/RECORD +40 -40
  39. {apache_airflow_providers_google-10.12.0rc1.dist-info → apache_airflow_providers_google-10.13.0.dist-info}/WHEEL +0 -0
  40. {apache_airflow_providers_google-10.12.0rc1.dist-info → apache_airflow_providers_google-10.13.0.dist-info}/entry_points.txt +0 -0
@@ -884,13 +884,13 @@ class BigQueryGetDataOperator(GoogleCloudBaseOperator):
884
884
  **Example**::
885
885
 
886
886
  get_data = BigQueryGetDataOperator(
887
- task_id='get_data_from_bq',
888
- dataset_id='test_dataset',
889
- table_id='Transaction_partitions',
890
- project_id='internal-gcp-project',
887
+ task_id="get_data_from_bq",
888
+ dataset_id="test_dataset",
889
+ table_id="Transaction_partitions",
890
+ project_id="internal-gcp-project",
891
891
  max_results=100,
892
- selected_fields='DATE',
893
- gcp_conn_id='airflow-conn-id'
892
+ selected_fields="DATE",
893
+ gcp_conn_id="airflow-conn-id",
894
894
  )
895
895
 
896
896
  :param dataset_id: The dataset ID of the requested table. (templated)
@@ -1331,8 +1331,10 @@ class BigQueryCreateEmptyTableOperator(GoogleCloudBaseOperator):
1331
1331
 
1332
1332
  **Example**::
1333
1333
 
1334
- schema_fields=[{"name": "emp_name", "type": "STRING", "mode": "REQUIRED"},
1335
- {"name": "salary", "type": "INTEGER", "mode": "NULLABLE"}]
1334
+ schema_fields = [
1335
+ {"name": "emp_name", "type": "STRING", "mode": "REQUIRED"},
1336
+ {"name": "salary", "type": "INTEGER", "mode": "NULLABLE"},
1337
+ ]
1336
1338
 
1337
1339
  :param gcs_schema_object: Full path to the JSON file containing
1338
1340
  schema (templated). For
@@ -1351,41 +1353,35 @@ class BigQueryCreateEmptyTableOperator(GoogleCloudBaseOperator):
1351
1353
  **Example (with schema JSON in GCS)**::
1352
1354
 
1353
1355
  CreateTable = BigQueryCreateEmptyTableOperator(
1354
- task_id='BigQueryCreateEmptyTableOperator_task',
1355
- dataset_id='ODS',
1356
- table_id='Employees',
1357
- project_id='internal-gcp-project',
1358
- gcs_schema_object='gs://schema-bucket/employee_schema.json',
1359
- gcp_conn_id='airflow-conn-id',
1360
- google_cloud_storage_conn_id='airflow-conn-id'
1356
+ task_id="BigQueryCreateEmptyTableOperator_task",
1357
+ dataset_id="ODS",
1358
+ table_id="Employees",
1359
+ project_id="internal-gcp-project",
1360
+ gcs_schema_object="gs://schema-bucket/employee_schema.json",
1361
+ gcp_conn_id="airflow-conn-id",
1362
+ google_cloud_storage_conn_id="airflow-conn-id",
1361
1363
  )
1362
1364
 
1363
1365
  **Corresponding Schema file** (``employee_schema.json``)::
1364
1366
 
1365
1367
  [
1366
- {
1367
- "mode": "NULLABLE",
1368
- "name": "emp_name",
1369
- "type": "STRING"
1370
- },
1371
- {
1372
- "mode": "REQUIRED",
1373
- "name": "salary",
1374
- "type": "INTEGER"
1375
- }
1368
+ {"mode": "NULLABLE", "name": "emp_name", "type": "STRING"},
1369
+ {"mode": "REQUIRED", "name": "salary", "type": "INTEGER"},
1376
1370
  ]
1377
1371
 
1378
1372
  **Example (with schema in the DAG)**::
1379
1373
 
1380
1374
  CreateTable = BigQueryCreateEmptyTableOperator(
1381
- task_id='BigQueryCreateEmptyTableOperator_task',
1382
- dataset_id='ODS',
1383
- table_id='Employees',
1384
- project_id='internal-gcp-project',
1385
- schema_fields=[{"name": "emp_name", "type": "STRING", "mode": "REQUIRED"},
1386
- {"name": "salary", "type": "INTEGER", "mode": "NULLABLE"}],
1387
- gcp_conn_id='airflow-conn-id-account',
1388
- google_cloud_storage_conn_id='airflow-conn-id'
1375
+ task_id="BigQueryCreateEmptyTableOperator_task",
1376
+ dataset_id="ODS",
1377
+ table_id="Employees",
1378
+ project_id="internal-gcp-project",
1379
+ schema_fields=[
1380
+ {"name": "emp_name", "type": "STRING", "mode": "REQUIRED"},
1381
+ {"name": "salary", "type": "INTEGER", "mode": "NULLABLE"},
1382
+ ],
1383
+ gcp_conn_id="airflow-conn-id-account",
1384
+ google_cloud_storage_conn_id="airflow-conn-id",
1389
1385
  )
1390
1386
 
1391
1387
  :param view: [Optional] A dictionary containing definition for the view.
@@ -1582,8 +1578,10 @@ class BigQueryCreateExternalTableOperator(GoogleCloudBaseOperator):
1582
1578
 
1583
1579
  **Example**::
1584
1580
 
1585
- schema_fields=[{"name": "emp_name", "type": "STRING", "mode": "REQUIRED"},
1586
- {"name": "salary", "type": "INTEGER", "mode": "NULLABLE"}]
1581
+ schema_fields = [
1582
+ {"name": "emp_name", "type": "STRING", "mode": "REQUIRED"},
1583
+ {"name": "salary", "type": "INTEGER", "mode": "NULLABLE"},
1584
+ ]
1587
1585
 
1588
1586
  Should not be set when source_format is 'DATASTORE_BACKUP'.
1589
1587
  :param table_resource: Table resource as described in documentation:
@@ -1878,12 +1876,13 @@ class BigQueryDeleteDatasetOperator(GoogleCloudBaseOperator):
1878
1876
  **Example**::
1879
1877
 
1880
1878
  delete_temp_data = BigQueryDeleteDatasetOperator(
1881
- dataset_id='temp-dataset',
1882
- project_id='temp-project',
1883
- delete_contents=True, # Force the deletion of the dataset as well as its tables (if any).
1884
- gcp_conn_id='_my_gcp_conn_',
1885
- task_id='Deletetemp',
1886
- dag=dag)
1879
+ dataset_id="temp-dataset",
1880
+ project_id="temp-project",
1881
+ delete_contents=True, # Force the deletion of the dataset as well as its tables (if any).
1882
+ gcp_conn_id="_my_gcp_conn_",
1883
+ task_id="Deletetemp",
1884
+ dag=dag,
1885
+ )
1887
1886
  """
1888
1887
 
1889
1888
  template_fields: Sequence[str] = (
@@ -2792,6 +2791,8 @@ class BigQueryInsertJobOperator(GoogleCloudBaseOperator, _BigQueryOpenLineageMix
2792
2791
  impersonation_chain=self.impersonation_chain,
2793
2792
  )
2794
2793
  self.hook = hook
2794
+ if self.project_id is None:
2795
+ self.project_id = hook.project_id
2795
2796
 
2796
2797
  self.job_id = hook.generate_job_id(
2797
2798
  job_id=self.job_id,
@@ -2831,8 +2832,7 @@ class BigQueryInsertJobOperator(GoogleCloudBaseOperator, _BigQueryOpenLineageMix
2831
2832
  QueryJob._JOB_TYPE: ["destinationTable"],
2832
2833
  }
2833
2834
 
2834
- project_id = self.project_id or hook.project_id
2835
- if project_id:
2835
+ if self.project_id:
2836
2836
  for job_type, tables_prop in job_types.items():
2837
2837
  job_configuration = job.to_api_repr()["configuration"]
2838
2838
  if job_type in job_configuration:
@@ -2842,7 +2842,7 @@ class BigQueryInsertJobOperator(GoogleCloudBaseOperator, _BigQueryOpenLineageMix
2842
2842
  persist_kwargs = {
2843
2843
  "context": context,
2844
2844
  "task_instance": self,
2845
- "project_id": project_id,
2845
+ "project_id": self.project_id,
2846
2846
  "table_id": table,
2847
2847
  }
2848
2848
  if not isinstance(table, str):
@@ -2851,11 +2851,11 @@ class BigQueryInsertJobOperator(GoogleCloudBaseOperator, _BigQueryOpenLineageMix
2851
2851
  persist_kwargs["project_id"] = table["projectId"]
2852
2852
  BigQueryTableLink.persist(**persist_kwargs)
2853
2853
  self.job_id = job.job_id
2854
- project_id = self.project_id or self.hook.project_id
2855
- if project_id:
2854
+
2855
+ if self.project_id:
2856
2856
  job_id_path = convert_job_id(
2857
2857
  job_id=self.job_id, # type: ignore[arg-type]
2858
- project_id=project_id,
2858
+ project_id=self.project_id,
2859
2859
  location=self.location,
2860
2860
  )
2861
2861
  context["ti"].xcom_push(key="job_id_path", value=job_id_path)
@@ -112,7 +112,7 @@ class CloudComposerCreateEnvironmentOperator(GoogleCloudBaseOperator):
112
112
  :param metadata: Strings which should be sent along with the request as metadata.
113
113
  :param deferrable: Run operator in the deferrable mode
114
114
  :param pooling_period_seconds: Optional: Control the rate of the poll for the result of deferrable run.
115
- By default the trigger will poll every 30 seconds.
115
+ By default, the trigger will poll every 30 seconds.
116
116
  """
117
117
 
118
118
  template_fields = (
@@ -264,7 +264,7 @@ class CloudRunExecuteJobOperator(GoogleCloudBaseOperator):
264
264
  :param deferrable: Run operator in the deferrable mode
265
265
  """
266
266
 
267
- template_fields = ("project_id", "region", "gcp_conn_id", "impersonation_chain", "job_name")
267
+ template_fields = ("project_id", "region", "gcp_conn_id", "impersonation_chain", "job_name", "overrides")
268
268
 
269
269
  def __init__(
270
270
  self,
@@ -321,10 +321,10 @@ class CloudRunExecuteJobOperator(GoogleCloudBaseOperator):
321
321
  def execute_complete(self, context: Context, event: dict):
322
322
  status = event["status"]
323
323
 
324
- if status == RunJobStatus.TIMEOUT:
324
+ if status == RunJobStatus.TIMEOUT.value:
325
325
  raise AirflowException("Operation timed out")
326
326
 
327
- if status == RunJobStatus.FAIL:
327
+ if status == RunJobStatus.FAIL.value:
328
328
  error_code = event["operation_error_code"]
329
329
  error_message = event["operation_error_message"]
330
330
  raise AirflowException(
@@ -1286,6 +1286,12 @@ class DataflowStopJobOperator(GoogleCloudBaseOperator):
1286
1286
  :param stop_timeout: wait time in seconds for successful job canceling/draining
1287
1287
  """
1288
1288
 
1289
+ template_fields = [
1290
+ "job_id",
1291
+ "project_id",
1292
+ "impersonation_chain",
1293
+ ]
1294
+
1289
1295
  def __init__(
1290
1296
  self,
1291
1297
  job_name_prefix: str | None = None,