/*! @page config_strings Configuration Strings
@section config_intro Introduction
Methods in WiredTiger take a configuration string to provide optional
arguments and configure non-standard behaviors. These strings are
simple comma-separated lists of "
pairs, and
all have the same format:
[key['='value]][','[key['='value]]]*Keys and values and values that consist of alphanumeric characters can be specified directly. More precisely, keys or values that match this regular expression do not require quotes:
[-_0-9A-Za-z./][^\\t\\r\\n :=,\\])}]*Configuration strings are case-sensitive (for example, "true" is a valid boolean value, but "True" is not). More complex keys and values can be specified by quoting them with double quotes. For example, a configuration string is used when opening a connection to a database to specify if the database should be created and to set the cache size: @snippet ex_all.c Open a connection Configuration strings are also used to configure the table schema. For example, to create a table that uses C language strings for keys and values: @snippet ex_all.c Create a table To handle more complex schema configuration, such as specifying multiple columns in a table, values are nested using parentheses. For example: @snippet ex_all.c Create a table with columns All types of parentheses are treated equivalently by the parser. When an integer value is expected, the value may have multiplier characters appended, as follows:
NULL
.
@section config_json JavaScript Object Notation (JSON) compatibility
WiredTiger configuration strings are compatible with
JavaScript Object Notation (JSON),
and will accept additional formatting as follows:
- parentheses may be round or square brackets or curly braces:
'()'
, '[]'
or '{}'
- the whole configuration string may optionally be wrapped in parentheses
- the key/value separator can be a colon: ':'
- keys and values may be in double quotes: "key" = "value"
- quoted strings are interpreted as UTF-8 values
The result of this relaxed parsing is that applications may pass strings
representing valid JSON objects wherever
configuration strings are required.
For example, in Python, code might look as follows:
\code
import json
config = json.dumps({
"key_format" : "r",
"value_format" : "5sHQ",
"columns" : ("id", "country", "year", "population"),
"colgroup.population" : ["population"],
"index.country_year" : ["country", "year"]
})
\endcode
Because JSON compatibility allows colons to be used as key/value separators,
WiredTiger URIs may require quoting. For example, the following
WT_SESSION::checkpoint call specifies a set of URIs as checkpoint targets,
using double-quote characters to keep the parser from treating the colon
characters as JSON name/value separators:
@snippet ex_all.c JSON quoting example
*/