This is an automated email from the ASF dual-hosted git repository.
eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 3c5cc42 Fix deprecation warnings location in google provider (#16403)
3c5cc42 is described below
commit 3c5cc42e13322e9b2bc35be73bd04a8d59aa2447
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Mon Jun 14 06:20:27 2021 +0100
Fix deprecation warnings location in google provider (#16403)
These warnings were being issued from the wrong location, making them
hard for any users who hit them to fix
```
tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_serialization
/opt/airflow/airflow/models/dagbag.py:317: DeprecationWarning: This
operator is deprecated. Please use BigQueryUpdateDatasetOperator.
loader.exec_module(new_module)
tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_roundtrip_provider_example_dags
tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_serialization
/opt/airflow/airflow/models/baseoperator.py:181: DeprecationWarning:
`destination_bucket` is deprecated please use `bucket_name`
result = func(self, *args, **kwargs)
tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_roundtrip_provider_example_dags
tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_serialization
/opt/airflow/airflow/models/baseoperator.py:181: DeprecationWarning:
`destination_object` is deprecated please use `object_name`
result = func(self, *args, **kwargs)
```
---
airflow/providers/google/cloud/operators/bigquery.py | 4 +++-
airflow/providers/google/cloud/transfers/gdrive_to_gcs.py | 12 ++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/airflow/providers/google/cloud/operators/bigquery.py
b/airflow/providers/google/cloud/operators/bigquery.py
index 9d482fd..702b0f6 100644
--- a/airflow/providers/google/cloud/operators/bigquery.py
+++ b/airflow/providers/google/cloud/operators/bigquery.py
@@ -640,12 +640,14 @@ class BigQueryExecuteQueryOperator(BaseOperator):
"The bigquery_conn_id parameter has been deprecated. You
should pass "
"the gcp_conn_id parameter.",
DeprecationWarning,
+ stacklevel=2,
)
gcp_conn_id = bigquery_conn_id
warnings.warn(
"This operator is deprecated. Please use
`BigQueryInsertJobOperator`.",
DeprecationWarning,
+ stacklevel=2,
)
self.sql = sql
@@ -1638,7 +1640,7 @@ class BigQueryPatchDatasetOperator(BaseOperator):
warnings.warn(
"This operator is deprecated. Please use
BigQueryUpdateDatasetOperator.",
DeprecationWarning,
- stacklevel=3,
+ stacklevel=2,
)
self.dataset_id = dataset_id
self.project_id = project_id
diff --git a/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py
b/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py
index 4ed7293..05cfecd 100644
--- a/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py
+++ b/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py
@@ -93,10 +93,18 @@ class GoogleDriveToGCSOperator(BaseOperator):
super().__init__(**kwargs)
self.bucket_name = destination_bucket or bucket_name
if destination_bucket:
- warnings.warn("`destination_bucket` is deprecated please use
`bucket_name`", DeprecationWarning)
+ warnings.warn(
+ "`destination_bucket` is deprecated please use `bucket_name`",
+ DeprecationWarning,
+ stacklevel=2,
+ )
self.object_name = destination_object or object_name
if destination_object:
- warnings.warn("`destination_object` is deprecated please use
`object_name`", DeprecationWarning)
+ warnings.warn(
+ "`destination_object` is deprecated please use `object_name`",
+ DeprecationWarning,
+ stacklevel=2,
+ )
self.folder_id = folder_id
self.drive_id = drive_id
self.file_name = file_name