nailo2c opened a new pull request, #69990: URL: https://github.com/apache/airflow/pull/69990
## Summary `LLMSQLQueryOperator` eagerly imports `DataFusionEngine`. This works in the development environment because `apache-airflow-providers-common-sql[datafusion]` is installed as a dev dependency: https://github.com/apache/airflow/blob/fe9d8650efc45e11e158f67fb6d3518f877877de/providers/common/ai/pyproject.toml#L142 However, the Common AI `sql` extra does not install DataFusion, so importing the operator fails in production installations where DataFusion is absent. ## Bug Reproduction Use docker to install `airflow` and `common-ai` provider, then import `LLMSQLQueryOperator`. ```console $ docker run --rm -it python:3.12-slim bash $ python -m venv /tmp/airflow-repro $ . /tmp/airflow-repro/bin/activate $ python -m pip install --upgrade pip $ python -m pip install --no-cache-dir "apache-airflow==3.3.0" "apache-airflow-providers-common-ai[sql]==0.6.0" $ python -m pip show datafusion WARNING: Package(s) not found: datafusion $ python -c "from airflow.providers.common.ai.operators.llm_sql import LLMSQLQueryOperator" ModuleNotFoundError: No module named 'datafusion' ``` ## After fix Build the Common AI provider wheel from this PR, then install its `sql` extra with Airflow 3.3.0 in a fresh `python:3.12-slim` container. ```console $ python -m pip show datafusion WARNING: Package(s) not found: datafusion $ python -c "from airflow.providers.common.ai.operators.llm_sql import LLMSQLQueryOperator; print('operator import: OK')" operator import: OK $ python -c "from airflow.providers.common.ai.decorators.llm_sql import llm_sql_task; print('decorator import: OK')" decorator import: OK ``` <br> --- ##### Was generative AI tooling used to co-author this PR? <!-- If generative AI tooling has been used in the process of authoring this PR, please change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by". --> - [x] Yes (please specify the tool below) Generated-by: [Claude Fable 5] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
