This is an automated email from the ASF dual-hosted git repository.

jedcunningham 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 5c2253f002d Remove Provider Deprecations in Mongo (#44632)
5c2253f002d is described below

commit 5c2253f002da15032951d73d77d9a7bb30a34688
Author: LIU ZHE YOU <[email protected]>
AuthorDate: Wed Dec 4 14:02:25 2024 +0800

    Remove Provider Deprecations in Mongo (#44632)
---
 .../src/airflow/providers/mongo/CHANGELOG.rst      | 11 +++++++++++
 .../src/airflow/providers/mongo/hooks/mongo.py     | 12 +----------
 providers/tests/mongo/hooks/test_mongo.py          | 23 +++++-----------------
 3 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/providers/src/airflow/providers/mongo/CHANGELOG.rst 
b/providers/src/airflow/providers/mongo/CHANGELOG.rst
index 35c3337fc80..4c08c5cddf7 100644
--- a/providers/src/airflow/providers/mongo/CHANGELOG.rst
+++ b/providers/src/airflow/providers/mongo/CHANGELOG.rst
@@ -27,6 +27,17 @@
 Changelog
 ---------
 
+main
+.....
+
+.. warning::
+   All deprecated classes, parameters and features have been removed from the 
MongoDB provider package.
+   The following breaking changes were introduced:
+
+   * Hooks
+
+      * Removed ``conn_id`` parameter from ``MongoHook``. Use 
``mongo_conn_id`` instead
+
 4.2.2
 .....
 
diff --git a/providers/src/airflow/providers/mongo/hooks/mongo.py 
b/providers/src/airflow/providers/mongo/hooks/mongo.py
index 6cfc8dca6b5..1deb7d01a26 100644
--- a/providers/src/airflow/providers/mongo/hooks/mongo.py
+++ b/providers/src/airflow/providers/mongo/hooks/mongo.py
@@ -19,7 +19,6 @@
 
 from __future__ import annotations
 
-import warnings
 from collections.abc import Iterable
 from typing import TYPE_CHECKING, Any, overload
 from urllib.parse import quote_plus, urlunsplit
@@ -27,7 +26,7 @@ from urllib.parse import quote_plus, urlunsplit
 import pymongo
 from pymongo import MongoClient, ReplaceOne
 
-from airflow.exceptions import AirflowConfigException, 
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowConfigException
 from airflow.hooks.base import BaseHook
 
 if TYPE_CHECKING:
@@ -118,15 +117,6 @@ class MongoHook(BaseHook):
 
     def __init__(self, mongo_conn_id: str = default_conn_name, *args, 
**kwargs) -> None:
         super().__init__()
-        if conn_id := kwargs.pop("conn_id", None):
-            warnings.warn(
-                "Parameter `conn_id` is deprecated and will be removed in a 
future releases. "
-                "Please use `mongo_conn_id` instead.",
-                AirflowProviderDeprecationWarning,
-                stacklevel=2,
-            )
-            mongo_conn_id = conn_id
-
         self.mongo_conn_id = mongo_conn_id
 
         conn = self.get_connection(self.mongo_conn_id)
diff --git a/providers/tests/mongo/hooks/test_mongo.py 
b/providers/tests/mongo/hooks/test_mongo.py
index f02ad477b4d..9207fdce71f 100644
--- a/providers/tests/mongo/hooks/test_mongo.py
+++ b/providers/tests/mongo/hooks/test_mongo.py
@@ -18,13 +18,12 @@
 from __future__ import annotations
 
 import importlib
-import warnings
 from typing import TYPE_CHECKING
 
 import pymongo
 import pytest
 
-from airflow.exceptions import AirflowConfigException, 
AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowConfigException
 from airflow.models import Connection
 from airflow.providers.mongo.hooks.mongo import MongoHook
 
@@ -99,22 +98,10 @@ class TestMongoHook:
         self.conn = self.hook.get_conn()
 
     def test_mongo_conn_id(self):
-        with warnings.catch_warnings():
-            warnings.simplefilter("error", 
category=AirflowProviderDeprecationWarning)
-            # Use default "mongo_default"
-            assert MongoHook().mongo_conn_id == "mongo_default"
-            # Positional argument
-            assert MongoHook("fake_connection").mongo_conn_id == 
"fake_connection"
-
-        warning_message = "Parameter `conn_id` is deprecated"
-        with pytest.warns(AirflowProviderDeprecationWarning, 
match=warning_message):
-            assert MongoHook(conn_id="fake_connection").mongo_conn_id == 
"fake_connection"
-
-        with pytest.warns(AirflowProviderDeprecationWarning, 
match=warning_message):
-            assert (
-                MongoHook(conn_id="fake_connection", 
mongo_conn_id="foo-bar").mongo_conn_id
-                == "fake_connection"
-            )
+        # Use default "mongo_default"
+        assert MongoHook().mongo_conn_id == "mongo_default"
+        # Positional argument
+        assert MongoHook("fake_connection").mongo_conn_id == "fake_connection"
 
     def test_get_conn(self):
         assert self.hook.connection.port == 27017

Reply via email to