Data Collections#
You can interact with the Data Collections through the API.
Basic operations#
Listing Data Collections#
data_collections = client.list_data_collections(as_type="objects")
# Returns a list of DSSDataCollection
for data_collection in data_collections:
settings = data_collection.get_settings()
# Access to main information in the Data Collection
print("Data Collection id: %s" % settings.id)
print("Display name: %s" % settings.display_name)
print("Description: %s" % settings.description)
print("Color: %s" % settings.color)
print("Tags: %s" % settings.tags)
print("Permissions: %s" % settings.permissions)
# You can also list the objects in a Data Collection
print("Content: %s" % data_collection.list_objects(as_type='dict'))
Modifying Data Collection#
data_collection = client.get_data_collection("someDcId")
settings = data_collection.get_settings()
settings.display_name = "new name"
settings.permissions = [*settings.permissions, DSSDataCollectionPermissionItem.reader_user("LOGIN"), DSSDataCollectionPermissionItem.contributor_group("GROUP")]
settings.save()
Creating a Data Collection#
data_collection = client.create_data_collection("The name of the collection", description="Description *markdown is allowed*")
# returns a DSSDataCollection that can be used for adding objects
Deleting a Data Collection#
data_collection = client.get_data_collection("someDcId")
data_collection.delete()
Adding and deleting the objects in a Data Collection#
data_collection = client.get_data_collection("someDcId")
data_collection_objects = data_collection.list_objects()
# remove all contained objects
for data_collection_object in data_collection_objects:
data_collection_object.remove()
# add a dataset
data_collection.add_object(client.get_project("PROJECT_KEY").get_dataset("DATASET_NAME"))
Reference documentation#
A handle to interact with a Data Collection on the DSS instance. |
|
|
An item in a list of Data Collections. |
|
A handle on the settings of a Data Collection |
|
|
A handle on an object inside a Data Collection |