apache-airflow-providers-google 10.26.0__py3-none-any.whl → 11.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/__init__.py +1 -1
- airflow/providers/google/ads/hooks/ads.py +2 -1
- airflow/providers/google/ads/operators/ads.py +2 -1
- airflow/providers/google/ads/transfers/ads_to_gcs.py +2 -1
- airflow/providers/google/assets/gcs.py +17 -1
- airflow/providers/google/cloud/hooks/automl.py +3 -6
- airflow/providers/google/cloud/hooks/bigquery.py +41 -1486
- airflow/providers/google/cloud/hooks/bigquery_dts.py +4 -11
- airflow/providers/google/cloud/hooks/bigtable.py +3 -6
- airflow/providers/google/cloud/hooks/cloud_batch.py +6 -3
- airflow/providers/google/cloud/hooks/cloud_build.py +3 -15
- airflow/providers/google/cloud/hooks/cloud_composer.py +2 -17
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +5 -6
- airflow/providers/google/cloud/hooks/cloud_run.py +10 -5
- airflow/providers/google/cloud/hooks/cloud_sql.py +5 -7
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +3 -7
- airflow/providers/google/cloud/hooks/compute.py +3 -6
- airflow/providers/google/cloud/hooks/compute_ssh.py +0 -5
- airflow/providers/google/cloud/hooks/datacatalog.py +3 -6
- airflow/providers/google/cloud/hooks/dataflow.py +3 -14
- airflow/providers/google/cloud/hooks/dataform.py +2 -9
- airflow/providers/google/cloud/hooks/datafusion.py +4 -15
- airflow/providers/google/cloud/hooks/dataplex.py +4 -7
- airflow/providers/google/cloud/hooks/dataprep.py +2 -2
- airflow/providers/google/cloud/hooks/dataproc.py +77 -22
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +2 -9
- airflow/providers/google/cloud/hooks/datastore.py +3 -6
- airflow/providers/google/cloud/hooks/dlp.py +3 -6
- airflow/providers/google/cloud/hooks/functions.py +2 -6
- airflow/providers/google/cloud/hooks/gcs.py +2 -18
- airflow/providers/google/cloud/hooks/gdm.py +1 -17
- airflow/providers/google/cloud/hooks/kms.py +3 -6
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +7 -97
- airflow/providers/google/cloud/hooks/life_sciences.py +2 -6
- airflow/providers/google/cloud/hooks/looker.py +2 -1
- airflow/providers/google/cloud/hooks/mlengine.py +0 -8
- airflow/providers/google/cloud/hooks/natural_language.py +3 -6
- airflow/providers/google/cloud/hooks/os_login.py +3 -6
- airflow/providers/google/cloud/hooks/pubsub.py +3 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +3 -73
- airflow/providers/google/cloud/hooks/spanner.py +3 -6
- airflow/providers/google/cloud/hooks/speech_to_text.py +3 -6
- airflow/providers/google/cloud/hooks/stackdriver.py +3 -6
- airflow/providers/google/cloud/hooks/tasks.py +3 -6
- airflow/providers/google/cloud/hooks/text_to_speech.py +3 -6
- airflow/providers/google/cloud/hooks/translate.py +455 -9
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +3 -6
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -6
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +3 -6
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +2 -9
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +2 -9
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -14
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +3 -6
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +2 -9
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +3 -1
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +2 -1
- airflow/providers/google/cloud/hooks/video_intelligence.py +3 -6
- airflow/providers/google/cloud/hooks/vision.py +3 -6
- airflow/providers/google/cloud/hooks/workflows.py +2 -9
- airflow/providers/google/cloud/links/dataproc.py +0 -1
- airflow/providers/google/cloud/links/translate.py +91 -0
- airflow/providers/google/cloud/log/gcs_task_handler.py +2 -1
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +11 -3
- airflow/providers/google/cloud/openlineage/utils.py +54 -21
- airflow/providers/google/cloud/operators/automl.py +5 -4
- airflow/providers/google/cloud/operators/bigquery.py +2 -341
- airflow/providers/google/cloud/operators/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/operators/bigtable.py +2 -1
- airflow/providers/google/cloud/operators/cloud_batch.py +2 -1
- airflow/providers/google/cloud/operators/cloud_build.py +2 -1
- airflow/providers/google/cloud/operators/cloud_composer.py +2 -1
- airflow/providers/google/cloud/operators/cloud_memorystore.py +2 -1
- airflow/providers/google/cloud/operators/cloud_run.py +2 -1
- airflow/providers/google/cloud/operators/cloud_sql.py +2 -1
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +2 -1
- airflow/providers/google/cloud/operators/compute.py +2 -1
- airflow/providers/google/cloud/operators/datacatalog.py +2 -1
- airflow/providers/google/cloud/operators/dataflow.py +2 -517
- airflow/providers/google/cloud/operators/dataform.py +2 -1
- airflow/providers/google/cloud/operators/datafusion.py +2 -1
- airflow/providers/google/cloud/operators/dataplex.py +37 -31
- airflow/providers/google/cloud/operators/dataprep.py +2 -1
- airflow/providers/google/cloud/operators/dataproc.py +3 -633
- airflow/providers/google/cloud/operators/dataproc_metastore.py +2 -1
- airflow/providers/google/cloud/operators/datastore.py +2 -1
- airflow/providers/google/cloud/operators/dlp.py +2 -1
- airflow/providers/google/cloud/operators/functions.py +2 -1
- airflow/providers/google/cloud/operators/gcs.py +5 -4
- airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -11
- airflow/providers/google/cloud/operators/life_sciences.py +2 -1
- airflow/providers/google/cloud/operators/mlengine.py +2 -1
- airflow/providers/google/cloud/operators/natural_language.py +3 -2
- airflow/providers/google/cloud/operators/pubsub.py +2 -1
- airflow/providers/google/cloud/operators/spanner.py +2 -1
- airflow/providers/google/cloud/operators/speech_to_text.py +2 -1
- airflow/providers/google/cloud/operators/stackdriver.py +2 -1
- airflow/providers/google/cloud/operators/tasks.py +3 -2
- airflow/providers/google/cloud/operators/text_to_speech.py +2 -1
- airflow/providers/google/cloud/operators/translate.py +622 -32
- airflow/providers/google/cloud/operators/translate_speech.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +2 -93
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +3 -13
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +2 -17
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +3 -13
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +2 -1
- airflow/providers/google/cloud/operators/video_intelligence.py +2 -1
- airflow/providers/google/cloud/operators/vision.py +3 -2
- airflow/providers/google/cloud/operators/workflows.py +3 -2
- airflow/providers/google/cloud/secrets/secret_manager.py +2 -19
- airflow/providers/google/cloud/sensors/bigquery.py +2 -81
- airflow/providers/google/cloud/sensors/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/sensors/bigtable.py +2 -1
- airflow/providers/google/cloud/sensors/cloud_composer.py +8 -94
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +2 -1
- airflow/providers/google/cloud/sensors/dataflow.py +2 -1
- airflow/providers/google/cloud/sensors/dataform.py +2 -1
- airflow/providers/google/cloud/sensors/datafusion.py +2 -1
- airflow/providers/google/cloud/sensors/dataplex.py +2 -1
- airflow/providers/google/cloud/sensors/dataprep.py +2 -1
- airflow/providers/google/cloud/sensors/dataproc.py +2 -1
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +2 -1
- airflow/providers/google/cloud/sensors/gcs.py +4 -36
- airflow/providers/google/cloud/sensors/pubsub.py +2 -1
- airflow/providers/google/cloud/sensors/tasks.py +2 -1
- airflow/providers/google/cloud/sensors/workflows.py +2 -1
- airflow/providers/google/cloud/transfers/adls_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +75 -18
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +9 -7
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +2 -1
- airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +1 -1
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +2 -1
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +13 -9
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/gcs_to_local.py +2 -1
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +2 -1
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -1
- airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +2 -1
- airflow/providers/google/cloud/triggers/bigquery.py +2 -1
- airflow/providers/google/cloud/triggers/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_batch.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_build.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_composer.py +3 -2
- airflow/providers/google/cloud/triggers/cloud_run.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_sql.py +1 -1
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +2 -1
- airflow/providers/google/cloud/triggers/dataflow.py +2 -1
- airflow/providers/google/cloud/triggers/datafusion.py +2 -1
- airflow/providers/google/cloud/triggers/dataplex.py +1 -1
- airflow/providers/google/cloud/triggers/dataproc.py +2 -1
- airflow/providers/google/cloud/triggers/gcs.py +3 -2
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +2 -1
- airflow/providers/google/cloud/triggers/mlengine.py +2 -1
- airflow/providers/google/cloud/triggers/pubsub.py +2 -1
- airflow/providers/google/cloud/triggers/vertex_ai.py +2 -1
- airflow/providers/google/cloud/utils/credentials_provider.py +1 -1
- airflow/providers/google/cloud/utils/dataform.py +1 -1
- airflow/providers/google/cloud/utils/field_validator.py +2 -1
- airflow/providers/google/cloud/utils/mlengine_operator_utils.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +4 -11
- airflow/providers/google/common/hooks/discovery_api.py +1 -6
- airflow/providers/google/firebase/hooks/firestore.py +1 -1
- airflow/providers/google/firebase/operators/firestore.py +2 -1
- airflow/providers/google/get_provider_info.py +7 -22
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +2 -1
- airflow/providers/google/marketing_platform/hooks/campaign_manager.py +2 -3
- airflow/providers/google/marketing_platform/hooks/display_video.py +4 -3
- airflow/providers/google/marketing_platform/hooks/search_ads.py +6 -6
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +2 -1
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +2 -42
- airflow/providers/google/marketing_platform/operators/display_video.py +2 -47
- airflow/providers/google/marketing_platform/operators/search_ads.py +2 -1
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -7
- airflow/providers/google/marketing_platform/sensors/display_video.py +2 -13
- airflow/providers/google/suite/hooks/calendar.py +2 -8
- airflow/providers/google/suite/hooks/drive.py +2 -6
- airflow/providers/google/suite/hooks/sheets.py +2 -7
- airflow/providers/google/suite/operators/sheets.py +2 -7
- airflow/providers/google/suite/sensors/drive.py +2 -7
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +2 -7
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +2 -7
- airflow/providers/google/suite/transfers/local_to_drive.py +2 -7
- airflow/providers/google/suite/transfers/sql_to_sheets.py +2 -7
- {apache_airflow_providers_google-10.26.0.dist-info → apache_airflow_providers_google-11.0.0.dist-info}/METADATA +10 -10
- apache_airflow_providers_google-11.0.0.dist-info/RECORD +315 -0
- airflow/providers/google/marketing_platform/hooks/analytics.py +0 -211
- airflow/providers/google/marketing_platform/operators/analytics.py +0 -551
- apache_airflow_providers_google-10.26.0.dist-info/RECORD +0 -317
- {apache_airflow_providers_google-10.26.0.dist-info → apache_airflow_providers_google-11.0.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-10.26.0.dist-info → apache_airflow_providers_google-11.0.0.dist-info}/entry_points.txt +0 -0
@@ -23,18 +23,16 @@ import enum
|
|
23
23
|
import json
|
24
24
|
import re
|
25
25
|
import warnings
|
26
|
+
from collections.abc import Sequence
|
26
27
|
from functools import cached_property
|
27
|
-
from typing import TYPE_CHECKING, Any,
|
28
|
+
from typing import TYPE_CHECKING, Any, SupportsAbs
|
28
29
|
|
29
|
-
import attr
|
30
30
|
from google.api_core.exceptions import Conflict
|
31
31
|
from google.cloud.bigquery import DEFAULT_RETRY, CopyJob, ExtractJob, LoadJob, QueryJob, Row
|
32
32
|
from google.cloud.bigquery.table import RowIterator
|
33
33
|
|
34
34
|
from airflow.configuration import conf
|
35
35
|
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning, AirflowSkipException
|
36
|
-
from airflow.models import BaseOperator, BaseOperatorLink
|
37
|
-
from airflow.models.xcom import XCom
|
38
36
|
from airflow.providers.common.sql.operators.sql import ( # type: ignore[attr-defined] # for _parse_boolean
|
39
37
|
SQLCheckOperator,
|
40
38
|
SQLColumnCheckOperator,
|
@@ -56,7 +54,6 @@ from airflow.providers.google.cloud.triggers.bigquery import (
|
|
56
54
|
BigQueryValueCheckTrigger,
|
57
55
|
)
|
58
56
|
from airflow.providers.google.cloud.utils.bigquery import convert_job_id
|
59
|
-
from airflow.providers.google.common.deprecated import deprecated
|
60
57
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
61
58
|
from airflow.utils.helpers import exactly_one
|
62
59
|
|
@@ -64,7 +61,6 @@ if TYPE_CHECKING:
|
|
64
61
|
from google.api_core.retry import Retry
|
65
62
|
from google.cloud.bigquery import UnknownJob
|
66
63
|
|
67
|
-
from airflow.models.taskinstancekey import TaskInstanceKey
|
68
64
|
from airflow.utils.context import Context
|
69
65
|
|
70
66
|
|
@@ -91,46 +87,6 @@ class IfExistAction(enum.Enum):
|
|
91
87
|
SKIP = "skip"
|
92
88
|
|
93
89
|
|
94
|
-
class BigQueryConsoleLink(BaseOperatorLink):
|
95
|
-
"""Helper class for constructing BigQuery link."""
|
96
|
-
|
97
|
-
name = "BigQuery Console"
|
98
|
-
|
99
|
-
def get_link(
|
100
|
-
self,
|
101
|
-
operator: BaseOperator,
|
102
|
-
*,
|
103
|
-
ti_key: TaskInstanceKey,
|
104
|
-
):
|
105
|
-
job_id_path = XCom.get_value(key="job_id_path", ti_key=ti_key)
|
106
|
-
return BIGQUERY_JOB_DETAILS_LINK_FMT.format(job_id=job_id_path) if job_id_path else ""
|
107
|
-
|
108
|
-
|
109
|
-
@attr.s(auto_attribs=True)
|
110
|
-
class BigQueryConsoleIndexableLink(BaseOperatorLink):
|
111
|
-
"""Helper class for constructing BigQuery link."""
|
112
|
-
|
113
|
-
index: int = attr.ib()
|
114
|
-
|
115
|
-
@property
|
116
|
-
def name(self) -> str:
|
117
|
-
return f"BigQuery Console #{self.index + 1}"
|
118
|
-
|
119
|
-
def get_link(
|
120
|
-
self,
|
121
|
-
operator: BaseOperator,
|
122
|
-
*,
|
123
|
-
ti_key: TaskInstanceKey,
|
124
|
-
):
|
125
|
-
job_ids = XCom.get_value(key="job_id_path", ti_key=ti_key)
|
126
|
-
if not job_ids:
|
127
|
-
return None
|
128
|
-
if len(job_ids) < self.index:
|
129
|
-
return None
|
130
|
-
job_id = job_ids[self.index]
|
131
|
-
return BIGQUERY_JOB_DETAILS_LINK_FMT.format(job_id=job_id)
|
132
|
-
|
133
|
-
|
134
90
|
class _BigQueryDbHookMixin:
|
135
91
|
def get_db_hook(self: BigQueryCheckOperator) -> BigQueryHook: # type:ignore[misc]
|
136
92
|
"""Get BigQuery DB Hook."""
|
@@ -1202,231 +1158,6 @@ class BigQueryGetDataOperator(GoogleCloudBaseOperator, _BigQueryOperatorsEncrypt
|
|
1202
1158
|
return event["records"]
|
1203
1159
|
|
1204
1160
|
|
1205
|
-
@deprecated(
|
1206
|
-
planned_removal_date="November 01, 2024",
|
1207
|
-
use_instead="BigQueryInsertJobOperator",
|
1208
|
-
category=AirflowProviderDeprecationWarning,
|
1209
|
-
)
|
1210
|
-
class BigQueryExecuteQueryOperator(GoogleCloudBaseOperator):
|
1211
|
-
"""
|
1212
|
-
Executes BigQuery SQL queries in a specific BigQuery database.
|
1213
|
-
|
1214
|
-
This operator is deprecated. Please use
|
1215
|
-
:class:`airflow.providers.google.cloud.operators.bigquery.BigQueryInsertJobOperator`
|
1216
|
-
instead.
|
1217
|
-
|
1218
|
-
This operator does not assert idempotency.
|
1219
|
-
|
1220
|
-
:param sql: the SQL code to be executed as a single string, or
|
1221
|
-
a list of str (sql statements), or a reference to a template file.
|
1222
|
-
Template references are recognized by str ending in '.sql'
|
1223
|
-
:param destination_dataset_table: A dotted
|
1224
|
-
``(<project>.|<project>:)<dataset>.<table>`` that, if set, will store the results
|
1225
|
-
of the query. (templated)
|
1226
|
-
:param write_disposition: Specifies the action that occurs if the destination table
|
1227
|
-
already exists. (default: 'WRITE_EMPTY')
|
1228
|
-
:param create_disposition: Specifies whether the job is allowed to create new tables.
|
1229
|
-
(default: 'CREATE_IF_NEEDED')
|
1230
|
-
:param allow_large_results: Whether to allow large results.
|
1231
|
-
:param flatten_results: If true and query uses legacy SQL dialect, flattens
|
1232
|
-
all nested and repeated fields in the query results. ``allow_large_results``
|
1233
|
-
must be ``true`` if this is set to ``false``. For standard SQL queries, this
|
1234
|
-
flag is ignored and results are never flattened.
|
1235
|
-
:param gcp_conn_id: (Optional) The connection ID used to connect to Google Cloud.
|
1236
|
-
:param udf_config: The User Defined Function configuration for the query.
|
1237
|
-
See https://cloud.google.com/bigquery/user-defined-functions for details.
|
1238
|
-
:param use_legacy_sql: Whether to use legacy SQL (true) or standard SQL (false).
|
1239
|
-
:param maximum_billing_tier: Positive integer that serves as a multiplier
|
1240
|
-
of the basic price.
|
1241
|
-
Defaults to None, in which case it uses the value set in the project.
|
1242
|
-
:param maximum_bytes_billed: Limits the bytes billed for this job.
|
1243
|
-
Queries that will have bytes billed beyond this limit will fail
|
1244
|
-
(without incurring a charge). If unspecified, this will be
|
1245
|
-
set to your project default.
|
1246
|
-
:param api_resource_configs: a dictionary that contain params
|
1247
|
-
'configuration' applied for Google BigQuery Jobs API:
|
1248
|
-
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs
|
1249
|
-
for example, {'query': {'useQueryCache': False}}. You could use it
|
1250
|
-
if you need to provide some params that are not supported by BigQueryOperator
|
1251
|
-
like args.
|
1252
|
-
:param schema_update_options: Allows the schema of the destination
|
1253
|
-
table to be updated as a side effect of the load job.
|
1254
|
-
:param query_params: a list of dictionary containing query parameter types and
|
1255
|
-
values, passed to BigQuery. The structure of dictionary should look like
|
1256
|
-
'queryParameters' in Google BigQuery Jobs API:
|
1257
|
-
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs.
|
1258
|
-
For example, [{ 'name': 'corpus', 'parameterType': { 'type': 'STRING' },
|
1259
|
-
'parameterValue': { 'value': 'romeoandjuliet' } }]. (templated)
|
1260
|
-
:param labels: a dictionary containing labels for the job/query,
|
1261
|
-
passed to BigQuery
|
1262
|
-
:param priority: Specifies a priority for the query.
|
1263
|
-
Possible values include INTERACTIVE and BATCH.
|
1264
|
-
The default value is INTERACTIVE.
|
1265
|
-
:param time_partitioning: configure optional time partitioning fields i.e.
|
1266
|
-
partition by field, type and expiration as per API specifications.
|
1267
|
-
:param cluster_fields: Request that the result of this query be stored sorted
|
1268
|
-
by one or more columns. BigQuery supports clustering for both partitioned and
|
1269
|
-
non-partitioned tables. The order of columns given determines the sort order.
|
1270
|
-
:param location: The geographic location of the job. Required except for
|
1271
|
-
US and EU. See details at
|
1272
|
-
https://cloud.google.com/bigquery/docs/locations#specifying_your_location
|
1273
|
-
:param encryption_configuration: (Optional) Custom encryption configuration (e.g., Cloud KMS keys).
|
1274
|
-
|
1275
|
-
.. code-block:: python
|
1276
|
-
|
1277
|
-
encryption_configuration = {
|
1278
|
-
"kmsKeyName": "projects/PROJECT/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY",
|
1279
|
-
}
|
1280
|
-
:param impersonation_chain: Optional service account to impersonate using short-term
|
1281
|
-
credentials, or chained list of accounts required to get the access_token
|
1282
|
-
of the last account in the list, which will be impersonated in the request.
|
1283
|
-
If set as a string, the account must grant the originating account
|
1284
|
-
the Service Account Token Creator IAM role.
|
1285
|
-
If set as a sequence, the identities from the list must grant
|
1286
|
-
Service Account Token Creator IAM role to the directly preceding identity, with first
|
1287
|
-
account from the list granting this role to the originating account (templated).
|
1288
|
-
"""
|
1289
|
-
|
1290
|
-
template_fields: Sequence[str] = (
|
1291
|
-
"sql",
|
1292
|
-
"destination_dataset_table",
|
1293
|
-
"labels",
|
1294
|
-
"query_params",
|
1295
|
-
"impersonation_chain",
|
1296
|
-
)
|
1297
|
-
template_ext: Sequence[str] = (".sql",)
|
1298
|
-
template_fields_renderers = {"sql": "sql"}
|
1299
|
-
ui_color = BigQueryUIColors.QUERY.value
|
1300
|
-
|
1301
|
-
@property
|
1302
|
-
def operator_extra_links(self):
|
1303
|
-
"""Return operator extra links."""
|
1304
|
-
if isinstance(self.sql, str):
|
1305
|
-
return (BigQueryConsoleLink(),)
|
1306
|
-
return (BigQueryConsoleIndexableLink(i) for i, _ in enumerate(self.sql))
|
1307
|
-
|
1308
|
-
def __init__(
|
1309
|
-
self,
|
1310
|
-
*,
|
1311
|
-
sql: str | Iterable[str],
|
1312
|
-
destination_dataset_table: str | None = None,
|
1313
|
-
write_disposition: str = "WRITE_EMPTY",
|
1314
|
-
allow_large_results: bool = False,
|
1315
|
-
flatten_results: bool | None = None,
|
1316
|
-
gcp_conn_id: str = "google_cloud_default",
|
1317
|
-
udf_config: list | None = None,
|
1318
|
-
use_legacy_sql: bool = True,
|
1319
|
-
maximum_billing_tier: int | None = None,
|
1320
|
-
maximum_bytes_billed: float | None = None,
|
1321
|
-
create_disposition: str = "CREATE_IF_NEEDED",
|
1322
|
-
schema_update_options: list | tuple | set | None = None,
|
1323
|
-
query_params: list | None = None,
|
1324
|
-
labels: dict | None = None,
|
1325
|
-
priority: str = "INTERACTIVE",
|
1326
|
-
time_partitioning: dict | None = None,
|
1327
|
-
api_resource_configs: dict | None = None,
|
1328
|
-
cluster_fields: list[str] | None = None,
|
1329
|
-
location: str | None = None,
|
1330
|
-
encryption_configuration: dict | None = None,
|
1331
|
-
impersonation_chain: str | Sequence[str] | None = None,
|
1332
|
-
impersonation_scopes: str | Sequence[str] | None = None,
|
1333
|
-
job_id: str | list[str] | None = None,
|
1334
|
-
**kwargs,
|
1335
|
-
) -> None:
|
1336
|
-
super().__init__(**kwargs)
|
1337
|
-
self.sql = sql
|
1338
|
-
self.destination_dataset_table = destination_dataset_table
|
1339
|
-
self.write_disposition = write_disposition
|
1340
|
-
self.create_disposition = create_disposition
|
1341
|
-
self.allow_large_results = allow_large_results
|
1342
|
-
self.flatten_results = flatten_results
|
1343
|
-
self.gcp_conn_id = gcp_conn_id
|
1344
|
-
self.udf_config = udf_config
|
1345
|
-
self.use_legacy_sql = use_legacy_sql
|
1346
|
-
self.maximum_billing_tier = maximum_billing_tier
|
1347
|
-
self.maximum_bytes_billed = maximum_bytes_billed
|
1348
|
-
self.schema_update_options = schema_update_options
|
1349
|
-
self.query_params = query_params
|
1350
|
-
self.labels = labels
|
1351
|
-
self.priority = priority
|
1352
|
-
self.time_partitioning = time_partitioning
|
1353
|
-
self.api_resource_configs = api_resource_configs
|
1354
|
-
self.cluster_fields = cluster_fields
|
1355
|
-
self.location = location
|
1356
|
-
self.encryption_configuration = encryption_configuration
|
1357
|
-
self.hook: BigQueryHook | None = None
|
1358
|
-
self.impersonation_chain = impersonation_chain
|
1359
|
-
self.impersonation_scopes = impersonation_scopes
|
1360
|
-
self.job_id = job_id
|
1361
|
-
|
1362
|
-
def execute(self, context: Context):
|
1363
|
-
if self.hook is None:
|
1364
|
-
self.log.info("Executing: %s", self.sql)
|
1365
|
-
self.hook = BigQueryHook(
|
1366
|
-
gcp_conn_id=self.gcp_conn_id,
|
1367
|
-
use_legacy_sql=self.use_legacy_sql,
|
1368
|
-
location=self.location,
|
1369
|
-
impersonation_chain=self.impersonation_chain,
|
1370
|
-
impersonation_scopes=self.impersonation_scopes,
|
1371
|
-
)
|
1372
|
-
if isinstance(self.sql, str):
|
1373
|
-
self.job_id = self.hook.run_query(
|
1374
|
-
sql=self.sql,
|
1375
|
-
destination_dataset_table=self.destination_dataset_table,
|
1376
|
-
write_disposition=self.write_disposition,
|
1377
|
-
allow_large_results=self.allow_large_results,
|
1378
|
-
flatten_results=self.flatten_results,
|
1379
|
-
udf_config=self.udf_config,
|
1380
|
-
maximum_billing_tier=self.maximum_billing_tier,
|
1381
|
-
maximum_bytes_billed=self.maximum_bytes_billed,
|
1382
|
-
create_disposition=self.create_disposition,
|
1383
|
-
query_params=self.query_params,
|
1384
|
-
labels=self.labels,
|
1385
|
-
schema_update_options=self.schema_update_options,
|
1386
|
-
priority=self.priority,
|
1387
|
-
time_partitioning=self.time_partitioning,
|
1388
|
-
api_resource_configs=self.api_resource_configs,
|
1389
|
-
cluster_fields=self.cluster_fields,
|
1390
|
-
encryption_configuration=self.encryption_configuration,
|
1391
|
-
)
|
1392
|
-
elif isinstance(self.sql, Iterable):
|
1393
|
-
self.job_id = [
|
1394
|
-
self.hook.run_query(
|
1395
|
-
sql=s,
|
1396
|
-
destination_dataset_table=self.destination_dataset_table,
|
1397
|
-
write_disposition=self.write_disposition,
|
1398
|
-
allow_large_results=self.allow_large_results,
|
1399
|
-
flatten_results=self.flatten_results,
|
1400
|
-
udf_config=self.udf_config,
|
1401
|
-
maximum_billing_tier=self.maximum_billing_tier,
|
1402
|
-
maximum_bytes_billed=self.maximum_bytes_billed,
|
1403
|
-
create_disposition=self.create_disposition,
|
1404
|
-
query_params=self.query_params,
|
1405
|
-
labels=self.labels,
|
1406
|
-
schema_update_options=self.schema_update_options,
|
1407
|
-
priority=self.priority,
|
1408
|
-
time_partitioning=self.time_partitioning,
|
1409
|
-
api_resource_configs=self.api_resource_configs,
|
1410
|
-
cluster_fields=self.cluster_fields,
|
1411
|
-
encryption_configuration=self.encryption_configuration,
|
1412
|
-
)
|
1413
|
-
for s in self.sql
|
1414
|
-
]
|
1415
|
-
else:
|
1416
|
-
raise AirflowException(f"argument 'sql' of type {type(str)} is neither a string nor an iterable")
|
1417
|
-
project_id = self.hook.project_id
|
1418
|
-
if project_id:
|
1419
|
-
job_id_path = convert_job_id(job_id=self.job_id, project_id=project_id, location=self.location) # type: ignore[arg-type]
|
1420
|
-
context["task_instance"].xcom_push(key="job_id_path", value=job_id_path)
|
1421
|
-
return self.job_id
|
1422
|
-
|
1423
|
-
def on_kill(self) -> None:
|
1424
|
-
super().on_kill()
|
1425
|
-
if self.hook is not None:
|
1426
|
-
self.log.info("Cancelling running query")
|
1427
|
-
self.hook.cancel_job(self.hook.running_job_id)
|
1428
|
-
|
1429
|
-
|
1430
1161
|
class BigQueryCreateEmptyTableOperator(GoogleCloudBaseOperator):
|
1431
1162
|
"""
|
1432
1163
|
Creates a new table in the specified BigQuery dataset, optionally with schema.
|
@@ -2298,76 +2029,6 @@ class BigQueryGetDatasetTablesOperator(GoogleCloudBaseOperator):
|
|
2298
2029
|
)
|
2299
2030
|
|
2300
2031
|
|
2301
|
-
@deprecated(
|
2302
|
-
planned_removal_date="November 01, 2024",
|
2303
|
-
use_instead="BigQueryUpdateDatasetOperator",
|
2304
|
-
category=AirflowProviderDeprecationWarning,
|
2305
|
-
)
|
2306
|
-
class BigQueryPatchDatasetOperator(GoogleCloudBaseOperator):
|
2307
|
-
"""
|
2308
|
-
Patch a dataset for your Project in BigQuery.
|
2309
|
-
|
2310
|
-
This operator is deprecated. Please use
|
2311
|
-
:class:`airflow.providers.google.cloud.operators.bigquery.BigQueryUpdateTableOperator`
|
2312
|
-
instead.
|
2313
|
-
|
2314
|
-
Only replaces fields that are provided in the submitted dataset resource.
|
2315
|
-
|
2316
|
-
:param dataset_id: The id of dataset. Don't need to provide,
|
2317
|
-
if datasetId in dataset_reference.
|
2318
|
-
:param dataset_resource: Dataset resource that will be provided with request body.
|
2319
|
-
https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#resource
|
2320
|
-
:param project_id: The name of the project where we want to create the dataset.
|
2321
|
-
Don't need to provide, if projectId in dataset_reference.
|
2322
|
-
:param gcp_conn_id: (Optional) The connection ID used to connect to Google Cloud.
|
2323
|
-
:param impersonation_chain: Optional service account to impersonate using short-term
|
2324
|
-
credentials, or chained list of accounts required to get the access_token
|
2325
|
-
of the last account in the list, which will be impersonated in the request.
|
2326
|
-
If set as a string, the account must grant the originating account
|
2327
|
-
the Service Account Token Creator IAM role.
|
2328
|
-
If set as a sequence, the identities from the list must grant
|
2329
|
-
Service Account Token Creator IAM role to the directly preceding identity, with first
|
2330
|
-
account from the list granting this role to the originating account (templated).
|
2331
|
-
"""
|
2332
|
-
|
2333
|
-
template_fields: Sequence[str] = (
|
2334
|
-
"dataset_id",
|
2335
|
-
"project_id",
|
2336
|
-
"impersonation_chain",
|
2337
|
-
)
|
2338
|
-
template_fields_renderers = {"dataset_resource": "json"}
|
2339
|
-
ui_color = BigQueryUIColors.DATASET.value
|
2340
|
-
|
2341
|
-
def __init__(
|
2342
|
-
self,
|
2343
|
-
*,
|
2344
|
-
dataset_id: str,
|
2345
|
-
dataset_resource: dict,
|
2346
|
-
project_id: str = PROVIDE_PROJECT_ID,
|
2347
|
-
gcp_conn_id: str = "google_cloud_default",
|
2348
|
-
impersonation_chain: str | Sequence[str] | None = None,
|
2349
|
-
**kwargs,
|
2350
|
-
) -> None:
|
2351
|
-
self.dataset_id = dataset_id
|
2352
|
-
self.project_id = project_id
|
2353
|
-
self.gcp_conn_id = gcp_conn_id
|
2354
|
-
self.dataset_resource = dataset_resource
|
2355
|
-
self.impersonation_chain = impersonation_chain
|
2356
|
-
super().__init__(**kwargs)
|
2357
|
-
|
2358
|
-
def execute(self, context: Context):
|
2359
|
-
bq_hook = BigQueryHook(
|
2360
|
-
gcp_conn_id=self.gcp_conn_id,
|
2361
|
-
impersonation_chain=self.impersonation_chain,
|
2362
|
-
)
|
2363
|
-
|
2364
|
-
return bq_hook.patch_dataset(
|
2365
|
-
dataset_id=self.dataset_id,
|
2366
|
-
dataset_resource=self.dataset_resource,
|
2367
|
-
project_id=self.project_id,
|
2368
|
-
)
|
2369
|
-
|
2370
|
-
|
2371
2032
|
class BigQueryUpdateTableOperator(GoogleCloudBaseOperator):
|
2372
2033
|
"""
|
2373
2034
|
Update a table for your Project in BigQuery.
|
@@ -20,8 +20,9 @@
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
22
|
import time
|
23
|
+
from collections.abc import Sequence
|
23
24
|
from functools import cached_property
|
24
|
-
from typing import TYPE_CHECKING
|
25
|
+
from typing import TYPE_CHECKING
|
25
26
|
|
26
27
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
27
28
|
from google.cloud.bigquery_datatransfer_v1 import (
|
@@ -21,8 +21,9 @@ from __future__ import annotations
|
|
21
21
|
|
22
22
|
import json
|
23
23
|
import re
|
24
|
+
from collections.abc import Sequence
|
24
25
|
from copy import deepcopy
|
25
|
-
from typing import TYPE_CHECKING, Any
|
26
|
+
from typing import TYPE_CHECKING, Any
|
26
27
|
from urllib.parse import unquote, urlsplit
|
27
28
|
|
28
29
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
@@ -18,7 +18,8 @@
|
|
18
18
|
from __future__ import annotations
|
19
19
|
|
20
20
|
import shlex
|
21
|
-
from
|
21
|
+
from collections.abc import Sequence
|
22
|
+
from typing import TYPE_CHECKING
|
22
23
|
|
23
24
|
from google.api_core.exceptions import AlreadyExists
|
24
25
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
@@ -26,7 +26,8 @@ Operators for Google Cloud Memorystore service.
|
|
26
26
|
|
27
27
|
from __future__ import annotations
|
28
28
|
|
29
|
-
from
|
29
|
+
from collections.abc import Sequence
|
30
|
+
from typing import TYPE_CHECKING
|
30
31
|
|
31
32
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
32
33
|
from google.cloud.memcache_v1beta2.types import cloud_memcache
|
@@ -17,7 +17,8 @@
|
|
17
17
|
# under the License.
|
18
18
|
from __future__ import annotations
|
19
19
|
|
20
|
-
from
|
20
|
+
from collections.abc import Sequence
|
21
|
+
from typing import TYPE_CHECKING, Any
|
21
22
|
|
22
23
|
import google.cloud.exceptions
|
23
24
|
from google.api_core.exceptions import AlreadyExists
|
@@ -19,8 +19,9 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
+
from collections.abc import Iterable, Mapping, Sequence
|
22
23
|
from functools import cached_property
|
23
|
-
from typing import TYPE_CHECKING, Any
|
24
|
+
from typing import TYPE_CHECKING, Any
|
24
25
|
|
25
26
|
from googleapiclient.errors import HttpError
|
26
27
|
|
@@ -19,9 +19,10 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
+
from collections.abc import Sequence
|
22
23
|
from copy import deepcopy
|
23
24
|
from datetime import date, time
|
24
|
-
from typing import TYPE_CHECKING
|
25
|
+
from typing import TYPE_CHECKING
|
25
26
|
|
26
27
|
from airflow.exceptions import AirflowException
|
27
28
|
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
|
@@ -19,8 +19,9 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
+
from collections.abc import Sequence
|
22
23
|
from copy import deepcopy
|
23
|
-
from typing import TYPE_CHECKING, Any
|
24
|
+
from typing import TYPE_CHECKING, Any
|
24
25
|
|
25
26
|
from google.api_core import exceptions
|
26
27
|
from google.cloud.compute_v1.types import Instance, InstanceGroupManager, InstanceTemplate
|
@@ -16,7 +16,8 @@
|
|
16
16
|
# under the License.
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
-
from
|
19
|
+
from collections.abc import Sequence
|
20
|
+
from typing import TYPE_CHECKING
|
20
21
|
|
21
22
|
from google.api_core.exceptions import AlreadyExists, NotFound
|
22
23
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|