You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/07 01:08:41 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #13501: Warn about precedence of env var when getting variables

kaxil commented on a change in pull request #13501:
URL: https://github.com/apache/airflow/pull/13501#discussion_r553052730



##########
File path: airflow/models/variable.py
##########
@@ -143,6 +147,14 @@ def set(cls, key: str, value: Any, serialize_json: bool = False, session: Sessio
         :param serialize_json: Serialize the value to a JSON string
         :param session: SQL Alchemy Sessions
         """
+        env_var_name = "AIRFLOW_VAR_" + key.upper()
+        if env_var_name in os.environ:
+            log.warning(
+                "You have the environment variable %s defined, which takes precedence over reading "
+                "from the database. The value will be saved, but to read it you have to delete "
+                "the environment variable.",
+                env_var_name,
+            )

Review comment:
       Wait, this means we get a warning when we knowingly use Env Variables to get Variables -- that should not be the case. I am happy for it to be at debug level but not warn




----------------------------------------------------------------
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:
users@infra.apache.org