fromm1990 commented on issue #51062:
URL: https://github.com/apache/airflow/issues/51062#issuecomment-3051687626

   Hi @Nataneljpwd, thanks for reaching out.
   The setup below reproduces the error consitently on my setup.
   
   Apache airflow version 3.0.2
   Added variable `my_test_variable` using the web ui (Admin->Variables->Add 
Variable)
   
   Here is my pyproject.toml file for the virtual environment:
   ```toml
   [project]
   name = "test_venv"
   version = "0.1.0"
   description = "Add your description here"
   readme = "README.md"
   requires-python = ">=3.12"
   dependencies = [
       "apache-airflow[postgres]==3.0.2"
   ]
   ```
   
   Here is my DAG:
   ```python
   from airflow.decorators import dag, task
   
   VENV_PATH = "/opt/airflow/projects/test_proj/.venv/bin/python"
   
   
   @task.external_python(python=VENV_PATH)
   def external_python_task():
       import logging
   
       from airflow.sdk import Variable
   
       logger = logging.getLogger(__name__)
       test_variable = Variable.get("my_test_variable")
       logger.info(test_variable)
   
   
   @dag(dag_id="metastore_test_dag")
   def metastore_test_dag():
       external_python_task()
   
   
   metastore_test_dag()
   ```
   
   Please let me know if you need more details about the setup?


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