MySqlHook

MySQL

Interact with MySQL.

View on GitHub

Last Updated: Apr. 13, 2023

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

schemaThe MySQL database schema to connect to.
connectionThe MySQL connection id used for MySQL credentials.
local_infileBoolean flag determining if local_infile should be used

Documentation

Interact with MySQL.

You can specify charset in the extra field of your connection as {"charset": "utf8"}. Also you can choose cursor as {"cursor": "SSCursor"}. Refer to the MySQLdb.cursors for more details.

Note: For AWS IAM authentication, use iam in the extra connection parameters and set it to true. Leave the password field empty. This will use the “aws_default” connection to get the temporary token unless you override in extras. extras example: {"iam":true, "aws_conn_id":"my_aws_conn"}

You can also add “local_infile” parameter to determine whether local_infile feature of MySQL client is going to be enabled (it is disabled by default).

Was this page helpful?