Data Destination - MySQL
  • 06 Dec 2022
  • Dark
    Light
  • PDF

Data Destination - MySQL

  • Dark
    Light
  • PDF

Article Summary

Overview

Help page for setting up a data transfer to MySQL

Supported Protocol

Data Loader: Embulk

Settings

Step 1: General Settings

Field Name
Required
Default Value
Description
MySQL Connection ConfigurationYes-From the MySQL Connection Configuration created in advance, select the one with the required permissions for this transfer.
If you have not previously created any Connection Configurations, click the Add Connection Configuration button to set up a new one.
DatabaseYes-Enter the MySQL database name that you wish to transfer to.
By pressing the Load Database List button, you can load a list of MySQL database names used to auto-complete the field.
TableYes-Enter the table name for the destination.
If a table with the name you entered does not exist at the destination, a new one will be created.
Transfer ModeYesinsertPlease refer to the Transfer Modes section below for information regarding each mode.
Query Before TransferNo-Write an SQL query to execute before the data is transferred to MySQL.
Note: If you choose the transfer mode replace, the query cannot be executed.
Query After TransferNo-Write an SQL query to execute after the data has been transferred to MySQL.

Transfer Modes

Mode
Action
Details
INSERTAPPENDThis transfer mode will append the table at the destination.
The transfer data is first loaded into a temporary table generated by trocco, then added to the table at the destination using the insert mode.
INSERT_DIRECTAPPENDThis transfer mode will append the table at the destination.
Directly load data without creating a temporary table.
If the transfer happens to fail during execution, there is a chance that incomplete data will be left in the destination.
TRUNCATE_INSERTOVERWRITEThis mode will overwrite the data in the table at the destination.
The transfer data is first loaded into a temporary table generated by trocco, then added to the table at the destination using the insert mode.
Note: before insert, truncate will execute, overwriting the existing table.
REPLACERECREATEThis mode will recreate the table at the destination.
At first, the transfer data is loaded into a temporary table generated by trocco.
If successful, the target table is dropped and the name of the temporary table is changed to the name of the destination table.
The destination table index will be lost.
MERGEUPSERTThis transfer mode will update and/or insert into the table.
At first the transfer data is loaded into a temporary table generated by trocco.
If successful, the query shown below will be run.
INSERT INTO <target_table> SELECT * FROM <intermediate_table_1> UNION ALL SELECT * FROM <intermediate_table_2> UNION ALL ... ON DUPLICATE KEY UPDATE ...
If a primary key of a record in the intermediate table already exists at the destination table, the destination table record will be updated.
If a primary key of a record does not exist, the record will be inserted into the destination table.
MERGE_DIRECTUPSERTThis transfer mode will update and/or insert into the table.
In this mode, without creating a temporary table, the data will be inserted directly into the destination table.
If a primary key of a record in the intermediate table already exists in the destination table, the destination table record will be updated.
If a primary key of a record does not exist, the record will be inserted into the destination table.

Was this article helpful?