Python - kv.keys()

Get a value from a key value store.

from nitric.resources import kv
from nitric.application import Nitric
profiles = kv('profiles').allow('get')
for await key in profiles.keys():
# Do something with the key
Nitric.run()

Parameters

  • Name
    key
    Type
    string
    Description

    The key that references the key value pair that should be retrieved.

Examples

Get a key value pair

from nitric.resources import kv
from nitric.application import Nitric
profiles = kv('profiles').allow('get')
for await key in profiles.keys():
# Do something with the key
Nitric.run()

Filter by a prefix

from nitric.resources import kv
from nitric.application import Nitric
profiles = kv('profiles').allow('get')
# search for keys beginning with "profile:"
for await key in profiles.keys("profile:"):
# Do something with the key
Nitric.run()
Last updated on Oct 11, 2024