Adding Datasets to a Project
To add an existing Dataset to a Project, use the <dataset_hash>.
You need to be an admin of the Datasets that you want to add.
Sample code
Example Output
from encord import EncordUserClient, Project
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
"<your_private_key>"
)
project: Project = user_client.get_project( "<project_hash>" )
success: bool = project.add_datasets(
[
"<dataset_hash1>" ,
"<dataset_hash2>" ,
# ...
]
)
print (success)
# True or False depending on whether job was successful
True
add_datasets() throws an error if it is unable to add a dataset to a project. See the doc-string documentation for further details.
Removing Datasets from a Project
You can remove existing Datasets from a Project, using the dataset <dataset_hash> for every Dataset that needs to be removed. To get those hashes, you can follow the example in Listing existing Datasets .
You need to be an admin of the datasets that you want to add.
from encord import EncordUserClient, Project
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
"<your_private_key>"
)
project: Project = user_client.get_project( "<project_hash>" )
success: bool = project.remove_datasets(
[
"<dataset_hash1>" ,
"<dataset_hash2>" ,
# ...
]
)
print (success)
# True or False depending on whether job was successful
True
remove_datasets() throws an error if it is unable to remove a dataset from a project. See the doc-string documentation for further details.