get
Encapsulates commands that get key/value pairs from store or get rows from table. The subcommands are as follows:
get kv
get kv [-key <keyString>] [-file <output>] [-all] [-keyonly]
[-valueonly] [-start <prefixString>] [-end <prefixString>] Perform a simple get operation using the specified key. The obtained value is printed out if it contains displayable characters, otherwise the bytes array is encoded using Base64 for display purposes. "[Base64]" is appended to indicate this transformation. The arguments for the get command are:
-
-key <keyString>Indicates the full or the prefix key path to use. If
<keyString>is a full key path, it returns a single value information. The format of thisgetcommand is:get -key <keyString>.If<keyString>is a prefix key path, it returns multiple key/value pairs. The format of thisgetcommand is:get -key <keyString> -all.Key can be composed of both major and minor key paths, or a major key path only. The <keyString> format is: "major-key-path/-/minor-key-path". Additionally, in the case of the prefix key path, a key can be composed of the prefix part of a major key path.For example, with some sample keys in the KVStore:
/group/TC/-/user/bob /group/TC/-/user/john /group/TC/-/dep/IT /group/SZ/-/user/steve /group/SZ/-/user/dianaA get command with a key containing only the prefix part of the major key path results in:
kv -> get kv -key /group -all -keyonly /group/TC/-/user/bob /group/TC/-/user/john /group/TC/-/dep/IT /group/SZ/-/user/steve /group/SZ/-/user/dianaA get command with a key containing a major key path results in:
kv -> get kv -key /group/TC -all -keyonly /group/TC/-/user/bob /group/TC/-/user/john /group/TC/-/dep/ITGet commands with a key containing major and minor key paths results in:
kv -> get kv -key /group/TC/-/user -all -keyonly /group/TC/-/user/bob /group/TC/-/user/john kv -> get kv -key /group/TC/-/user/bob { "name" : "bob.smith", "age" : 20, "email" : "bob.smith@example.com", "phone" : "408 555 5555" } -
-file <output>Specifies an output file, which is truncated, replacing all existing content with new content.
In the following example, records from the key
/Smith/Bobare written to the file"data.out".kv -> get kv -key /Smith/Bob -all -file ./data.outIn the following example, contents of the file
"data.out"are replaced with records from the key/Wong/Bill.kv -> get kv -key /Wong/Bill -all -file ./data.out -
-allSpecified for iteration starting at the specified key. If the key argument is not specified, the entire store will be iterated.
-
-keyonlySpecified with
-allto return only keys. -
-valueonlySpecified with
-allto return only values. -
-start <prefixString>and-end <prefixString>Restricts the range used for iteration. This is particularly helpful when getting a range of records based on a key component, such as a well-formatted string. Both the
-startand-endarguments are inclusive.Note:
-startand-endonly work on the key component specified by-key <keyString>. The value of<keyString>should be composed of simple strings and cannot have multiple key components specified.For example, a log where its key structure is:
/log/<year>/<month>/-/<day>/<time>puts all log entries for the same day in the same partition, but splits the days across shards. The
timeformat is: "hour.minute".In this way, you can do a
getof all log entries in February and March, 2013 by specifying:kv-> get kv -all -keyonly -key /log/2013 -start 02 -end 03 /log/2013/02/-/01/1.45 /log/2013/02/-/05/3.15 /log/2013/02/-/15/10.15 /log/2013/02/-/20/6.30 /log/2013/02/-/28/8.10 /log/2013/03/-/01/11.13 /log/2013/03/-/15/2.28 /log/2013/03/-/22/4.52 /log/2013/03/-/31/11.55You can be more specific to the
getcommand by specifying a more complete key path. For example, to display all log entries from April 1st to April 4th:kv-> get kv -all -keyonly -key /log/2013/04 -start 01 -end 04 /log/2013/04/-/01/1.03 /log/2013/04/-/01/4.05 /log/2013/04/-/02/7.22 /log/2013/04/-/02/9.40 /log/2013/04/-/03/4.15 /log/2013/04/-/03/6.30 /log/2013/04/-/03/10.25 /log/2013/04/-/04/4.10 /log/2013/04/-/04/8.35
See the subcommand get table
get table
kv-> get table -name <table_name> [-index <name>]
[-field <name> -value <value>]+
[-field <name> [-start <value>] [-end <value>]]
[-ancestor <name>]+ [-child <name>]+
[-json <string>] [-file <output>] [-keyonly]
[-pretty] [-report-size] Identifies a table name, which can be any of the following:
-nameIdentifies any of the following tables:
table_name– The target table is a top level table created in the default namespace,sysdefault. The default namespace (sysdefault:) prefix is not required to identify such tables.table_name.child_name– The target table is the child of a parent table. Identify the child table by preceding it with the parenttable_name, followed by a period (.) separator beforechild_name.namespace_name:table_name– The target table was not created in the default (sysdefault) namespace. Identifytable_nameby preceding it with itsnamespace_name, followed by a colon (:).namespace_name:table_name.child_name– The target table is the child of a parent table that was created in a namespace. Identifychild_nameby preceding it with bothnamespace_name:and the parenttable_name, , followed by a period (.) separator.
-fieldand-valuepairs are used to specify the field values of the primary key or index key if using an index, specified by-index, or with an empty key to iterate the entire table.-
-fieldflag, along with its-startand-endflags, can be used to define a value range for the last field specified. -
-ancestorand-childflags are used to return results from specific ancestor and/or descendant tables as well as the target table. -
-jsonindicates that the key field values are in JSON format. -
-fileis used to specify an output file, which is truncated. -
-keyonlyis used to restrict information to keys only. -
-prettyis used for a nicely formatted JSON string with indentation and carriage returns. -
-report-sizeis used to show key and data size information for primary keys, data values, and index keys for matching records. When-report-sizeis specified no data is displayed.