kaxil commented on a change in pull request #6863: [AIRFLOW-XXX] add docs showing usage of `Connection.get_uri` URL: https://github.com/apache/airflow/pull/6863#discussion_r360819202
########## File path: docs/howto/connection/index.rst ########## @@ -61,29 +59,167 @@ to the connection you wish to edit in the connection list. Modify the connection properties and click the ``Save`` button to save your changes. -Creating a Connection with Environment Variables +Storing a Connection in Environment Variables ------------------------------------------------ -Connections in Airflow pipelines can be created using environment variables. -The environment variable needs to have a prefix of ``AIRFLOW_CONN_`` for -Airflow with the value in a URI format to use the connection properly. +The environment variable naming convention is ``AIRFLOW_CONN_<conn_id>``, all uppercase. + +So if your connection id is ``my_prod_db`` then the variable name should be ``AIRFLOW_CONN_MY_PROD_DB``. + +.. note:: + + There is only one underscore surrounding ``CONN``. This is in contrast with the way ``airflow.cfg`` + parameters are stored, where two underscores surround the config section name. + +The value of this environment variable must use airflow's URI format for connections. See the section +:ref:`Generating a Connection URI <generating_connection_uri>` for more details. + +Using .bashrc (or similar) +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If storing the environment variable in something like ``~/.bashrc``, you would add it ike so: Review comment: ```suggestion If storing the environment variable in something like ``~/.bashrc``, add it as follow: ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
