I need to update a variable I have made in Airflow programmatically but I can not find the answer on how to do that with code.
I have retrieved my variable with this
Use Variable.set
instead of Variable.set_val
. set_val()
is a setter for the val
attribute and not intended for outside use. This should do what you want:
Variable.set("column_number", int(column_number) + 1)
It will make the actual update to the database, along with handling session and serialization for you if needed.
Reference: https://github.com/apache/incubator-airflow/blob/1.10.1/airflow/models.py#L4558-L4569