On this Page
MySQL account settings have been shared across different MySQL Snaps and the batch size settings varies the performance for some of the Snaps. We recommend changing the batch size setting (within the account details) to 100k or 200k for only the MySQL Bulk Load Snap (these batch size settings for bulk load may vary based on the environment settings but this range should be ideal).
If you are using other MySQL Snaps along with MySQL Bulk Load Snap in the same pipeline, then use different accounts for each of these Snaps and increase the batch size setting for MySQL Bulk Load Snap (within the account details) as mentioned above.
The bulk load feature is disabled by default for MySQL 8.0 and higher versions. To use the MySQL Bulk Load Snap with MySQL v8 and higher, enable the server and the Snap as a client of the Bulk Load feature in the JDBC driver.
To enable the bulk load feature in the JDBC driver, perform the following actions:
In MySQL v8 or higher, add the following lines to my.cnf file and restart the server.
If the my.cnf file does not exist, create one in the main directory of the server.[mysqld]
local_infile=ON
- In MySQL Bulk Load Snap (r4.19 or later), add the following entry to the Url properties field in the associated MySQL account.
allowLoadLocalInfile = true
Snap type: | Write | |||||||
---|---|---|---|---|---|---|---|---|
Description: | Snap executes MySQL bulk load. This Snap uses the LOAD DATA INFILE statement internally to perform the bulk load action. The file is first copied to JCC node, then to MySQL server under tmp directory and finally to the target MySQL table. Ensure sufficient space in the JCC and MySQL tmp location.
| |||||||
Prerequisites: | [None] | |||||||
Support and limitations: | Does not work in Ultra Pipelines. When MySQL execute Snaps (MySQL - Execute and MySQL - Multi Execute) are followed by MySQL non-execute Snaps, such as MySQL - Insert, MySQL - Merge, and so on, the following error is displayed when executed:
This happens due to a known issue in the MySql Connector. For more information about this issue, see MySQL Bug #65378. | |||||||
Account: | This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See MySQL Account for information on setting up this type of account. MySQL account settings have been shared across different MySQL Snaps and the batch size settings varies the performance for some of the Snaps. We recommend changing the batch size setting (within the account details) to 100k or 200k for only the MySQL Bulk Load Snap (these batch size settings for bulk load may vary based on the environment settings but this range should be ideal). | |||||||
Views: |
| |||||||
Settings | ||||||||
Label | Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. | |||||||
Schema name | The database schema name. In case it is not defined, then the suggestion for the Table name will retrieve all tables names of all schemas. The property is suggestible and will retrieve available database schemas during suggest values. The values can be passed using the pipeline parameters but not the upstream parameter.
| |||||||
Table name | Required. Table on which to execute the bulk load operation. The values can be passed using the pipeline parameters but not the upstream parameter.
| |||||||
Create table if not present | Whether the table should be automatically created if it is not already present. Default value: Not selected | |||||||
Partitions | This is used to specify a list of one or more partitions and/or subpartitions. When used, if any input document cannot be inserted into any of the partitions or subpartitions named in the list, the input document will be ignored. Default value: Not selected | |||||||
Columns | When no column list is provided, input documents are expected to contain a field for each table column. When a column list is provided, the Snap will load only the specified columns. | |||||||
Set Clause | Required. This is used to assign values to columns. For example, you can use "COLUMN1 = 1" to insert integer 1 to column COLUMN1 for each input document. See this link for more information. Default value: [None] | |||||||
On duplicates | Required. Specifies the action to be performed when duplicate records are found. In other words, rows that have the same value for a primary key or unique index as an existing row. If you choose REPLACE, input rows replace the existing rows. If you choose IGNORE, input rows are ignored. Default value: IGNORE | |||||||
Concurrency Option | Specifies how to handle the load process when other clients are reading from the table. Available concurrency options are:
Default value: None | |||||||
Character Set | The MySQL server uses the character set indicated by the character_set_database system variable to interpret the information in the inputs. If the contents of the inputs use a character set that differs from the default, it is recommended that you specify the character set of the inputs with this property. A character set of binary specifies "no conversion". It is not possible to load data that uses the ucs2, utf16, utf16le, or utf32 character set. Default: [None] | |||||||
Chunk size | Specifies the number of records to be loaded at a time. Default: 100000 | |||||||
Snap execution | Select one of the three modes in which the Snap executes. Available options are:
|
When invalid data is passed to the Snap, the Snap execution fails. The database administrator can set a global variable that can either handle an invalid case by passing a default value (such as, if strings are passed for integers, then pass the value 0) , or by displaying an error. See Load Data Syntax for more information.
In a scenario where the Auto commit on the account is set to true, and the downstream Snap does depends on the data processed on an Upstream Database Bulk Load Snap, use the Script Snap to add delay for the data to be available.
For example, when performing a create, insert and a delete function sequentially on a pipeline, using a Script Snap helps in creating a delay between the insert and delete function or otherwise it may turn out that the delete function is triggered even before inserting the records on the table.
Example
The following example illustrates the usage of the MySQL Bulk Load Snap. In this pipeline, we map the data using the Mapper Snap, insert it into the target table using the MySQL Bulkload Snap, read the data using the MySQL Select Snap and additionally sending the first document to the output view using the Head Snap.
The pipeline:
1. The mapper Snap maps the data and writes the result to the target path, enron numeric_table.
2. The MySQL Bulk Load Snap loads inputs to the table, enron numeric_table.
3. The MySQL Select Snap gets records from the table, enron numeric_table where the clause is col1= 100.
4. The Head Snap is set to1, meaning it would send the first document to the output view, and hence the MySQL Select Snap passes the first document only.
Successful execution of the pipeline gives the following output preview.