Share via


DatasetsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

AIProjectClient's

<xref:datasets> attribute.

Constructor

DatasetsOperations(*args, **kwargs)

Methods

create_or_update

Create a new or update an existing DatasetVersion with the given version id.

delete

Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was deleted successfully or if the DatasetVersion does not exist.

get

Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion does not exist.

get_credentials

Get the SAS credential to access the storage account associated with a Dataset version.

list

List the latest version of each DatasetVersion.

list_versions

List all versions of the given DatasetVersion.

pending_upload

Start a new or get an existing pending upload of a dataset for a specific version.

upload_file

Upload file to a blob storage, and create a dataset that references this file. This method uses the ContainerClient.upload_blob method from the azure-storage-blob package to upload the file. Any keyword arguments provided will be passed to the upload_blob method.

upload_folder

Upload all files in a folder and its sub folders to a blob storage, while maintaining relative paths, and create a dataset that references this folder. This method uses the ContainerClient.upload_blob method from the azure-storage-blob package to upload each file. Any keyword arguments provided will be passed to the upload_blob method.

create_or_update

Create a new or update an existing DatasetVersion with the given version id.

create_or_update(name: str, version: str, dataset_version: DatasetVersion | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> DatasetVersion

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The specific version id of the DatasetVersion to create or update. Required.

dataset_version
Required
DatasetVersion or <xref:JSON> or IO[bytes]

The DatasetVersion to create or update. Is one of the following types: DatasetVersion, JSON, IO[bytes] Required.

Returns

Type Description

DatasetVersion. The DatasetVersion is compatible with MutableMapping

Exceptions

Type Description

delete

Delete the specific version of the DatasetVersion. The service returns 204 No Content if the DatasetVersion was deleted successfully or if the DatasetVersion does not exist.

delete(name: str, version: str, **kwargs: Any) -> None

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The version of the DatasetVersion to delete. Required.

Returns

Type Description

None

Exceptions

Type Description

get

Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the DatasetVersion does not exist.

get(name: str, version: str, **kwargs: Any) -> DatasetVersion

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The specific version id of the DatasetVersion to retrieve. Required.

Returns

Type Description

DatasetVersion. The DatasetVersion is compatible with MutableMapping

Exceptions

Type Description

get_credentials

Get the SAS credential to access the storage account associated with a Dataset version.

get_credentials(name: str, version: str, **kwargs: Any) -> DatasetCredential

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The specific version id of the DatasetVersion to operate on. Required.

Returns

Type Description

DatasetCredential. The DatasetCredential is compatible with MutableMapping

Exceptions

Type Description

list

List the latest version of each DatasetVersion.

list(**kwargs: Any) -> ItemPaged[DatasetVersion]

Returns

Type Description

An iterator like instance of DatasetVersion

Exceptions

Type Description

list_versions

List all versions of the given DatasetVersion.

list_versions(name: str, **kwargs: Any) -> ItemPaged[DatasetVersion]

Parameters

Name Description
name
Required
str

The name of the resource. Required.

Returns

Type Description

An iterator like instance of DatasetVersion

Exceptions

Type Description

pending_upload

Start a new or get an existing pending upload of a dataset for a specific version.

pending_upload(name: str, version: str, pending_upload_request: PendingUploadRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> PendingUploadResponse

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The specific version id of the DatasetVersion to operate on. Required.

pending_upload_request
Required
PendingUploadRequest or <xref:JSON> or IO[bytes]

The pending upload request parameters. Is one of the following types: PendingUploadRequest, JSON, IO[bytes] Required.

Returns

Type Description

PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping

Exceptions

Type Description

upload_file

Upload file to a blob storage, and create a dataset that references this file. This method uses the ContainerClient.upload_blob method from the azure-storage-blob package to upload the file. Any keyword arguments provided will be passed to the upload_blob method.

upload_file(*, name: str, version: str, file_path: str, connection_name: str | None = None, **kwargs: Any) -> FileDatasetVersion

Keyword-Only Parameters

Name Description
name
str

The name of the dataset. Required.

version
str

The version identifier for the dataset. Required.

file_path
str

The file name (including optional path) to be uploaded. Required.

connection_name
str

The name of an Azure Storage Account connection, where the file should be uploaded. If not specified, the default Azure Storage Account connection will be used. Optional.

Default value: None

Returns

Type Description

The created dataset version.

Exceptions

Type Description

If an error occurs during the HTTP request.

upload_folder

Upload all files in a folder and its sub folders to a blob storage, while maintaining relative paths, and create a dataset that references this folder. This method uses the ContainerClient.upload_blob method from the azure-storage-blob package to upload each file. Any keyword arguments provided will be passed to the upload_blob method.

upload_folder(*, name: str, version: str, folder: str, connection_name: str | None = None, file_pattern: Pattern | None = None, **kwargs: Any) -> FolderDatasetVersion

Keyword-Only Parameters

Name Description
name
str

The name of the dataset. Required.

version
str

The version identifier for the dataset. Required.

folder
str

The folder name (including optional path) to be uploaded. Required.

connection_name
str

The name of an Azure Storage Account connection, where the file should be uploaded. If not specified, the default Azure Storage Account connection will be used. Optional.

Default value: None
file_pattern

A regex pattern to filter files to be uploaded. Only files matching the pattern will be uploaded. Optional.

Default value: None

Returns

Type Description

The created dataset version.

Exceptions

Type Description

If an error occurs during the HTTP request.