gpt4 book ai didi

sqlalchemy - 从 Airflow 连接 postgres 数据库时出错

转载 作者:行者123 更新时间:2023-12-02 00:29:32 27 4
gpt4 key购买 nike

使用:

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

sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:db.postgresql

以及使用时:

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

ModuleNotFoundError: No module named 'MySQLdb' enter image description here

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

psycopg2==2.7.3.1
sqlalchemy==1.1.15
sqlalchemy-redshift== 0.7.0
apache_airflow=1.8.2

早期sql_alchemy_conn = db+postgresql://username:xxx@127.0.0.1:5432/airflow确实为我工作 - 2个月前。不知道现在是什么问题。

最佳答案

最后,以下设置起作用了 - airflow.cfg :

sql_alchemy_conn = postgresql+psycopg2://scot:tiger@localhost:5432/airflow
celery_result_backend = db+postgres://scot:tiger@localhost:5432/airflow

需要注意的是,airflow.cfg 文件中的 sql_alchemy_conncelery_result_backend 设置的 dialect+driver 是不同的,尽管它们指向同一个数据库。

关于sqlalchemy - 从 Airflow 连接 postgres 数据库时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47247123/

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