diff --git a/airflow/secrets/local_filesystem.py b/airflow/secrets/local_filesystem.py index f9ea4ad3554cb..60e78f59e5f89 100644 --- a/airflow/secrets/local_filesystem.py +++ b/airflow/secrets/local_filesystem.py @@ -22,7 +22,6 @@ import json import logging import os -import warnings from collections import defaultdict from inspect import signature from json import JSONDecodeError @@ -33,7 +32,6 @@ 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 @@ def get_connection(self, conn_id: str) -> Connection | None: 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 0000000000000..f16e2ed30a2af --- /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")