airflow.models.variable

Module Contents

class airflow.models.variable.Variable[source]

Bases: airflow.models.base.Base, airflow.utils.log.logging_mixin.LoggingMixin

__tablename__ = variable[source]
__NO_DEFAULT_SENTINEL[source]
id[source]
key[source]
_val[source]
is_encrypted[source]
val[source]
__repr__(self)[source]
get_val(self)[source]
set_val(self, value)[source]
classmethod setdefault(cls, key, default, deserialize_json=False)[source]

Like a Python builtin dict object, setdefault returns the current value for a key, and if it isn’t there, stores the default value and returns it.

Parameters
  • key (str) – Dict key for this Variable

  • default (Mixed) – Default value to set and return if the variable isn’t already in the DB

  • deserialize_json – Store this as a JSON encoded value in the DB and un-encode it when retrieving a value

Returns

Mixed

classmethod get(cls, key, default_var=__NO_DEFAULT_SENTINEL, deserialize_json=False, session=None)[source]
classmethod set(cls, key, value, serialize_json=False, session=None)[source]
classmethod delete(cls, key, session=None)[source]
rotate_fernet_key(self)[source]