-
-
Save msampathkumar/67bedeeeb68fd9877e0d82df2a91b3b7 to your computer and use it in GitHub Desktop.
Revisions
-
kaxil revised this gist
Dec 25, 2018 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,11 @@ dag_config = Variable.get("dag1_config", deserialize_json=True) dag_config["var1"] dag_config["var2"] dag_config["var3"] # You can directly use it Templated arguments {{ var.json.my_var.path }} bash_task = BashOperator( task_id="bash_task", bash_command='{{ var.json.dag1_config.var1 }} ', dag=dag, ) -
kaxil created this gist
Dec 25, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ from airflow.models import Variable # Common (Not-so-nice way) # 3 DB connections when the file is parsed var1 = Variable.get("var1") var2 = Variable.get("var2") var3 = Variable.get("var3") # Recommended Way # Just 1 Database call dag_config = Variable.get("dag1_config", deserialize_json=True) dag_config["var1"] dag_config["var2"] dag_config["var3"]