OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Loader and Dumper

V4.3.3
  • Document Overview
  • Introduction
  • Technical mechanism
  • Preparations
    • Prepare the environment
    • Prepare data
    • Download OBLOADER & OBDUMPER
  • User Guide (OBLOADER)
    • Quick start
    • Command-line options
    • Direct load
    • Data processing
      • Define control files
      • Preprocessing functions
      • Case expressions
    • Use cases of command-line options
    • Performance tuning
    • Error handling
    • FAQ
  • User Guide (OBDUMPER)
    • Quick start
    • Command-line options
    • Data processing
      • Define control files
      • Preprocessing functions
      • Case expressions
    • Performance tuning
    • FAQ
  • Security features
  • Connection settings
  • Self-service troubleshooting
  • Release Note
    • Release Note
      • 4.x
        • OBLOADER & OBDUMPER V4.3.3
        • OBLOADER & OBDUMPER V4.3.2.1
        • OBLOADER & OBDUMPER V4.3.2
        • OBLOADER & OBDUMPER V4.3.1.1
        • OBLOADER & OBDUMPER V4.3.1
        • OBLOADER & OBDUMPER V4.3.0
        • OBLOADER & OBDUMPER V4.2.8.2
        • OBLOADER & OBDUMPER V4.2.8.1
        • OBLOADER & OBDUMPER V4.2.8
        • OBLOADER & OBDUMPER V4.2.6
        • OBLOADER & OBDUMPER V4.2.7
        • OBLOADER & OBDUMPER V4.2.5
        • OBLOADER & OBDUMPER V4.2.4
        • OBLOADER & OBDUMPER V4.2.1
        • OBLOADER \& OBDUMPER V4.1.0
        • OBLOADER \& OBDUMPER V4.0.0
      • 3.x
        • OBLOADER \& OBDUMPER V3.1.0
        • OBLOADER \& OBDUMPER V3.0.0
    • Version rules

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Loader and Dumper
  3. V4.3.3

Use cases of command-line options

Last Updated:2026-09-04 08:19:57

--auto-column-mapping
Scenarios
Import data without specifying --auto-column-mapping
Import data with --auto-column-mapping specified

This topic describes use cases of command-line options in a complex scenario.

--auto-column-mapping

By default, OBLOADER requires that the columns in the source file exactly match those of the target table. OBLOADER imports data to the target columns in order without identifying column names.

If the number of columns in the source file is different from that of the target table, you can specify the --auto-column-mapping option to define column name mappings, so that OBLOADER imports data based on the column names, and ignores columns that have no matching columns in the target table.

Scenarios

Assume that the CSV file containing the col1, col2, and col3 columns of the my_table table in the /home/admin/obloader directory needs to be imported into the target table containing the col2, col3, and col4 columns in the obloader database.

  • Data of the source table

    $cat my_table.csv
    'col1','col2','col3'
    'data1',1,'desc1'
    'data2',2,'desc2'
    'data3',3,'desc3'
    
  • Schema of the target table

    obclient [obloader]> DESC my_table;
    +-------+--------------+------+------+---------+-------+
    | Field | Type         | Null | Key  | Default | Extra |
    +-------+--------------+------+------+---------+-------+
    | col2  | int(11) | YES  |      | NULL    |       |
    | col3  | varchar(255)     | YES  |      | NULL    |       |
    | col4  | varchar(255) | YES  |      | NULL    |       |
    +-------+--------------+------+------+---------+-------+
    3 rows in set (0.035 sec)
    

Import data without specifying --auto-column-mapping

  1. Run the following command to import data:

    ./obloader -h xxx.xxx.xxx.xxx -P xxxx -u test@mysql -D obloader --csv --table 'my_table' -f /home/admin/obloader
    
  2. Wait for the execution result. An error is expected.

    Notice

    If the column names do not match but the column types do, OBLOADER may ignore the column names and import the data, leading to data inconsistency.

  3. Query the data in the target table.

    SELECT * FROM my_table;
    

    The query result is as follows, indicating that the import failed:

    obclient [obloader]> SELECT * FROM my_table;
    Empty set (0.035 sec)
    

Import data with --auto-column-mapping specified

  1. Run the following command to import data:

    ./obloader -h xxx.xxx.xxx.xxx -P xxxx -u test@mysql -D obloader --csv --table 'my_table' --auto-column-mapping -f /home/admin/obloader
    
  2. Wait for the execution result. The expected result is that data of the col2 and col3 columns of the source table is imported, and the col4 column is filled with default values.

  3. Query the data in the target table.

    SELECT * FROM my_table;
    

    The query result, as expected, is as follows:

    obclient [obloader]> SELECT * FROM my_table;
    +------+---------+------+
    | col2 | col3    | col4 |
    +------+---------+------+
    |    1 | desc1   | NULL |
    |    2 | desc2   | NULL |
    |    3 | desc3   | NULL |
    +------+---------+------+
    3 rows in set (0.033 sec)
    

Previous topic

Case expressions
Last

Next topic

Performance tuning
Next
on this page
--auto-column-mapping
Scenarios
Import data without specifying --auto-column-mapping
Import data with --auto-column-mapping specified