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 a3435f11bbf Remove the option import create_session from db.py util
(#47599)
a3435f11bbf is described below
commit a3435f11bbf2c2c487ec1be53e21ab574f119b61
Author: Elad Kalif <[email protected]>
AuthorDate: Thu Mar 13 06:15:38 2025 +0200
Remove the option import create_session from db.py util (#47599)
* Remove the option import create_session from db.py util
* clean F401
* Remove defensive test
---
airflow/utils/db.py | 4 +---
newsfragments/47599.significant.rst | 15 +++++++++++++++
tests/utils/test_db.py | 3 ---
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index 6c84e44d630..f3d1978149a 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -57,9 +57,7 @@ from airflow.exceptions import AirflowException
from airflow.models import import_all_models
from airflow.utils import helpers
from airflow.utils.db_manager import RunDBManager
-
-# TODO: remove create_session once we decide to break backward compatibility
-from airflow.utils.session import NEW_SESSION, create_session, provide_session
# noqa: F401
+from airflow.utils.session import NEW_SESSION, provide_session
from airflow.utils.task_instance_session import
get_current_task_instance_session
if TYPE_CHECKING:
diff --git a/newsfragments/47599.significant.rst
b/newsfragments/47599.significant.rst
new file mode 100644
index 00000000000..01db4f5d4f1
--- /dev/null
+++ b/newsfragments/47599.significant.rst
@@ -0,0 +1,15 @@
+Remove the option import create_session from db.py util
+
+The ability to create session from ``utils/db.py`` is removed.
+
+
+* Types of change
+
+ * [ ] Dag changes
+ * [ ] Config changes
+ * [ ] API changes
+ * [ ] CLI changes
+ * [x] Behaviour changes
+ * [ ] Plugin changes
+ * [ ] Dependency changes
+ * [ ] Code interface changes
diff --git a/tests/utils/test_db.py b/tests/utils/test_db.py
index cb1314fcee9..5389abc7832 100644
--- a/tests/utils/test_db.py
+++ b/tests/utils/test_db.py
@@ -43,9 +43,6 @@ from airflow.utils.db import (
compare_server_default,
compare_type,
create_default_connections,
- # The create_session is not used. It is imported here to
- # guard against removing it from utils.db accidentally
- create_session, # noqa: F401
downgrade,
resetdb,
upgradedb,