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

vincbeck 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 7dea23fd23 Deprecated database configuration removed (#42126)
7dea23fd23 is described below

commit 7dea23fd23fa347143fded6979879cf5f58fa132
Author: Gopal Dirisala <[email protected]>
AuthorDate: Tue Sep 17 20:07:25 2024 +0530

    Deprecated database configuration removed (#42126)
---
 airflow/configuration.py                              | 15 +--------------
 docs/apache-airflow/faq.rst                           |  2 +-
 newsfragments/42126.significant.rst                   | 14 ++++++++++++++
 tests/api_connexion/endpoints/test_config_endpoint.py | 13 ++++++++-----
 tests/core/test_configuration.py                      |  4 +++-
 5 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/airflow/configuration.py b/airflow/configuration.py
index 9da7a99fc1..f50e192683 100644
--- a/airflow/configuration.py
+++ b/airflow/configuration.py
@@ -325,20 +325,7 @@ class AirflowConfigParser(ConfigParser):
     # A mapping of (new section, new option) -> (old section, old option, 
since_version).
     # When reading new option, the old option will be checked to see if it 
exists. If it does a
     # DeprecationWarning will be issued and the old option will be used instead
-    deprecated_options: dict[tuple[str, str], tuple[str, str, str]] = {
-        ("database", "sql_alchemy_conn"): ("core", "sql_alchemy_conn", 
"2.3.0"),
-        ("database", "sql_engine_encoding"): ("core", "sql_engine_encoding", 
"2.3.0"),
-        ("database", "sql_engine_collation_for_ids"): ("core", 
"sql_engine_collation_for_ids", "2.3.0"),
-        ("database", "sql_alchemy_pool_enabled"): ("core", 
"sql_alchemy_pool_enabled", "2.3.0"),
-        ("database", "sql_alchemy_pool_size"): ("core", 
"sql_alchemy_pool_size", "2.3.0"),
-        ("database", "sql_alchemy_max_overflow"): ("core", 
"sql_alchemy_max_overflow", "2.3.0"),
-        ("database", "sql_alchemy_pool_recycle"): ("core", 
"sql_alchemy_pool_recycle", "2.3.0"),
-        ("database", "sql_alchemy_pool_pre_ping"): ("core", 
"sql_alchemy_pool_pre_ping", "2.3.0"),
-        ("database", "sql_alchemy_schema"): ("core", "sql_alchemy_schema", 
"2.3.0"),
-        ("database", "sql_alchemy_connect_args"): ("core", 
"sql_alchemy_connect_args", "2.3.0"),
-        ("database", "load_default_connections"): ("core", 
"load_default_connections", "2.3.0"),
-        ("database", "max_db_retries"): ("core", "max_db_retries", "2.3.0"),
-    }
+    deprecated_options: dict[tuple[str, str], tuple[str, str, str]] = {}
 
     # A mapping of new section -> (old section, since_version).
     deprecated_sections: dict[str, tuple[str, str]] = {}
diff --git a/docs/apache-airflow/faq.rst b/docs/apache-airflow/faq.rst
index 791cfc39a0..0b2c76765e 100644
--- a/docs/apache-airflow/faq.rst
+++ b/docs/apache-airflow/faq.rst
@@ -494,7 +494,7 @@ What does "MySQL Server has gone away" mean?
 
 You may occasionally experience ``OperationalError`` with the message "MySQL 
Server has gone away". This is due to the
 connection pool keeping connections open too long and you are given an old 
connection that has expired. To ensure a
-valid connection, you can set :ref:`config:core__sql_alchemy_pool_recycle` to 
ensure connections are invalidated after
+valid connection, you can set :ref:`config:database__sql_alchemy_pool_recycle` 
to ensure connections are invalidated after
 that many seconds and new ones are created.
 
 
diff --git a/newsfragments/42126.significant.rst 
b/newsfragments/42126.significant.rst
new file mode 100644
index 0000000000..b7fe76179b
--- /dev/null
+++ b/newsfragments/42126.significant.rst
@@ -0,0 +1,14 @@
+Removed deprecated database configuration.
+
+  * Removed deprecated configuration ``sql_alchemy_conn`` from ``core``. 
Please use ``sql_alchemy_conn`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_engine_encoding`` from ``core``. 
Please use ``sql_engine_encoding`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_engine_collation_for_ids`` from 
``core``. Please use ``sql_engine_collation_for_ids`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_pool_enabled`` from 
``core``. Please use ``sql_alchemy_pool_enabled`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_pool_size`` from ``core``. 
Please use ``sql_alchemy_pool_size`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_max_overflow`` from 
``core``. Please use ``sql_alchemy_max_overflow`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_pool_recycle`` from 
``core``. Please use ``sql_alchemy_pool_recycle`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_pool_pre_ping`` from 
``core``. Please use ``sql_alchemy_pool_pre_ping`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_schema`` from ``core``. 
Please use ``sql_alchemy_schema`` from ``database`` instead.
+  * Removed deprecated configuration ``sql_alchemy_connect_args`` from 
``core``. Please use ``sql_alchemy_connect_args`` from ``database`` instead.
+  * Removed deprecated configuration ``load_default_connections`` from 
``core``. Please use ``load_default_connections`` from ``database`` instead.
+  * Removed deprecated configuration ``max_db_retries`` from ``core``. Please 
use ``max_db_retries`` from ``database`` instead.
diff --git a/tests/api_connexion/endpoints/test_config_endpoint.py 
b/tests/api_connexion/endpoints/test_config_endpoint.py
index ea4f6e9647..42d0922de8 100644
--- a/tests/api_connexion/endpoints/test_config_endpoint.py
+++ b/tests/api_connexion/endpoints/test_config_endpoint.py
@@ -39,11 +39,14 @@ MOCK_CONF = {
 }
 
 MOCK_CONF_WITH_SENSITIVE_VALUE = {
-    "core": {"parallelism": "1024", "sql_alchemy_conn": "mock_conn"},
+    "core": {"parallelism": "1024"},
     "smtp": {
         "smtp_host": "localhost",
         "smtp_mail_from": "[email protected]",
     },
+    "database": {
+        "sql_alchemy_conn": "mock_conn",
+    },
 }
 
 
@@ -263,10 +266,10 @@ class TestGetValue:
     @pytest.mark.parametrize(
         "section, option",
         [
-            ("core", "sql_alchemy_conn"),
-            ("core", "SQL_ALCHEMY_CONN"),
-            ("corE", "sql_alchemy_conn"),
-            ("CORE", "sql_alchemy_conn"),
+            ("database", "sql_alchemy_conn"),
+            ("database", "SQL_ALCHEMY_CONN"),
+            ("databasE", "sql_alchemy_conn"),
+            ("DATABASE", "sql_alchemy_conn"),
         ],
     )
     def test_should_respond_200_text_plain_with_non_sensitive_only(self, 
mock_as_dict, section, option):
diff --git a/tests/core/test_configuration.py b/tests/core/test_configuration.py
index 55c4aade4f..db057c43ca 100644
--- a/tests/core/test_configuration.py
+++ b/tests/core/test_configuration.py
@@ -53,7 +53,9 @@ from tests.utils.test_config import (
 
 HOME_DIR = os.path.expanduser("~")
 
-# The conf has been updated with deactivate_stale_dags_interval to test the 
functionality of deprecated options support.
+# The conf has been updated with sql_alchemy_con and 
deactivate_stale_dags_interval to test the
+# functionality of deprecated options support.
+conf.deprecated_options[("database", "sql_alchemy_conn")] = ("core", 
"sql_alchemy_conn", "2.3.0")
 conf.deprecated_options[("scheduler", "parsing_cleanup_interval")] = (
     "scheduler",
     "deactivate_stale_dags_interval",

Reply via email to