Executes sql code in a specific MySQL database

View on GitHub

Last Updated: Jul. 19, 2021

Access Instructions

Install the MySQL provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.


sqlRequiredstr or list[str]the sql code to be executed. Can receive a str representing a sql statement, a list of str (sql statements), or reference to a template file. Template reference are recognized by str ending in ‘.sql’ (templated)
mysql_conn_idstrreference to a specific mysql database
parametersdict or iterable(optional) the parameters to render the SQL query with.
autocommitboolif True, each command is automatically committed. (default value: False)
databasestrname of database which overwrite defined one in connection


Executes sql code in a specific MySQL database

See also

For more information on how to use this operator, take a look at the guide: MySqlOperator

Was this page helpful?