> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encord.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Attaching and Removing Datasets

## Adding Datasets to a Project

To add an existing Dataset to a Project, use the \<dataset\_hash>.

<Note>You need to be an admin of the Datasets that you want to add.</Note>

<CodeGroup>
  ```python Sample code theme={"dark"}

  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)
  ```

  ```python Example Output theme={"dark"}
  # True or False depending on whether job was successful
  True  
  ```
</CodeGroup>

<Note>[`add_datasets()`](/sdk-documentation/sdk-references/project#add-datasets) throws an error if it is unable to add a dataset to a project. See the doc-string documentation for further details.</Note>

### 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](/sdk-documentation/datasets-sdk/sdk-create-and-view-datasets#list-existing-datasets).

<Note>You need to be an admin of the datasets that you want to add.</Note>

<CodeGroup>
  ```python theme={"dark"}

  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)

  ```

  ```python Example output theme={"dark"}
  # True or False depending on whether job was successful
  True
  ```
</CodeGroup>

<Note>[`remove_datasets()`](/sdk-documentation/sdk-references/project#remove-datasets) throws an error if it is unable to remove a dataset from a project. See the doc-string documentation for further details.</Note>
