MySqlOperator

MySQL

Executes sql code in a specific MySQL database

View on GitHub

Last Updated: Oct. 24, 2022

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.

Parameters

sqlthe 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_idReference to mysql connection id.
parameters(optional) the parameters to render the SQL query with. Template reference are recognized by str ending in ‘.json’ (templated)
autocommitif True, each command is automatically committed. (default value: False)
databasename of database which overwrite defined one in connection

Documentation

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?