benchling_sdk.services.v2.beta.v2_beta_dataset_service module¶
- class V2BetaDatasetService¶
Bases:
benchling_sdk.services.v2.base_service.BaseService
V2-Beta Datasets.
Datasets are Benchling objects that represent tabular data with typed columns and rows of data.
See https://benchling.com/api/v2-beta/reference#/Dataset
- create(dataset: benchling_api_client.v2.beta.models.dataset_create.DatasetCreate) benchling_api_client.v2.beta.models.dataset.Dataset ¶
Create a dataset.
See https://benchling.com/api/v2-beta/reference#/Datasets/createDataset
- create_from_bytes(dataset: benchling_api_client.v2.beta.models.dataset_create.DatasetCreate, input_bytes: Union[_io.BytesIO, bytes], timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) AsyncTaskLink ¶
Create a dataset from bytes or BytesIO data.
- Parameters
dataset â The DatasetCreate specification for the data. This must be provided, as it cannot be inferred from file names.
input_bytes â Data to upload as bytes or BytesIO
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- Returns
An AsyncTaskLink that can be polled to know when the dataset has completed processing
- Return type
- create_from_file(file: Path, dataset: Optional[benchling_api_client.v2.beta.models.dataset_create.DatasetCreate] = None, timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) AsyncTaskLink ¶
Create a dataset from file data.
- Parameters
file â A valid Path to an existing file containing the data to upload
dataset â The DatasetCreate specification for the data. If not provided, it will be inferred from the file name
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- Returns
An AsyncTaskLink that can be polled to know when the dataset has completed processing
- Return type
- download_dataset_bytes(dataset: benchling_api_client.v2.beta.models.dataset.Dataset, timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) List[_io.BytesIO] ¶
Download dataset data to bytes.
- Parameters
dataset â The dataset to download
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- Returns
An ordered list of BytesIO streams corresponding to a manifest item in the dataset
- Return type
List[BytesIO]
- download_dataset_bytes_by_id(dataset_id: str, timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) List[_io.BytesIO] ¶
Download dataset data to files by dataset_id.
Fetches the dataset first, then downloads the files.
- Parameters
dataset_id â The id of the dataset to download
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- Returns
An ordered list of BytesIO streams corresponding to a manifest item in the dataset
- Return type
List[BytesIO]
- download_dataset_files(dataset: benchling_api_client.v2.beta.models.dataset.Dataset, destination_path: Optional[Path] = None, timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) List[Path] ¶
Download dataset data to files.
- Parameters
dataset â The dataset to download
destination_path â A target directory to place the files. File names will be created based on the manifest item file names. If not specified, a temp directory will be created. The caller is responsible for deleting this directory.
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- Returns
An ordered list of downloaded file paths corresponding to a manifest item in the dataset
- Return type
List[Path]
- download_dataset_files_by_id(dataset_id: str, destination_path: Optional[Path] = None, timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) List[Path] ¶
Download dataset data to files by dataset_id.
Fetches the dataset first, then downloads the files.
- Parameters
dataset_id â The id of the dataset to download
destination_path â A target directory to place the files. File names will be created based on the manifest item file names. If not specified, a temp directory will be created. The caller is responsible for deleting this directory.
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- Returns
An ordered list of downloaded file paths corresponding to a manifest item in the dataset
- Return type
List[Path]
- get_by_id(dataset_id: str) benchling_api_client.v2.beta.models.dataset.Dataset ¶
Get a dataset and URLs to download its data.
See https://benchling.com/api/v2-beta/reference#/Datasets/getDataset
- update(dataset_id: str, dataset: benchling_api_client.v2.beta.models.dataset_update.DatasetUpdate) AsyncTaskLink ¶
Update a dataset.
See https://benchling.com/api/v2-beta/reference#/Datasets/patchDataset
- upload_bytes(url: str, input_bytes: Union[_io.BytesIO, bytes], timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) None ¶
Upload bytes to an existing dataset.
- Parameters
url â The url provided by Benchling for uploading to the dataset
input_bytes â Data to upload as bytes or BytesIO
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large
- upload_file(url: str, file: Path, timeout_seconds: float = _DEFAULT_HTTP_TIMEOUT_UPLOAD_DATASET) None ¶
Upload a file to an existing dataset.
- Parameters
url â The url provided by Benchling for uploading to the dataset
file â A valid Path to an existing file containing the data to upload
timeout_seconds â Extends the normal HTTP timeout settings since Dataset uploads can be large Use this to extend even further if streams are very large