This is an automated email from the ASF dual-hosted git repository.
potiuk 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 166de82b6b Removed deprecated param from local_filesystem (#41533)
166de82b6b is described below
commit 166de82b6b44c10db6be87f18265486b66883162
Author: GPK <[email protected]>
AuthorDate: Fri Aug 16 14:02:03 2024 +0100
Removed deprecated param from local_filesystem (#41533)
* removed deprecated parameters from local_filesystem
* add newsfragments file
---
airflow/secrets/local_filesystem.py | 24 ------------------------
newsfragments/41533.significant.rst | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/airflow/secrets/local_filesystem.py
b/airflow/secrets/local_filesystem.py
index f9ea4ad355..60e78f59e5 100644
--- a/airflow/secrets/local_filesystem.py
+++ b/airflow/secrets/local_filesystem.py
@@ -22,7 +22,6 @@ from __future__ import annotations
import json
import logging
import os
-import warnings
from collections import defaultdict
from inspect import signature
from json import JSONDecodeError
@@ -33,7 +32,6 @@ from airflow.exceptions import (
AirflowFileParseException,
ConnectionNotUnique,
FileSyntaxError,
- RemovedInAirflow3Warning,
)
from airflow.secrets.base_secrets import BaseSecretsBackend
from airflow.utils import yaml
@@ -243,16 +241,6 @@ def load_variables(file_path: str) -> dict[str, str]:
return variables
-def load_connections(file_path) -> dict[str, list[Any]]:
- """Use `airflow.secrets.local_filesystem.load_connections_dict`, this is
deprecated."""
- warnings.warn(
- "This function is deprecated. Please use
`airflow.secrets.local_filesystem.load_connections_dict`.",
- RemovedInAirflow3Warning,
- stacklevel=2,
- )
- return {k: [v] for k, v in load_connections_dict(file_path).values()}
-
-
def load_connections_dict(file_path: str) -> dict[str, Any]:
"""
Load connection from text file.
@@ -318,17 +306,5 @@ class LocalFilesystemBackend(BaseSecretsBackend,
LoggingMixin):
return self._local_connections[conn_id]
return None
- def get_connections(self, conn_id: str) -> list[Any]:
- warnings.warn(
- "This method is deprecated. Please use "
-
"`airflow.secrets.local_filesystem.LocalFilesystemBackend.get_connection`.",
- RemovedInAirflow3Warning,
- stacklevel=2,
- )
- conn = self.get_connection(conn_id=conn_id)
- if conn:
- return [conn]
- return []
-
def get_variable(self, key: str) -> str | None:
return self._local_variables.get(key)
diff --git a/newsfragments/41533.significant.rst
b/newsfragments/41533.significant.rst
new file mode 100644
index 0000000000..f16e2ed30a
--- /dev/null
+++ b/newsfragments/41533.significant.rst
@@ -0,0 +1,26 @@
+**Breaking Change**
+
+The ``load_connections`` parameter has been removed from the
``local_file_system``.
+This parameter was previously deprecated in favor of ``load_connections_dict``.
+
+If your code still uses ``load_connections``, you should update it to use
``load_connections_dict``
+instead to ensure compatibility with future Airflow versions.
+
+Example update:
+
+.. code-block:: python
+
+ connection_by_conn_id =
local_filesystem.load_connections_dict(file_path="a.json")
+
+The ``get_connections`` parameter has been removed from the
``LocalFilesystemBackend`` class.
+This parameter was previously deprecated in favor of ``get_connection``.
+
+If your code still uses ``get_connections``, you should update it to use
``get_connection``
+instead to ensure compatibility with future Airflow versions.
+
+
+Example update:
+
+.. code-block:: python
+
+ connection_by_conn_id =
LocalFilesystemBackend().get_connection(conn_id="conn_id")