Create dataset

for this example you need the following files:

CreateDataset.py

import os

from LOGS import LOGS
from LOGS.Entities import Dataset

# Connect to LOGS
logs = LOGS()

# In this example we assume that the file is next to the script itself
file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "logspy-logo.png")

# The dataset entity differs slightly from other entities as it has to be created
# based on datasets files. Though to create a dataset object we need to specify
# these files as a list and a specific format
dataset = Dataset(files=[file], format="image")

# Method is required. This example assigns the method with ID 7 to the dataset.
dataset.method = logs.method(7)

# Sample is not required, but it is recommended to assign a sample to the dataset.
# This example assigns the sample with ID 1 to the dataset.
dataset.sample = logs.sample(1)

# Project is not required, but it is recommended to assign the dataset to a project.
# This example assigns the project with ID 1 to the dataset.
# Please note, that a dataset can be assigned to multiple projects. That why a list
# has to be used for passing the project.
p = logs.project(1)
dataset.projects = [p]

# Create this datset in LOGS
logs.create(dataset)

dataset.printJson()