gpt4 book ai didi

python-2.7 - 当 Airflow 为initdb时,ImportError:无法导入名称HiveOperator

转载 作者:行者123 更新时间:2023-12-03 08:04:30 26 4
gpt4 key购买 nike

我最近为我的工作流程安装了airflow。创建项目时,我执行了以下命令:

airflow initdb


返回以下错误:

[2016-08-15 11:17:00,314] {__init__.py:36} INFO - Using executor SequentialExecutor
DB: sqlite:////Users/mikhilraj/airflow/airflow.db
[2016-08-15 11:17:01,319] {db.py:222} INFO - Creating tables
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
ERROR [airflow.models.DagBag] Failed to import: /usr/local/lib/python2.7/site-packages/airflow/example_dags/example_twitter_dag.py
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 247, in process_file
m = imp.load_source(mod_name, file path)
File "/usr/local/lib/python2.7/site-packages/airflow/example_dags/example_twitter_dag.py", line 26, in <module>
from airflow.operators import BashOperator, HiveOperator, PythonOperator
ImportError: cannot import name HiveOperator
Done.


我在网上检查了一些类似的问题,建议我安装 airflow[hive]pyhs2,但似乎无法正常工作。

最佳答案

您在使用HiveOperator吗?您似乎收到的错误是由于示例dags中的1个引起的。在生产环境中,只有在使用HiveOperator时,才应将load_examples设置为False并安装airflow[hive]

话虽这么说,不知道为什么airflow[hive]还不够。您可以尝试安装airflow[hive,hdfs,jdbc],但是airflow [hive]应该足以消除HiveOperator导入错误。您能否加上遇到的其他错误?

关于python-2.7 - 当 Airflow 为initdb时,ImportError:无法导入名称HiveOperator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38951086/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com