Load Command

TcaplusDB Client - Load Command

For TcaplusDB Client Instructions, see Document.

1. Function Descriptions

Import the local data file into the TcaplusDB data table.

Currently, CSV and XML data file formats are supported.

  • CSV data file format Reference.

  • XML data file format Reference.

By default, the Generic table is imported by replacing data (insert if data does not exist, overwrite if data exists), and the List table is imported by inserting data(The index of newly inserted records under an existing large key will be incremented by 1 based on the largest existing index on the server; if it is a new large key, it will be the first element with an index of 0.). If importing data in the way of updating data is preferred, the parameter update needs to be displayed. `

2. Initial Version

Starting from 3.40.0, the load command is supported. 3.55.0 supports specifying the upper limit of QPS when loading (specified through the - q parameter when starting the tcaplas_client tool). If not specified, the default QPS for the load command is 3k-5k.

3. Command Syntax

## Import data file in CSV format
load table infile  file name [decode] [update] [\F] [\T];

## Import data file in XML format
load table infile  file name using tdr;

Parameter description:

ParameterWhen the target table is a PB tableWhen the target table is a TDR tableRequired
tableTable nameTable name
using tdrDo not supportIf using this parameter, you need to specify the TDR file corresponding to the target table through the startup parameter when starting the TcaplusDB client.
When using this parameter, if the imported data file is in XML format, the file structure should strictly meet the XML syntax requirements
No
decodeNot supported (special characters have been preprocessed)This parameter can only be used when importing a CSV format data file. It is used to decode the encoded data in the data file (BASE64 encoding for string type values containing carriage return characters or invisible characters) before importingNo
infiledata filedata fileYes
updateAfter using this parameter, the List table does not support this parameter, and the Generic table will be imported by updating data (if the data does not exist, the import will fail)After using this parameter, the List table will be imported by replacing data, and the Generic table will be imported by updating data (if the data does not exist, the import will fail)No
\FOutput the data that failed to import to a file, and the file name is fixed as: failedrecordOutput the data that failed to import to a file, and the file name is fixed as: failedrecord.
Note: It cannot be used with the using tdr parameter
No
\TDo not supportOutput record uses \t as field separatorNo, it uses , as the separator by default

Note: The string field must be enclosed by "". If , is the separator, please avoid the character ", in the data, otherwise the data will be truncated. At this time, you can choose \t as the separator.

4. Command Example

Data file download used in the example:

  • table_list-dump.txt

  • table_list_dump.xml

See Table Definition Example for table definition.

tcaplus> load table_list infile table_list_dump.xml using tdr;
loaded 49 records successful

tcaplus> load table_list infile table_list-dump.txt;
loaded 98 records successful

tcaplus> dump * into test1 from table_list_bin limit 0 encode;

total 4 records successful

used time: 47094 us

tcaplus> load table_list_bin infile test1 decode;
loaded 4 records successful

tcaplus> load test_table infile test_g update;

------------------------------------- Error ------------------------------------
txhdb_record_not_exist, ret = 261 m_recv_row_id = 2
--------------------------------------------------------------------------------

send 3 records, but only 2 records are success

load time: 5176 us

5. Common Errors

Refer to Common Errors.