sk-shakeel commented on issue #46418:
URL: https://github.com/apache/airflow/issues/46418#issuecomment-2709993907

   Unlike in bash operator, python operator is not updating system env with 
airflow context environmental variables, check the existing code of bash 
operator which is as given below:
   
   
   ```
   def get_env(self, context) -> dict:
           """Build the set of environment variables to be exposed for the bash 
command."""
           system_env = os.environ.copy()
           env = self.env
           if env is None:
               env = system_env
           else:
               if self.append_env:
                   system_env.update(env)
                   env = system_env
   
           airflow_context_vars = context_to_airflow_vars(context, 
in_env_var_format=True)
           self.log.debug(
               "Exporting env vars: %s",
               " ".join(f"{k}={v!r}" for k, v in airflow_context_vars.items()),
           )
           env.update(airflow_context_vars)
           return env
   ```
   
   
   This is not implemented in python operator.
   
   So, according to existing implementation of conext variables correct way to 
use them is
   **Python-Operator**: kwargs
   **Bash-Operator**: env's
   
   Please confirm me if the existing implementation is intentional or a miss? 
If it is intentional this issue can be closed by proper documentation on usage 
of context variables for python operator.


-- 
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]

Reply via email to