Docker部署Airflow适配dbt/astronomer-cosmos兼容版本咨询
兼容版本组合及问题解决
问题原因分析
--no-static-parser选项错误:该参数是dbt-core 1.8+新增的功能,若使用的Cosmos版本未适配对应dbt-core版本,会出现调用参数不匹配的报错。- protobuf依赖冲突:若你的Airflow版本为2.8+,它要求
protobuf>=6.0.0,但dbt-core 1.9.0限定protobuf>=5.0.0,<6.0.0,两者依赖范围冲突导致安装失败。
方案一:适配Airflow 2.8+(推荐)
使用dbt-core 2.x系列,与Airflow 2.8+的protobuf依赖兼容,同时搭配对应版本的Cosmos和dbt-snowflake:
# requirements.txt astronomer-cosmos==2.1.0 dbt-core==2.0.3 dbt-snowflake==2.0.3
- Cosmos 2.x完全适配dbt-core 2.x,不会出现参数不匹配问题
- dbt-core 2.x和dbt-snowflake 2.x要求
protobuf>=6.0.0,与Airflow 2.8+的依赖要求一致,彻底解决冲突
方案二:保留dbt-core 1.9.0,降低Airflow版本
若必须使用dbt-core 1.9.0,需将Airflow版本降至2.7.x(该版本要求protobuf>=3.20.3,<6.0.0),搭配对应Cosmos版本:
# requirements.txt astronomer-cosmos==1.5.0 dbt-core==1.9.0 dbt-snowflake==1.9.0
- Cosmos 1.5.0适配dbt-core 1.8.x-1.9.x,会正确调用dbt参数,避免
--no-static-parser报错 - Airflow 2.7.x的protobuf依赖范围与dbt-core 1.9.0完全兼容
验证步骤
- 清理旧依赖缓存:
pip cache purge - 在Docker容器中重新安装依赖:
pip install -r requirements.txt - 重启Airflow服务后,测试Cosmos调度dbt任务是否正常
内容的提问来源于stack exchange,提问作者Teja Goud Kandula
相关产品推荐
相关产品推荐

