Version 10.0.2
Dump Formats

The wt dump command produces a flat-text representation of a table that can be loaded by wt load. This page describes the output formats of the wt dump command.

JSON dump format

JSON (JavaScript Object Notation) dump files use the standard JSON data-interchange format to specify the objects, and may be interpreted by any JSON reader.

The format is a JSON object where each key is the URI passed to WT_SESSION::create and the corresponding value is a JSON array of two entries. The first entry in this array is a JSON object composed of configuration information: the "config" key has the configuration string used with WT_SESSION::create, the "colgroups" and "indices" keys have values that are arrays of objects that are in turn composed of configuration information. The second entry is a JSON array, with each entry an object representing a row of data. If the columns were named in the configuration string used with WT_SESSION::create, those names are used for keys, otherwise predictable names (for example, "key0", "value0", "value1") are generated. The values in this object are the values for each column in the record.

Here is some sample output:

{
"table:planets" : [
{
"config" : "columns=(id,name,distance),key_format=i,value_format=Si",
"colgroups" : [],
"indices" : [
{
"uri" : "index:planets:names",
"config" : "columns=(name),key_format=Si,source=\"file:astronomy.wt\",type=file"
}
]
},
[
{
"id" : 1,
"name" : "Mercury",
"distance" : 57910000
},
{
"id" : 2,
"name" : "Venus",
"distance" : 108200000
},
...
]
]
}

Text dump format

Text dump files have three parts, a prefix, a header and a body.

The dump prefix includes basic information about the dump including the WiredTiger version that created the dump and the dump format. The dump format consists of a line beginning with "Format=", and contains the following information:

StringMeaning
hexthe dumped data is in a hexadecimal dump format
printthe dumped data is in a printable format
print hexthe dumped data is in a printable format with raw byte array elements printed same as in hex format

The dump header follows a single "Header" line in the file and consists of paired key and value lines, where the key is the URI passed to WT_SESSION::create and the value is corresponding configuration string. The table or file can be recreated by calling WT_SESSION::create for each pair of lines in the header.

The dump body follows a single "Data" line in the file and consists of a text representation of the records in the table. Each record is represented by a pair of lines: the first line is the key and the second line is the value. These lines are encoded in one of the following formats: a printable format, a hexadecimal format, and a printable format with raw byte array elements in hexadecimal format.

The printable format consists of literal printable characters, and hexadecimal encoded non-printable characters. Encoded characters are written as three separate characters: a backslash character followed by two hexadecimal characters (first the high nibble and then the low nibble). For example, a newline character in the ASCII character set would be encoded as "\0a" and an escape character would be encoded as "\1b". Backslash characters which do not precede a hexadecimal encoding are paired, that is, the characters "\\" should be interpreted as a single backslash character.

The hexadecimal format consists of encoded characters, where each literal character is written as a pair of characters (first the high-nibble and then the low-nibble). For example, "0a" would be an ASCII newline character and "1b" would be an ASCII escape character.

The printable hexadecimal format is the same as the printable except all raw byte array elements will be printed in hexadecimal format.

Because the definition of "printable" may depend on the application's locale, dump files in the printable output format may be less portable than dump files in the hexadecimal output format.