# Use cases

> Use cases - Returns the Use Cases associated with this account.

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-27T18:44:30.563682+00:00` (UTC).

## Primary page

- [Use cases](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [UseCase](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase): In-page section heading.
- [get_uri()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.get_uri): In-page section heading.
- [get()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.get): In-page section heading.
- [list()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.list): In-page section heading.
- [create()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.create): In-page section heading.
- [delete()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.delete): In-page section heading.
- [update()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.update): In-page section heading.
- [add()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.add): In-page section heading.
- [remove()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.remove): In-page section heading.
- [share()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.share): In-page section heading.
- [get_shared_roles()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.get_shared_roles): In-page section heading.
- [list_projects()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.list_projects): In-page section heading.
- [list_datasets()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.list_datasets): In-page section heading.
- [list_applications()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.list_applications): In-page section heading.
- [from_data()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.from_data): In-page section heading.
- [from_server_data()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.from_server_data): In-page section heading.
- [open_in_browser()](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.open_in_browser): In-page section heading.
- [UseCaseUser](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.models.use_cases.use_case.UseCaseUser): In-page section heading.
- [UseCaseReferenceEntity](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.models.use_cases.use_case.UseCaseReferenceEntity): In-page section heading.

## Documentation content

### UseCase

Representation of a Use Case.

Variables

| Attribute | Type | Description |
| --- | --- | --- |
| id | str | The ID of the Use Case. |
| name | str | The name of the Use Case. |
| description | str | The description of the Use Case. Nullable. |
| created_at | str | The timestamp generated at record creation. |
| created | UseCaseUser | The user who created the Use Case. |
| updated_at | str | The timestamp generated when the record was last updated. |
| updated | UseCaseUser | The most recent user to update the Use Case. |
| models_count | int | The number of models in a Use Case. |
| projects_count | int | The number of projects in a Use Case. |
| datasets_count | int | The number of datasets in a Use Case. |
| files_count | int | The number of files in a Use Case. |
| notebooks_count | int | The number of notebooks in a Use Case. |
| applications_count | int | The number of applications in a Use Case. |
| playgrounds_count | int | The number of playgrounds in a Use Case. |
| vector_databases_count | int | The number of vector databases in a Use Case. |
| owners | List[UseCaseUser] | The most recent user to update the Use Case. |
| members | List[UseCaseUser] | The most recent user to update the Use Case. |

> [!NOTE] Examples
> ```
> import datarobot
> with UseCase.get("2348ac"):
>     print(f"The current use case is {dr.Context.use_case}")
> ```

#### get_uri()

Returns

| Returns | Description |
| --- | --- |
| url | Permanent static hyperlink to this Use Case. |

Return type: `str`

#### get()

Gets information about a Use Case.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| use_case_id | str | The identifier of the Use Case you want to load. |

Returns

| Returns | Description |
| --- | --- |
| use_case | The queried Use Case. |

Return type: [UseCase](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase)

#### list()

Returns the Use Cases associated with this account.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| search_params | dict, optional. | If not None, the returned projects are filtered by lookup. |

!!! note "Notes"

```
  Currently, you can query use cases by:
  > * `offset` - The number of records to skip over. Default 0.
  > * `limit` - The number of records to return in the range from 1 to 100. Default 100.
  > * `search` - Only return Use Cases with names that match the given string.
  > * `project_id` - Only return Use Cases associated with the given project ID.
  > * `application_id` - Only return Use Cases associated with the given app.
  > * `orderBy` - The order to sort the Use Cases.

  `orderBy` queries can use the following options:
  > * `id` or `-id`
  > * `name` or `-name`
  > * `description` or `-description`
  > * `projects_count` or `-projects_count`
  > * `datasets_count` or `-datasets_count`
  > * `files_count` or `-files_count`
  > * `notebooks_count` or `-notebooks_count`
  > * `applications_count` or `-applications_count`
  > * `created_at` or `-created_at`
  > * `created_by` or `-created_by`
  > * `updated_at` or `-updated_at`
  > * `updated_by` or `-updated_by`
```

Returns

| Returns | Description |
| --- | --- |
| use_cases | Contains a list of Use Cases associated with this user account. |

Return type: [list](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase.list) of `UseCase instances`

Raises

| Exception | Description |
| --- | --- |
| TypeError | Raised if search_params parameter is provided, but is not of supported type. |

#### create()

Create a new Use Case.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| name | str | Optional. The name of the new Use Case. |
| description | str | The description of the new Use Case. Optional. |

Returns

| Returns | Description |
| --- | --- |
| use_case | The created Use Case. |

Return type: [UseCase](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase)

#### delete()

Delete a Use Case.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| use_case_id | str | The ID of the Use Case to be deleted. |

Return type: `None`

#### update()

Update a Use Case’s name or description.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| name | str | The updated name of the Use Case. |
| description | str | The updated description of the Use Case. |

Returns

| Returns | Description |
| --- | --- |
| use_case | The updated Use Case. |

Return type: [UseCase](https://docs.datarobot.com/ja/docs/api/reference/sdk/use-cases.html.md#datarobot.UseCase)

#### add()

Add an entity (project, dataset, etc.) to a Use Case. Can only accept either an entity or
an entity type and entity ID, but not both.

Projects and Applications can only be linked to a single Use Case. Datasets can be linked to multiple Use Cases.

There are some prerequisites for linking Projects to a Use Case which are explained in the [user guide](https://docs.datarobot.com/ja/docs/api/dev-learning/python/use_cases/use_cases.html.md#add-project-to-a-use-case).

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| entity | Union[UseCaseReferenceEntity, Project, Dataset, Application, Files] | An existing entity to be linked to this Use Case. Cannot be used if entity_type and entity_id are passed. |
| entity_type | UseCaseEntityType | The entity type of the entity to link to this Use Case. Cannot be used if entity is passed. |
| entity_id | str | The ID of the entity to link to this Use Case. Cannot be used if entity is passed. |

Returns

| Returns | Description |
| --- | --- |
| use_case_reference_entity | The newly created reference link between this Use Case and the entity. |

Return type: `UseCaseReferenceEntity`

#### remove()

Remove an entity from a Use Case. Can only accept either an entity or
an entity type and entity ID, but not both.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| entity | Union[UseCaseReferenceEntity, Project, Dataset, Application, Files] | An existing entity instance to be removed from a Use Case. Cannot be used if entity_type and entity_id are passed. |
| entity_type | UseCaseEntityType | The entity type of the entity to link to this Use Case. Cannot be used if entity is passed. |
| entity_id | str | The ID of the entity to link to this Use Case. Cannot be used if entity is passed. |

Return type: `None`

#### share()

Share this Use Case with or remove access from one or more user(s).

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| roles | List[SharingRole] | A list of SharingRole instances, each of which references a user and a role to be assigned. Currently, the only supported roles for Use Cases are OWNER, EDITOR, and CONSUMER. Supported share_recipient_type values are USER, ORGANIZATION, and GROUP. To remove access, set a user’s role to datarobot.enums.SHARING_ROLE.NO_ROLE. |

Return type: `None`

> [!NOTE] Examples
> The [SharingRole](https://docs.datarobot.com/ja/docs/api/reference/sdk/data-registry.html.md#datarobot.models.sharing.SharingRole) class is needed in order to
> share a Use Case with one or more users.
> 
> For example, suppose you had a list of user IDs you wanted to share this Use Case with. You could use
> a loop to generate a list of [SharingRole](https://docs.datarobot.com/ja/docs/api/reference/sdk/data-registry.html.md#datarobot.models.sharing.SharingRole) objects for them,
> and bulk share this Use Case.
> 
> ```
> >>> from datarobot.models.use_cases.use_case import UseCase
> >>> from datarobot.models.sharing import SharingRole
> >>> from datarobot.enums import SHARING_ROLE, SHARING_RECIPIENT_TYPE
> >>>
> >>> user_ids = ["60912e09fd1f04e832a575c1", "639ce542862e9b1b1bfa8f1b", "63e185e7cd3a5f8e190c6393"]
> >>> sharing_roles = []
> >>> for user_id in user_ids:
> ...     new_sharing_role = SharingRole(
> ...         role=SHARING_ROLE.CONSUMER,
> ...         share_recipient_type=SHARING_RECIPIENT_TYPE.USER,
> ...         id=user_id,
> ...     )
> ...     sharing_roles.append(new_sharing_role)
> >>> use_case = UseCase.get(use_case_id="5f33f1fd9071ae13568237b2")
> >>> use_case.share(roles=sharing_roles)
> ```
> 
> Similarly, a [SharingRole](https://docs.datarobot.com/ja/docs/api/reference/sdk/data-registry.html.md#datarobot.models.sharing.SharingRole) instance can be used to
> remove a user’s access if the `role` is set to `SHARING_ROLE.NO_ROLE`, like in this example:
> 
> ```
> >>> from datarobot.models.use_cases.use_case import UseCase
> >>> from datarobot.models.sharing import SharingRole
> >>> from datarobot.enums import SHARING_ROLE, SHARING_RECIPIENT_TYPE
> >>>
> >>> user_to_remove = "foo.bar@datarobot.com"
> ... remove_sharing_role = SharingRole(
> ...     role=SHARING_ROLE.NO_ROLE,
> ...     share_recipient_type=SHARING_RECIPIENT_TYPE.USER,
> ...     username=user_to_remove,
> ... )
> >>> use_case = UseCase.get(use_case_id="5f33f1fd9071ae13568237b2")
> >>> use_case.share(roles=[remove_sharing_role])
> ```

#### get_shared_roles()

Retrieve access control information for this Use Case.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| offset | Optional[int] | The number of records to skip over. Optional. Default is 0. |
| limit | Optional[int] | The number of records to return. Optional. Default is 100. |
| id | Optional[str] | Return the access control information for a user with this user ID. Optional. |

Return type: `List` [ [SharingRole](https://docs.datarobot.com/ja/docs/api/reference/sdk/data-registry.html.md#datarobot.models.sharing.SharingRole)]

#### list_projects()

List all projects associated with this Use Case.

Returns

| Returns | Description |
| --- | --- |
| projects | All projects associated with this Use Case. |

Return type: `List[Project]`

#### list_datasets()

List all datasets associated with this Use Case.

Returns

| Returns | Description |
| --- | --- |
| datasets | All datasets associated with this Use Case. |

Return type: `List[Dataset]`

#### list_applications()

List all applications associated with this Use Case.

Returns

| Returns | Description |
| --- | --- |
| applications | All applications associated with this Use Case. |

Return type: `List[Application]`

#### from_data()

Instantiate an object of this class using a dict.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| data | dict | Correctly snake_cased keys and their values. |

Return type: `TypeVar` ( `T`, bound= APIObject)

#### from_server_data()

Instantiate an object of this class using the data directly from the server,
meaning that the keys may have the wrong camel casing

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| data | dict | The directly translated dict of JSON from the server. No casing fixes have taken place |
| keep_attrs | iterable | List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None |

Return type: `TypeVar` ( `T`, bound= APIObject)

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

Return type: `None`

### UseCaseUser

Representation of a Use Case user.

Variables

| Attribute | Type | Description |
| --- | --- | --- |
| id | str | The id of the user. |
| full_name | str | The full name of the user. Optional. |
| email | str | The email address of the user. Optional. |
| userhash | str | User’s gravatar hash. Optional. |
| username | str | The username of the user. Optional. |

### UseCaseReferenceEntity

An entity associated with a Use Case.

Variables

| Attribute | Type | Description |
| --- | --- | --- |
| entity_type | UseCaseEntityType | The type of the entity. |
| use_case_id | str | The Use Case this entity is associated with. |
| id | str | The ID of the entity. |
| created_at | str | The date and time this entity was linked with the Use Case. |
| is_deleted | bool | Whether or not the linked entity has been deleted. |
| created | UseCaseUser | The user who created the link between this entity and the Use Case. |
