Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/howto/set-config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
.. code-block:: bash

export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string

For setting boolean configuration values use ``true``/``false``:

.. code-block:: bask

export AIRFLOW__CORE__REMOTE_LOGGING=true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't matter. the values are read as string by the configparser

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=Trueipython
Python 3.7.4 (default, Aug 13 2019, 15:17:50)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from airflow.configuration import  conf

In [2]: conf.getboolean("core", "load_default_connections")
Out[2]: True

In [3]:
Do you really want to exit ([y]/n)? yexport AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=Falseipython
Python 3.7.4 (default, Aug 13 2019, 15:17:50)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from airflow.configuration import  conf

In [2]: conf.getboolean("core", "load_default_connections")
Out[2]: False

In [3]:

Copy link
Copy Markdown
Member

@kaxil kaxil Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check line L330

def getboolean(self, section, key, **kwargs):
val = str(self.get(section, key, **kwargs)).lower().strip()
if '#' in val:
val = val.split('#')[0].strip()
if val in ('t', 'true', '1'):
return True
elif val in ('f', 'false', '0'):
return False
else:
raise AirflowConfigException(
f'Failed to convert value to bool. Please check "{key}" key in "{section}" section. '
f'Current value: "{val}".'
)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @kaxil for getting into that. When I set the environmental variables I was not aware that airflow parses booleans that gracefully and supports many variants (1, TRUE, true, t, True, ...). One could avoid concerns by giving an example in the documentation, like I did above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even tRuE should work :) as we convert them to .lower() so it doesn't matter for a user until there is a Typo :)

If you think some docs around that can help ease the confusion, I am happy for you to update the docs in this PR and merge it :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I was thinking too much like a software developer here. And as the parsing is so clever, people won't have issues.

I will close the PR, thanks for your feedback.


You can also derive the connection string at run time by appending ``_cmd`` to
the key like this:
Expand Down