class_docstr: A generic way to store and retrieve arbitrary content or settings as a simple key/value store.
class_docstr_tok: ["A","generic","way","to","store","and","retrieve","arbitrary","content","or","settings","as","a","simple","key\/value","store","."]
docstr: Get Airflow Variable by iterating over all Secret Backends.
  
  :param key: Variable Key
  :return: Variable Value
docstr_tok: ["Get","Airflow","Variable","by","iterating","over","all","Secret","Backends",".",":","param","key",":","Variable","Key",":","return",":","Variable","Value"]
code: def get_variable_from_secrets(key: str) -> str | None:
      """
      Get Airflow Variable by iterating over all Secret Backends.
  
      :param key: Variable Key
      :return: Variable Value
      """
      # check cache first
      # enabled only if SecretCache.init() has been called first
      try:
          return SecretCache.get_variable(key)
      except SecretCache.NotPresentException:
          pass  # continue business
  
      var_val = None
      # iterate over backends if not in cache (or expired)
      for secrets_backend in ensure_secrets_loaded():
          try:
              var_val = secrets_backend.get_variable(key=key)
              if var_val is not None:
                  break
          except Exception:
              log.exception(
                  "Unable to retrieve variable from secrets backend (%s). "
                  "Checking subsequent secrets backend.",
                  type(secrets_backend).__name__,
              )
  
      SecretCache.save_variable(key, var_val)  # we save None as well
      return var_val
  
imports: from __future__ import annotations
  import json
  import logging
  from typing import TYPE_CHECKING, Any
  from sqlalchemy import Boolean, Column, Integer, String, Text, delete, select
  from sqlalchemy.dialects.mysql import MEDIUMTEXT
  from sqlalchemy.orm import declared_attr, reconstructor, synonym
  from airflow.api_internal.internal_api_call import internal_api_call
  from airflow.configuration import ensure_secrets_loaded
  from airflow.models.base import ID_LEN, Base
  from airflow.models.crypto import get_fernet
  from airflow.secrets.cache import SecretCache
  from airflow.secrets.metastore import MetastoreBackend
  from airflow.utils.log.logging_mixin import LoggingMixin
  from airflow.utils.log.secrets_masker import mask_secret
  from airflow.utils.session import provide_session
label_desc: Use image node_id 14 for calling the Variable obj's underlying member method code with example usage: obj.get_variable_from_secrets(key) and returns: var_val, SecretCache