martvaha opened a new issue, #52923: URL: https://github.com/apache/airflow/issues/52923
### Apache Airflow version 3.0.2 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? Using BaseHook.get_connection to obtain a Connection does not work in a virtualenv task. <img width="1594" height="218" alt="Image" src="https://github.com/user-attachments/assets/de279909-6ff5-4083-a578-19cf8ae9b7d0" /> The same approach works fine when running outside of a virtual environment, and it's also working inside virtualenv with Airflow v2 (for example, version 2.9.2). ### What you think should happen instead? Connections should be available inside virtualenv as well. The AIRFLOW_CONN_TEST is accessible with os.environ but for some reason the Connection is not found. ### How to reproduce Reproduction: https://github.com/martvaha/airflow-virtualenv-connection Steps: 1. Start with `docker compose up`. 2. `docker-compose.yml` defines `AIRFLOW_CONN_TEST`. 3. Run DAG `example_virtualenv`. 4. The task that is not inside the virtual environment finishes without issues. 5. The equivalent task inside the virtual environment returns the exception "The conn_id `test` isn't defined." ### Operating System macos ### Versions of Apache Airflow Providers _No response_ ### Deployment Docker-Compose ### Deployment details Testing with official 'https://airflow.apache.org/docs/apache-airflow/3.0.2/docker-compose.yaml', only AIRFLOW_CONN_TEST added. ### Anything else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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: commits-unsubscr...@airflow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org