Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Airflow &引用;没有名为“气流”的模块;使用PythonVirtualenvOperator在导入的Utils模块中使用气流类时_Airflow - Fatal编程技术网

Airflow &引用;没有名为“气流”的模块;使用PythonVirtualenvOperator在导入的Utils模块中使用气流类时

Airflow &引用;没有名为“气流”的模块;使用PythonVirtualenvOperator在导入的Utils模块中使用气流类时,airflow,Airflow,我有我的utils文件(在PYTHONPATH中) #utils.py 从airflow.hooks.base导入BaseHook 作为pd进口熊猫 def get_cred(): con=BaseHook.get\u连接(“我的\u-con”) #一些数据操作 返回df 我的任务 #task.py def get_data(): from utils import get_cred df = get_cred() . . #the rest of the funct

我有我的utils文件(在PYTHONPATH中)

#utils.py
从airflow.hooks.base导入BaseHook
作为pd进口熊猫
def get_cred():
con=BaseHook.get\u连接(“我的\u-con”)
#一些数据操作
返回df
我的任务

#task.py

def get_data():
   from utils import get_cred
   df = get_cred()
   .
   . #the rest of the function
最后是我的狗

#dag.py
从afflow.operators.python导入pythonvirtualenvooperator
表单导入DAG
从任务导入获取数据
dag=dag(…)
t1=PythonVirtualenvOperator(
python_version=“3.7”,
要求=[“熊猫”、“pyodbc”、“SQLaclhemy”],
python\u callable=get\u data,
dag=dag)
t1
从utils import get_data运行DAG失败,错误为没有名为airflow的模块。 我试着添加``

我可以通过在我的需求中添加
apacheairflow
来克服这个问题,但是由于它是一个相当庞大的包,所以它会大大增加运行时间

  • 是否有办法只安装气流模块(或“气流灯”,即省略烧瓶、GUI等)
  • 是否有办法使utils从气流导入模块,而不必将其安装在venv中(因为它已经安装了?)