Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export all Airflow variables

Tags:

python

airflow

I have a problem with downloading all Airflow variables from the code.
There is an opportunity to export from UI, but i haven't found any way to do it programatically.

I discovered only Variable.get('variable_name') method which returns one Airflow variable. There is no variants of getting the list of Airflow variables.

Searching in the source code didn't help as well. Do you know some easy way?

Thank you in advance.

like image 927
Madness Avatar asked Nov 15 '25 13:11

Madness


1 Answers

You can use Airflow CLI to export variables to a file and then read it from your Python code.

airflow variables --export FILEPATH

Programmatically you can use the BashOperator to achieve this.

like image 99
kaxil Avatar answered Nov 17 '25 09:11

kaxil