sarus.Client

class sarus.Client(url: str = 'http://0.0.0.0/gateway', google_login: bool = False, email: str | None = None, password: str | None = None, verbose: int = 1)

Entry point for the Sarus API client.

dataset(slugname: str | None = None, id: int | None = None) Dataset[RecordBatch]

Select a dataset from the Sarus Gateway.

Either slugname or id should be provided. If both are provided, then only the slugname is considered.

Parameters:
  • slugname (str) – the slugname of the Dataset to select.

  • id (int) – the id of the Dataset to select.

Returns:

The selected Sarus dataset.

Return type:

Dataset

list_datasets() DatasetList

List available Sarus datasets.

Returns:

List of available Sarus datasets.

Return type:

DatasetList

load(path=None, uuid=None, to_dataset: bool = False) DataSpecWrapper

Load a sarus object from a path.

Parameters:

path (str) – The file path to load the sarus object from.

Returns:

The sarus object (eg: DataFrame,model..).

Return type:

DataSpecWrapper

query(query: str, target_epsilon: float | None = None, verbose: bool = True, use_old_query=False, debug=False) int

Execute a SQL query.

Parameters:
  • query (String) – SQL query

  • target_epsilon (Optional[float]) – Maximum privacy budget (epsilon) to assign to the query. If 0, runs on the synthetic data. If >0, result is a combination of a query on the synthetic data and a Differentially-Private query on the real data. If None, a default target epsilon specific to the current user and access rule is used. Default target epsilon is 0 if the access is a Differentially-Private access with per-user or per-group limit; default value equals to per-query limit if the access is a Differentially-Private access with a per-query limit only. Meaning Sarus maximizes result accuracy in the given privacy constraints. See user documentation to know more.

  • use_old_query (bool) – Whether to use the v1 version of the query task.

  • debug (bool) – Print the remote traceback if available

Returns:

Id of the task.

Return type:

int

save(wrapper: DataSpecWrapper, path: str) None

Save the representation of a sarus object to a file.

Parameters:
  • wrapper (DataSpecWrapper) – The sarus object to save.

  • path (str) – The path to save the object to.

Returns:

None