I'm trying to define a variable file to upload through the airflow UI and I'm struggling to find the correct format to upload.
I've created a file called settings.cfg that looks like:
my_var=test
However when I try to upload this through the Airflow Admin->Variables dialog I get the following message:
Missing file or syntax error.
What am I missing?
Airflow Variables can also be created and managed using Environment Variables. The environment variable naming convention is AIRFLOW_VAR_{VARIABLE_NAME} , all uppercase. So if your variable key is FOO then the variable name should be AIRFLOW_VAR_FOO .
You can pass parameters from the CLI using --conf '{"key":"value"}' and then use it in the DAG file as "{{ dag_run. conf["key"] }}" in templated field. Save this answer.
It is important that you restrict the number of Airflow variables in your DAG because variables are stored inside the Metadata database so every single time when the variable is used, connection to the database is established.
It expects JSON.
{
"my_var": "test",
"your_var": "hello"
}
Reference: https://github.com/apache/incubator-airflow/blob/1.8.2/airflow/www/views.py#L1766-L1779
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With