I would like to iterated cross KV (NoSql,Redis) Target in MLRun without specification of primary key(s) also, but I saw only ability to get specific KV item(s) based on specific key(s). I have to use only unique items, not duplicit items.
I chose NoSql/Redis Target because key operations in-memory are critical for quick responce (based on specific key), but from time to time I have to iterate cross whole collection of keys (and it is case of this question).
You can see part of my code for getting values based on keys:
import mlrun
import mlrun.feature_store as fs
...
svc=fs.get_online_feature_service(fs.FeatureVector("myVector", ["client.*"]))
resp = svc.get([{"cuid": 1926, "key1": 100023}])
Do you know, how to iterate cross items in KV (NoSql, Redis) target in MLRun CE/Paid editions (version 1.2.1)?
2
Answers
The
NoSqlTarget
is using a KV store which is inherently for retrieving an individual value based on a given key. If you are looking to retrieve the entirety of your feature vector, you should use the offline store instead. More info in the MLRun docs hereAlternatively, you could use the offline store to get a list of keys and then query the online store using those:
I am using these solutions for iteration cross keys in KV storage:
1. NoSqlTarget
Iteration via v3io (it is not pure part of MLRun API, but it is part of MLRun distribution packages). More information about v3io python SDK see and iteration cross KV items (cursor usage) see sample
BTW: NoSqlTarget is available only for MLRun Enterprise edition
2. RedisTarget
You can use easy iteration cross KV items, it is part of Redis API
It is possible to use commandline also via
redis-cli
see sample:or remove from redis specific keys based on list of keys:
BTW: RedisTarget is available for MLRun CE and Enterprise editions