Unable to use import and use MySqlOperator in Apache airflow

Viewed 358

I can't seem to be able to import Mysql. like trying to import using this from airflow.operators.mysql_operator import MySqlOperator I get this error "Cannot find reference 'MySqlOperator' in 'mysql_operator.py' "

1 Answers

Assuming you are on version 2.0.0 or greater, the import would be:

from airflow.providers.mysql.operators.mysql import MySqlOperator

Remember to install the MySQL providers package first:

pip install 'apache-airflow-providers-mysql'

Here is an example from the docs.

Related