Skip to main content
Use this tutorial when you want to automate common Dataerai work from Python.
See Tools sandbox for a ready-to-run environment, or use the Python SDK reference to install the SDK locally.

What the SDK is

The Dataerai Python SDK helps scripts and notebooks do the same file-transfer work you do in the web app. You’ll use it to:
  • Check who you are signed in as.
  • Upload a file with progress.
  • Read and update metadata.
  • Download the file again.
  • Confirm the round trip worked.
Best fit:
  • Large files.
  • Repeated uploads or downloads.
  • Notebooks and automation.
Not covered by the SDK:
  • Browsing the full workspace.
  • Sharing and permissions.
  • Search.
  • Project creation.
This tutorial creates a project first, then uses the SDK for the transfer work.
Project creation has no SDK method. The setup code uses a plain requests session against the public REST API: the same call the web app’s New project button makes.
Authenticate the CLI once with dataerai auth login. The SDK has no email/password parameters; auth_status() reports the signed-in email and token expiry. Use the public REST API with an access token for setup calls the SDK does not cover.

1. Connect & authenticate

Open a client connection and confirm who you’re signed in as. The SDK reports the same identity the web app shows in the user account menu. In the app
  1. Go to your Dataerai site and sign in with your email/password account or Globus.
  2. You land on Home, the workspace root listing your projects. Your signed-in identity lives behind the user account menu, top-right (see Account & profile).
From code Run dataerai auth login once at a terminal first (device-flow login), then:

Set up: create a project & sample file (from code)

Create the upload target first, then write a small CSV to upload. Set DATAERAI_SERVER to your Dataerai site and DATAERAI_TOKEN to an access token for your account.
The setup uses the public REST API because project creation has no SDK method. It calls the same POST /api/projects/ action as the web app’s New project button.
In the app
  1. On Home, click the New project button in the header.
  2. Give the project a name and confirm — it appears in the Home list.
From code

2. Upload with live progress

Upload the file into the project. The client streams progress events to your on_progress callback; upload() blocks until the transfer finishes and returns an UploadResult carrying the new asset_id. In the app
  1. Open the project and click Upload in the header.
  2. In the dialog, Select files or select a directory (or drag-and-drop), then confirm.
  3. Watch the Transfer tracker (top bar, Open transfer tracker) for the live progress bar — the UI counterpart to the on_progress callback.
These dialogs are shown in Uploading & transfers: The Upload dialog — the UI counterpart to client.upload() The Transfer tracker — the UI counterpart to the on_progress callback From code

3. Read & update metadata

Read the asset’s current metadata, then update its title and tags. get_metadata() and set_metadata() operate on the same fields as the UI: title, description, alias, tags, and the free-form metadata dict. In the app
  1. Open the project and single-click the asset row to open the right-hand detail sidebar.
  2. Edit Title, Tags, and Description in the overview panel (editing is gated by the write metadata permission, so you’ll see the controls only when you can edit).
The asset detail sidebar — the UI counterpart to client.set_metadata() Describing and tagging data is covered in depth in Describe & organize. From code

4. Download & verify

Download the asset’s content back to a local directory to confirm a clean round-trip. By default the client fetches the latest content version (pass content_id= for a specific one); partial downloads resume automatically. client.close() closes the client connection. In the app
  1. Open the asset and use its download action; the transfer again appears in the Transfer tracker.
From code

See it in the workspace

Assets you create from code appear in the web workspace immediately — same data, two interfaces. Open Home and you’ll see the SDK-created project and asset listed alongside everything else. Your data in the Dataerai workspace

Next steps