Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

HIMPORT SET

Last updated
HIMPORT SET key name value [value ...]
Group
Hash
Arity
-5 (at least 5 words, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

HIMPORT SET makes the hash at key from the values given, matched in order with the field names that HIMPORT PREPARE stored under name. A hash the key already held is replaced. The number of values must equal the number of prepared fields. A key that holds another type is refused with WRONGTYPE and left as it is.

The hash is read like any other (HGETALL, HGET).

Simple string OK in RESP2 and RESP3. Errors:

Error Cause
ERR no such fieldset name was not prepared on this connection, or was discarded.
ERR value count does not match fieldset field count The number of values differs from the number of fields.
WRONGTYPE Operation against a key holding the wrong kind of value The key holds another type.
127.0.0.1:6379> HIMPORT PREPARE person name age city
OK
127.0.0.1:6379> HIMPORT SET account:1 person Ada 36 London
OK
127.0.0.1:6379> HIMPORT SET account:2 person Grace 85 NYC
OK
127.0.0.1:6379> HGETALL account:1
1) "age"
2) "36"
3) "city"
4) "London"
5) "name"
6) "Ada"
127.0.0.1:6379> HIMPORT SET account:3 nosuch a b c
(error) ERR no such fieldset
127.0.0.1:6379> HIMPORT SET account:4 person only-one
(error) ERR value count does not match fieldset field count
127.0.0.1:6379> SET plain x
OK
127.0.0.1:6379> HIMPORT SET plain person a b c
(error) WRONGTYPE Operation against a key holding the wrong kind of value

A Redis 8.10 command.

HIMPORT PREPARE, HSET, HGETALL