Create a dataset
An SDK how-to guide. SDK power-users can refer to our full SDK docs generated from our source code here
To create a new dataset, use the create_dataset()
method:
from darwin.client import Client
team_slug = "team_slug"
client = Client.local(team_slug="team_slug")
dataset_slug = "your_dataset_name"
dataset = client.create_dataset(dataset_slug)
You'll be able to refresh the Datasets page in V7, and see if your new dataset has been created.
If the dataset you're trying to create has the same name as an existing dataset in V7, you can import files to that dataset instead using the following logic with the get_remote_dataset()
method:
from darwin.client import Client
import darwin
team_slug = "team_slug"
client = Client.local(team_slug="team_slug")
dataset_slug = "your_dataset_name"
dataset_identifier = f"{client.default_team}/{dataset_slug}"
try:
dataset = client.create_dataset(dataset_slug)
except darwin.exceptions.NameTaken:
dataset = client.get_remote_dataset(dataset_identifier)
Updated 5 months ago
Next up