MWAA getting ModuleNotFoundError: No module named 'airflow.providers.mysql'

0

My requirements.txt file has the following

--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.1/constraints-3.10.txt"

apache-airflow==2.5.1
apache-airflow[amazon]==7.1.0
apache-airflow[common.sql]==1.3.3
apache-airflow[mysql]==4.0.0

However, when I execute my DAG, I get an exception in the code that tries to import airflow.providers.mysql.hooks.mysql:

ModuleNotFoundError: No module named 'airflow.providers.mysql'

How do I get MWAA to correctly install that package?

asked a year ago916 views
1 Answer
0

You are seeing ModuleNotFoundError: No module named 'airflow.providers.mysql' which means the provided requirements are not installed . Since you used Constraint file the incompatible providers are not installed , you can find the the same in MWAA --> Scheduler log groups --> requirements_install_<worker_ip>.

I suggest you to use below and try

--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.1/constraints-3.10.txt" apache-airflow-providers-amazon==7.1.0 apache-airflow-providers-mysql==4.0.0 apache-airflow-providers-common-sql==1.3.3

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions