ecerulm commented on a change in pull request #16686:
URL: https://github.com/apache/airflow/pull/16686#discussion_r660220776
##########
File path: docs/apache-airflow/macros-ref.rst
##########
@@ -97,6 +99,13 @@ It is also possible to fetch a variable by string if needed
with
``{{ var.json.get('my.dict.var', {'key1': 'val1'}) }}``. Defaults can be
supplied in case the variable does not exist.
+Similarly, Airflow Connections data can be accessed via the ``conn`` template
variable.
+For example, you could use expressions in your templates like ``{{
conn.my_conn_id.login }}``,
+``{{ conn.my_conn_id.password }}``, etc.
+Just like with ``var`` it's possible to fetch a connection by string or
provide defaults with
+``{{ conn.get('my_conn_id').host }}`` or
Review comment:
This one just show that it's possible to fetch a conn_id via an string
it's not about the defaults. I mean the `.get()` has two advantages one is that
you can lookup a conn_id calculates at runtime like
`conn.get('my_conn_'+index)`. The other advantage is that you can provide
defaults.
It the same examples for `var.value.get` if I recall properly I just copied
them and and changed the wording.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]