superwise_api.entities.dataset

class DatasetApi(superwise_api.entities.base.BaseApi):

This class provides methods to interact with the Dataset API.

Attributes:
  • api_client (ApiClient): An instance of the ApiClient to make requests.
  • _model_name (str): The name of the model.
  • _resource_path (str): The path of the resource.
  • _dataset_source_model_name (str): The name of the dataset source model.
  • _dataset_source_path (str): The path of the dataset source resource.
def delete(self, dataset_id: str, **kwargs):

Deletes a dataset.

Arguments:
  • dataset_id (str): The id of the dataset to delete.
  • **kwargs: Arbitrary keyword arguments.
def get_by_id( self, dataset_id: str, **kwargs) -> superwise_api.models.dataset.dataset.Dataset:

Retrieves a dataset by its id.

Arguments:
  • dataset_id (str): The id of the dataset to retrieve.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Dataset: The retrieved dataset.

def create( self, name: str, description: Optional[str] = None, id: Optional[str] = None, schema: Optional[dict] = None, **kwargs) -> superwise_api.models.dataset.dataset.Dataset:

Creates a new dataset.

Arguments:
  • name (str): The name of the dataset.
  • description (str, optional): The description of the dataset.
  • id (str, optional): The id of the dataset.
  • schema (dict, optional): The schema of the dataset.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Dataset: The created dataset.

def get( self, name: Optional[str] = None, description: Optional[str] = None, id: Optional[str] = None, model_version_id: Optional[str] = None, created_by: Optional[str] = None, page: Optional[Annotated[int, Strict(strict=True), Interval(gt=None, ge=1, lt=None, le=None), None]] = None, size: Optional[Annotated[int, Strict(strict=True), Interval(gt=None, ge=1, lt=None, le=500), None]] = None, **kwargs) -> superwise_api.client.models.page.Page:

Retrieves datasets based on the provided filters.

Arguments:
  • name (Optional[str], optional): The name of the dataset to retrieve.
  • description (Optional[str], optional): The description of the dataset to retrieve.
  • id (Optional[str], optional): The id of the dataset to retrieve.
  • model_version_id (Optional[str], optional): The model version id of the dataset to retrieve.
  • created_by (Optional[str], optional): The creator of the dataset to retrieve.
  • page (Optional[conint(strict=True, ge=1)], optional): The page number to retrieve.
  • size (Optional[conint(strict=True, le=500, ge=1)], optional): The number of datasets to retrieve per page.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Page: A page of datasets.

@BaseApi.raise_exception
def search( self, prefix: str, page: Optional[Annotated[int, Strict(strict=True), Interval(gt=None, ge=1, lt=None, le=None), None]] = None, size: Optional[Annotated[int, Strict(strict=True), Interval(gt=None, ge=1, lt=None, le=500), None]] = None, **kwargs) -> superwise_api.client.models.page.Page:

Searches for datasets based on a prefix.

Arguments:
  • prefix (str): The prefix to search for.
  • page (Optional[conint(strict=True, ge=1)], optional): The page number to retrieve.
  • size (Optional[conint(strict=True, le=500, ge=1)], optional): The number of datasets to retrieve per page.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Page: A page of datasets.

def update( self, dataset_id: str, *, name: Optional[str] = None, description: Optional[str] = None, id: Optional[str] = None, schema: Optional[dict] = None, **kwargs) -> superwise_api.models.dataset.dataset.Dataset:

Updates a dataset.

Arguments:
  • dataset_id (str): The id of the dataset to update.
  • name (str, optional): The new name of the dataset.
  • description (str, optional): The new description of the dataset.
  • id (str, optional): The new id of the dataset.
  • schema (dict, optional): The new schema of the dataset.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Dataset: The updated dataset.

@BaseApi.raise_exception
def connect_to_source( self, dataset_id: str, source_id: str, ingest_type: superwise_api.models.dataset_source.dataset_source.IngestType, folder: str, **kwargs):

Connects a dataset to a source.

Arguments:
  • dataset_id (str): The id of the dataset to connect.
  • source_id (str): The id of the source to connect to.
  • ingest_type (IngestType): The ingestion type.
  • folder (str): The folder path to connect to inside the bucket. e.g. "folder1/folder2".
  • **kwargs: Arbitrary keyword arguments.
@BaseApi.raise_exception
def get_connected_sources(self, dataset_id: str, **kwargs) -> superwise_api.client.models.page.Page:

Retrieves the sources connected to a dataset.

Arguments:
  • dataset_id (str): The id of the dataset to retrieve the connected sources for.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Page: A page of connected sources.

@BaseApi.raise_exception
def get_models_for_dataset(self, dataset_id: str, **kwargs) -> superwise_api.client.models.page.Page:

Retrieves all models for a dataset.

Arguments:
  • dataset_id (str): The id of the dataset.
  • **kwargs: Arbitrary keyword arguments.
Returns:

Page: A page of models.

def log_record_to_dataset(self, dataset_id: str, data: dict, **kwargs):

Writes data to a dataset.

Inherited Members
superwise_api.entities.base.BaseApi
BaseApi
api_client
wrap_api_calls
raise_exception