# キー値

> キー値 - Python APIクライアントを使用して、モデル、デプロイ、およびその他のエンティティのキーと値の設定を管理します。

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-15T05:55:44.626873+00:00` (UTC).

## Primary page

- [キー値](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [キー値の管理](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#manage-key-values): In-page section heading.
- [Create a key value](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#create-a-key-value): In-page section heading.
- [List key values](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#list-key-values): In-page section heading.
- [Retrieve a key value](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#retrieve-a-key-value): In-page section heading.
- [Find key values by name](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#find-key-values-by-name): In-page section heading.
- [Update key values](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#update-key-values): In-page section heading.
- [Get key value data](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#get-key-value-data): In-page section heading.
- [Delete key values](https://docs.datarobot.com/ja/docs/api/dev-learning/python/mlops/key_values.html.md#delete-key-values): In-page section heading.

## Documentation content

Key values associated with a DataRobot model, deployment, job, or other DataRobot entities are key-value pairs containing information about the related entity.
キーと値の各ペアの内容は次のとおりです。

- Name : The unique and descriptive name of the key (for the model package or version).
- Value type : The data type of the value associated with the key. 使用可能なタイプは、文字列、数値、ブール値、URL、画像、データセット、Pickle、バイナリ値、JSON、またはYAMLです。
- Category : The type of model information provided by the key value. The possible types are training parameter, metric, tag, artifact, and runtime parameter.
- Value : The stored data or file.

カスタムコンプライアンスドキュメントのテンプレートには、文字列、数値、ブール値、画像、データセットのキー値を含めることができます。

In addition, with key values for registered models, when you generate compliance documentation for a model package and reference a supported key value in the template, DataRobot inserts the matching values from the associated model package.

## キー値の管理

Use the following commands to manage key values.

### Create a key value

To create a key value, use `dr.KeyValue.create`:

```
import datarobot as dr

registered_model_id = "65ccb597732422fa2297199e"

key_value = dr.KeyValue.create(
    registered_model_id,
    dr.KeyValueEntityType.REGISTERED_MODEL,
    "my-kv-name",
    dr.KeyValueCategory.TAG,
    dr.KeyValueType.STRING,
    "tag-name",
)

key_value.id
>>> '65f32822be17d11dec9ebdfb' 
```

### List key values

To list all key values available to the current user, use `dr.KeyValue.list`:

```
import datarobot as dr

registered_model_id = "65ccb597732422fa2297199e"

key_values = dr.KeyValue.list(registered_model_id, dr.KeyValueEntityType.REGISTERED_MODEL)

key_values
>>> [KeyValue('my-kv-name')] 
```

### Retrieve a key value

To get a key value by unique identifier, use `dr.KeyValue.get`:

```
import datarobot as dr

key_value = dr.KeyValue.get("65f32822be17d11dec9ebdfb")

key_value
>>> KeyValue('my-kv-name') 
```

### Find key values by name

To find a key value by name, use `dr.KeyValue.find`. Provide the entity ID, entity type, and key value name:

```
import datarobot as dr

key_value = dr.KeyValue.find("65f32822be17d11dec9ebdfb", dr.KeyValueEntityType.REGISTERED_MODEL, "my-kv-name")

key_value
>>> KeyValue('my-kv-name') 
```

### Update key values

To get a key value by unique identifier and update it, use `dr.KeyValue.get()` and then `update()`:

```
import datarobot as dr

key_value = dr.KeyValue.get("65f32822be17d11dec9ebdfb")

key_value.update(value=4.7)
key_value.update(value_type=dr.KeyValueType.STRING, value="abc")
key_value.update(name="new-kv-name") 
```

### Get key value data

To get the value from a key value, use `dr.KeyValue.get_value()`. Provide the key value ID:

```
import datarobot as dr

key_value = dr.KeyValue.get("65f32822be17d11dec9ebdfb")

key_value.update(value=4.7)
key_value.get_value()
>>> 4.7

key_value.update(value_type=dr.KeyValueType.STRING, value="abc")
key_value.get_value()
>>> "abc"

key_value.update(value_type=dr.KeyValueType.BOOLEAN, value=True)
key_value.get_value()
>>> True 
```

### Delete key values

To get a key value by unique identifier and delete it, use `dr.KeyValue.get()` and then `delete()`:

```
import datarobot as dr

key_value = dr.KeyValue.get("65f32822be17d11dec9ebdfb")
key_value.delete() 
```
