tensorstore.KvStore.__getitem__(self, key: str) bytes

Synchronously reads the value of a single key.

Example

>>> store = ts.KvStore.open({'driver': 'memory'}).result()
>>> store[b'a'] = b'value'
>>> store[b'a']
b'value'
>>> store[b'b']
Traceback (most recent call last):
    ...
KeyError...
Parameters:
key: str

The key to read. This is appended (without any separator) to the existing path, if any.

Returns:

The value associated with key on success.

Raises:

Note

The current thread is blocked until the read completes, but computations in other threads may continue.