Dump Command

TcaplusDB Client - Dump Command

For TcaplusDB Client Instructions, see Document.

1. Function Descriptions

Principle: The dump command actually reads the data to the local through the full table traversal interface and then outputs it in a specified form and format.

Export the data of a full table, and provides two ways of printing to the console/outputting to the file.

Please note that the file name for saving query results cannot start with a number.

2. Performance Description

Data export is executed by a single thread, and the export efficiency is negatively related to the amount of data. When the single record data is large, the export will take a long time.

If only partial fields need to be exported, it is recommended to use “Export partial fields”. At this time, only partial fields of the data will be read, not the full data, which can improve the export speed to a certain extent.

3. Initial Version

3.40.0

4. Command Syntax

dump key1, key2, value1, value2 [into result.csv] from table [where ...] limit 10 offset 100 shardid 10 [\M];

## Export partial fields
dump key1, key2, value1, value2 [into result.csv] from table [where ...] limit 10;
pb table specifies field dump export (supported in version 3.55):
enable delta result;
dump key1, key2, key3, value1, value2 [into result.xml] from table;

## Export in xml format
dump * [into document name] from table [where ...] limit 10 using tdr;

## Export in csv format
dump * [into document name] from table [where ...] limit 10 [encode] [\T];

Parameter description:

ParameterVersion descriptionWhen the source table is a PB tableWhen the source table is a TDR tableRequired
tableTable nameTable nameYes
keyPrimary key field name. All key field values must be filled inPrimary key field name. All key field values must be filled inNo
valueNon-primary key field nameNon-primary key field nameNo
whereVersions after 3.55.0 support this commandFilter ConditionsFilter ConditionsNo
limitThe number of Keys exported this time.
Generic table: A Key corresponds to one record.
**List table: ** A key corresponds to a list, containing multiple records
The number of Keys exported this time.
Generic table: A Key corresponds to one record.
**List table: ** A key corresponds to a list, containing multiple records
No
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
encodeNot supported (carriage return or invisible characters have been preprocessed)This parameter can only be used when importing data files in CSV format.
After specifying this parameter, the export command will encode the string type field value containing carriage return characters or invisible characters into BASE64 before outputting.
Note: When using the encode parameter to export data files, the decode parameter needs to be specified at the time of importing
No
intoTarget data file(In version 3.55, the feature to export specific fields is supported, and you need to execute the enable delta result setting in advance.)Target data fileNo
shardidid of the specified shard data to be exported, which must be used with the offset parameterid of the specified shard data to be exported, which must be used with the offset parameterNo
offsetstarting position of the specified data to be exported, which must be used with the sharid parameterstarting position of the specified data to be exported, which must be used with the sharid parameterNo
\MVersions after 3.46.0 support this commandTraversing data from the master copy (used in scenarios with high real-time requirements for data, which will have a certain performance impact on other data reading and writing)Traversing data from the master copy (used in scenarios with high real-time requirements for data, which will have a certain performance impact on other data reading and writingNo
\TDo not supportOutput data uses \t as the field separator(Starting from version 3.46)No, it uses , as the separator by default

5. Command Example

See Table Definition Example for table definition.

tcaplus> dump * from table_list limit 0 offset 100 shardid 10;
uin,name,key1,level,count,array_count,items,c_int8,c_uint8,c_int16,c_uint16,c_int32,c_uint32,c_int64,c_uint64,c_float,c_double,c_string,c_string_128K,c_string_256K,c_binary,binary,selector,single_struct,simple_struct,single_union_selector,single_union,array,c_union,union_array,c_struct,struct_array
99,"99",99,1,0,1,0x,-1,2,-3,4,-5,6,-7,0,1.234568,9.876543,"","123456789","123456789",0x,0,0,0x,0x,0,0x,0x,0x,0x,0x,0x
99,"99",99,1,0,1,0x,-1,2,-3,4,-5,6,-7,0,1.234568,9.876543,"","123456789","123456789",0x,0,0,0x,0x,0,0x,0x,0x,0x,0x,0x
99,"99",99,1,0,1,0x,-1,2,-3,4,-5,6,-7,0,1.234568,9.876543,"","123456789","123456789",0x,0,0,0x,0x,0,0x,0x,0x,0x,0x,0x
99,"99",99,1,0,1,0x,-1,2,-3,4,-5,6,-7,0,1.234568,9.876543,"","123456789","123456789",0x,0,0,0x,0x,0,0x,0x,0x,0x,0x,0x

dump 4 records successful

dump time: 121671 us

tcaplus> dump * into table_list.txt from table_list;

dumped 4 records successful

tcaplus> dump * into table_list.xml from table_list using tdr;

dumped 4 records successful

tcaplus> dump *  from table_list_bin encode;
uin,name,level,count,items,name_1,name_2,binary_count,binary,single_struct
1,"MQ==",1,0,0x,"Bw==","",5,0x03001234450000,0x030000000002000000033ff00a915379fa980400000006343334333200
1,"MQ==",1,0,0x,"Bw==","",5,0x03001234450000,0x030000000002000000033ff00a915379fa980400000006343334333200
1,"Mw==",1,0,0x,"","",5,0x1232123443,0x
1,"Mw==",1,0,0x,"","",5,0x1232123443,0x
1,"Mw==",1,0,0x,"","",5,0x1232123443,0x
1,"Mw==",1,0,0x,"","",5,0x1232123443,0x
1,"Ng==",1,0,0x,"Bw==","",5,0x03005645890000,0x030000000001000000013ff1c28f5c28f5c3010000000100
1,"Ng==",1,0,0x,"Bw==","",5,0x03005645890000,0x030000000001000000013ff1c28f5c28f5c3010000000100

6. Common Errors

Refer to Common Errors.