'Have broken DAG when try to import MySqlOperator

Trying to compile DAG from Link to AirFlow official documentation

Got Airflow dashboard error:

Broken DAG: [/ua/sv/airflow/dags/example_mysql.py] Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/ua/sv/airflow/dags/example_mysql.py", line 25, in <module>
    from airflow.providers.mysql.operators.mysql import MySqlOperator
ModuleNotFoundError: No module named 'airflow.providers.mysql'

What I've already tried:

  1. pip3 install apache-airflow-providers-mysql
  2. sudo apt install default-libmysqlclient-dev

My local environment:

  • Ubuntu 20.04 on Windows via wsl
  • Apache Airflow v2.0.1.0.5.716


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source