Used by Variable/Connection.

https://github.com/apache/airflow/blob/894741e311ffd642e036b80d3b1b5d53c3747cad/airflow/secrets/metastore.py#L32

from airflow.models.connection import Connection
        conn = session.scalar(select(Connection).where(Connection.conn_id == conn_id).limit(1))
        session.expunge_all()
        return conn
    @provide_session
    def get_connections(self, conn_id: str, session: Session = NEW_SESSION) -> list[Connection]:
        warnings.warn(
            "This method is deprecated. Please use "
            "`airflow.secrets.metastore.MetastoreBackend.get_connection`.",
            RemovedInAirflow3Warning,
            stacklevel=3,
        )
        conn = self.get_connection(conn_id=conn_id, session=session)
        if conn:
            return [conn]
        return []
    @provide_session
    def get_variable(self, key: str, session: Session = NEW_SESSION) -> str | None:
        """
        Get Airflow Variable from Metadata DB.
        :param key: Variable Key
        :return: Variable Value
        """
        from airflow.models.variable import Variable
        var_value = session.scalar(select(Variable).where(Variable.key == key).limit(1))
        session.expunge_all()
        if var_value:
            return var_value.val
        return None