Uploading and Downloading Files

Uploading and Downloading Files#

Uploading a File#

Usage notes:

  • Currently, only parquet files are supported. Snappy compression is supported.

  • You can only upload one file at a time via the API. You must make multiple requests to upload multiple files. The Python SDK supports uploading multiple files at once.

  • All files must have the same schema. Files with schemas that do not match will be rejected.

  • Names must be unique. If you upload a file with a name that already exists in the dataset, it will be rejected.

  • When you upload to a dataset, the ordering will be preserved. If you upload multiple files to a dataset, they will be added to the dataset in the order you provide them.

POST https://api.sutro.sh/upload-to-dataset#

Upload a file to a dataset.

Request Headers:
Request JSON Object:
  • dataset_id (str) – The ID of the dataset to upload the file to.

  • file (str) – The file to upload.

Returns:

A JSON object containing the file ID.

Downloading a File#

Usage notes:

  • You can only download one file at a time via the API. You must make multiple requests to download multiple files. The Python SDK supports downloading multiple files at once.

  • The file will be returned as bytes. You will need to decode the bytes and save them to a file.

  • The dataset stores files in the order they were uploaded. You can view the ordering of files using the list-dataset-files endpoint.

POST https://api.sutro.sh/download-from-dataset#

Download a file from a dataset.

Request Headers:
Request JSON Object:
  • dataset_id (str) – The ID of the dataset to download the file from.

  • file_name (str) – The name of the file to download.

Returns:

If successful, the file, as bytes. Otherwise, a JSON object containing an error message.