无法加载插件:sqlalchemy.dialects:mysql

x6yk4ghg  于 2023-04-04  发布在  Mysql
关注(0)|答案(1)|浏览(321)

我尝试在计算机上安装airflow,但是当我运行命令行时,会使用airlow(例如:airflow db init,airflow scheduler),我得到结果:

Traceback (most recent call last):
  File "/home/linhnq/.local/bin/airflow", line 5, in <module>
    from airflow.__main__ import main
  File "/home/linhnq/.local/lib/python3.10/site-packages/airflow/__init__.py", line 46, in <module>
    settings.initialize()
  File "/home/linhnq/.local/lib/python3.10/site-packages/airflow/settings.py", line 567, in initialize
    configure_orm()
  File "/home/linhnq/.local/lib/python3.10/site-packages/airflow/settings.py", line 273, in configure_orm
    engine = create_engine(SQL_ALCHEMY_CONN, connect_args=connect_args, **engine_args)
  File "<string>", line 2, in create_engine
  File "/home/linhnq/.local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
    return fn(*args, **kwargs)
  File "/home/linhnq/.local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 522, in create_engine
    entrypoint = u._get_entrypoint()
  File "/home/linhnq/.local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 655, in _get_entrypoint
    cls = registry.load(name)
  File "/home/linhnq/.local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 343, in load
    raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:mysql

我使用Ubuntu 22.04.1 LTS,这里是我安装的mysql版本:

+--------------------------+-------------------------+
| Variable_name            | Value                   |
+--------------------------+-------------------------+
| admin_tls_version        | TLSv1.2,TLSv1.3         |
| immediate_server_version | 999999                  |
| innodb_version           | 8.0.30                  |
| original_server_version  | 999999                  |
| protocol_version         | 10                      |
| replica_type_conversions |                         |
| slave_type_conversions   |                         |
| tls_version              | TLSv1.2,TLSv1.3         |
| version                  | 8.0.30-0ubuntu0.22.04.1 |
| version_comment          | (Ubuntu)                |
| version_compile_machine  | x86_64                  |
| version_compile_os       | Linux                   |
| version_compile_zlib     | 1.2.12                  |
+--------------------------+-------------------------+
 and airflow.cnf i get setup like this: (i created user airflow:password)

 - executor = LocalExecutor
 - sql_alchemy_conn = mysql://airflow:password@localhost/airflowdb 
 - broker_url = pyamqp://airflow:password@localhost:5672/myvhost 
 - result_backend = db+mysql://airflow:password@localhost:3306/airflowdb
 - flower_basic_auth = user1:password1

how can i fix it?
thanks
44u64gxh

44u64gxh1#

使用SQL时需要注意的事项:

AIRFLOW__CELERY__RESULT_BACKEND = db+mysql://user:password@IP:3306/databaseName

AIRFLOW__CORE__SQL_ALCHEMY_CONN = mysql+mysqldb://user:password@IP:3306/databaseName

相关问题