airflow.secrets.metastore

Objects relating to sourcing connections from metastore database.

Classes

MetastoreBackend

Retrieves Connection object and Variable from airflow metastore database.

Module Contents

class airflow.secrets.metastore.MetastoreBackend[source]

Bases: airflow.secrets.BaseSecretsBackend

Retrieves Connection object and Variable from airflow metastore database.

get_connection(conn_id, session=NEW_SESSION)[source]

Get Airflow Connection from Metadata DB.

Parameters:
Returns:

Connection Object

Return type:

airflow.models.Connection | None

get_variable(key, team_name=None, session=NEW_SESSION)[source]

Get Airflow Variable from Metadata DB.

Parameters:
  • key (str) – Variable Key

  • team_name (str | None) – Team name associated to the task trying to access the variable (if any)

  • session (sqlalchemy.orm.Session) – SQLAlchemy Session

Returns:

Variable Value

Return type:

str | None

Was this entry helpful?