从气流连接postgres db时出错

jav*_*ved 6 sqlalchemy celery airflow apache-airflow airflow-scheduler

使用:

sql_alchemy_conn = db+postgresql://username:xxx@127.0.0.1:5432/airflow 给出错误:

sqlalchemy.exc.NoSuchModuleError:无法加载插件:sqlalchemy.dialects:db.postgresql

使用时:

sql_alchemy_conn = postgresql+psycopg2://username:xxx@localhost:5432/airflow 我可以运行airlfow webserver -p 8080但在运行调度程序时:airflow scheduler它会抛出错误:

ModuleNotFoundError:没有名为'MySQLdb'的模块 在此输入图像描述

我正在使用的软件包版本:

psycopg2==2.7.3.1
sqlalchemy==1.1.15
sqlalchemy-redshift== 0.7.0
apache_airflow=1.8.2
Run Code Online (Sandbox Code Playgroud)

早些时候sql_alchemy_conn = db+postgresql://username:xxx@127.0.0.1:5432/airflow确实对我有用 - 2个月前.我不知道现在的问题是什么.

jav*_*ved 10

最后,以下设置有效:

sql_alchemy_conn = postgresql+psycopg2://scot:tiger@localhost:5432/airflow
celery_result_backend = db+postgres://scot:tiger@localhost:5432/airflow
Run Code Online (Sandbox Code Playgroud)

重要的是要注意方言+驱动程序在airflow.cfg文件中的设置sql_alchemy_conncelery_result_backend设置是不同的,尽管它们指向同一个数据库.