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

begin_create_generation_job

Create a data generation job.

cancel_generation_job

Cancel a data generation job.

Cancels the specified data generation job if it is still in progress.

create_or_update

Create or update a version.

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

delete

Delete a version.

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_generation_job

Delete a data generation job.

Removes the specified data generation job and its associated output.

get

Get a version.

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

get_credentials

Get dataset credentials.

Retrieves the SAS credential to access the storage account associated with a dataset version.

get_generation_job

Get a data generation job.

Retrieves the specified data generation job and its current status.

list

List latest versions.

List the latest version of each DatasetVersion.

list_generation_jobs

List data generation jobs.

Returns a list of data generation jobs.

list_versions

List versions.

List all versions of the given DatasetVersion.

pending_upload

Start a pending upload.

Initiates a new pending upload or retrieves an existing one for the specified dataset 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.

begin_create_generation_job

Create a data generation job.

begin_create_generation_job(job: DataGenerationJobInputs | MutableMapping[str, Any] | IO[bytes], *, operation_id: str | None = None, **kwargs: Any) -> DatasetGenerationLROPoller

Parameters

Name Description
job
Required
DataGenerationJobInputs or <xref:JSON> or IO[bytes]

The job to create. Required.

Keyword-Only Parameters

Name Description
operation_id
str

Client-generated unique ID for idempotent retries. When absent, the server creates the job unconditionally. Default value is None.

Default value: None

Returns

Type Description

A poller that returns DataGenerationJobResult and exposes the job ID in details.

Exceptions

Type Description

cancel_generation_job

Cancel a data generation job.

Cancels the specified data generation job if it is still in progress.

cancel_generation_job(job_id: str, **kwargs: Any) -> DataGenerationJob

Parameters

Name Description
job_id
Required
str

The ID of the job to cancel. Required.

Returns

Type Description

DataGenerationJob. The DataGenerationJob is compatible with MutableMapping

Exceptions

Type Description

create_or_update

Create or update a version.

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 a version.

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

delete_generation_job

Delete a data generation job.

Removes the specified data generation job and its associated output.

delete_generation_job(job_id: str, **kwargs: Any) -> None

Parameters

Name Description
job_id
Required
str

The ID of the job to delete. Required.

Returns

Type Description

None

Exceptions

Type Description

get

Get a version.

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 dataset credentials.

Retrieves 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

get_generation_job

Get a data generation job.

Retrieves the specified data generation job and its current status.

get_generation_job(job_id: str, **kwargs: Any) -> DataGenerationJob

Parameters

Name Description
job_id
Required
str

The ID of the job. Required.

Returns

Type Description

DataGenerationJob. The DataGenerationJob is compatible with MutableMapping

Exceptions

Type Description

list

List latest versions.

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_generation_jobs

List data generation jobs.

Returns a list of data generation jobs.

list_generation_jobs(*, limit: int | None = None, order: str | PageOrder | None = None, before: str | None = None, **kwargs: Any) -> ItemPaged[DataGenerationJob]

Keyword-Only Parameters

Name Description
limit
int

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None.

Default value: None
order

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: "asc" and "desc". Default value is None.

Default value: None
before
str

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of DataGenerationJob

Exceptions

Type Description

list_versions

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 pending upload.

Initiates a new pending upload or retrieves an existing one for the specified dataset 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.