Databases 4 min read

Custom Row Input with MySQL Shell util.import_table and decodeColumns in MySQL 8.0.22

The article explains how MySQL 8.0.22 enhances the util.import_table function with the decodeColumns option, allowing users to preprocess each row during import, replace load data statements, and customize column values directly within MySQL Shell.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Custom Row Input with MySQL Shell util.import_table and decodeColumns in MySQL 8.0.22

MySQL 8.0.22, released on October 19, introduces many practical features, especially for MySQL Shell 8.0.22 where the UTIL component becomes richer and easier to use.

The focus is on the extended capabilities of import_table(importTable) , which now supports customizable row input through the new decodeColumns option.

Previously, import_table was a parallel import tool that wrapped the load data local infile statement to load various text formats. For example, importing a TAB‑delimited file /tmp/sample_ytt.txt into table ytt_new.t1 could be done with a standard load data infile command.

Using import_table with Python syntax provides the same functionality, but the new feature allows preprocessing of each row—such as setting column r2 to mod(r1,10) and column r5 to abs(r4-46) —before the data is loaded, reducing post‑import processing overhead.

Before MySQL 8.0.22 this was not possible with util.import_table . The release adds the decodeColumns option, enabling field‑level transformations during import. The article demonstrates how to configure this option, showing the mapping of file columns to placeholders (e.g., @1 for the first column) and the definition of transformation expressions.

For deeper insight, the article suggests enabling the general log to view the generated load data infile statements that MySQL Shell internally executes.

Overall, the piece provides a concise walkthrough of the new custom import feature in MySQL Shell 8.0.22 and encourages readers to explore additional enhancements in the release.

MySQLdata-importMySQL Shellimport_tabledecodeColumns
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.