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

# Connect to Palantir Foundry

Learn how to connect to [Palantir Foundry](https://www.palantir.com/platforms/foundry/) from Domino. You must have network connectivity between Palantir and your Domino deployment.

## Create a Palantir Foundry Data Source

The easiest and most secure way to connect to Palantir from Domino is to have your administrator [create a Data Source for Palantir Foundry](/cloud/admin/data-administration/external-data/config-starburst-data-sources#create-a-palantir-data-source) for users to access.

After your administrator has created the Data Source, you can [use the Data Source](/cloud/platform-capabilities/core-concepts/data/data-source-connectors/use-data-sources) as usual.

<Note>
  You must specify the dataset path, obtained from the [Dataset Preview](https://www.palantir.com/docs/foundry/data-integration/dataset-preview/index.html) in Palantir, in your query as shown in this example:

  ```python theme={null}
  res =  ds.query('SELECT * FROM "/namespace/project"."/namespace/project/path/to/your/dataset"')
  ```
</Note>

## Connect using individual user credentials

You can also choose to use individual user credentials to connect to Palantir. However, you should contact your Palantir admin to ensure this method is compliant with your organization’s governance policies.

To connect to Palantir Foundry using this method, you must have the following:

* A Palantir Foundry account.

* An access token.

* A path to the Dataset.

### Create an access token

1. Sign in to Palantir Foundry.

2. In the Foundry sidebar, click **Account** and select **Settings**.

3. Under **User settings**, click **Tokens**.

   <img src="https://mintcdn.com/dominodatalab-e871cec4/iKtTg_TEyb2C09Em/images/palantir-datasets/domino-user-tokens.png?fit=max&auto=format&n=iKtTg_TEyb2C09Em&q=85&s=d1805596ef13d7b4e7e964ad6d8e88fe" alt="Palantir UI on the Tokens page" width="836" height="456" data-path="images/palantir-datasets/domino-user-tokens.png" />

4. Click **Create token**.

5. Copy the user token and save the token string. You can store it as an environment variable in Domino.

### Copy the dataset path

1. In the Palantir Foundry application, go to the **Project** containing the dataset and select the dataset.

2. In the **About** section, copy the **Location** attribute.

   <Tip>
     You can also copy and use the **RID** field as a permalink to this dataset.
   </Tip>

3. Save the location path or RID string to store as an environment variable in Domino.

### Add environment variables to Domino

You can store your Palantir connection information securely in Domino as environment variables in your user or project settings.

1. Sign in to Domino.

2. Click **User** or **Project** settings.

3. Click **Environment Variables**.

4. Add the `PALANTIR_TOKEN` environment variable with the value of the user token you created in Foundry.

5. Add the `PALANTIR_HOSTNAME` environment variable with the value of your Foundry instance hostname.

See [Store Project credentials](/cloud/platform-capabilities/core-concepts/projects/configure-projects/store-project-credentials) to learn more about Domino environment variables.

### Add the Palantir-SDK package to your environment

Some Domino Workspace Environments have the `palantir-sdk` package installed by default. You can also add Dockerfile commands to the environment definition to add packages:

```shell theme={null}
RUN pip install -user palantir-sdk
```

You can also create a cell at the top of a Jupyter Notebook and run the following:

```shell theme={null}
pip install palantir-sdk
```

### Run your code

You can now access your Palantir Foundry data through Python, from a Jupyter notebook or VS Code.

<img src="https://mintcdn.com/dominodatalab-e871cec4/iKtTg_TEyb2C09Em/images/palantir-datasets/palantir-connection-in-jupyter.png?fit=max&auto=format&n=iKtTg_TEyb2C09Em&q=85&s=1f0d7e42d46da4492b8a7af03ed52c93" alt="Jupyter notebook accessing a Palantir dataset and using the Palantir SDK" width="1027" height="676" data-path="images/palantir-datasets/palantir-connection-in-jupyter.png" />

## Next steps

* After connecting to your Data Source, learn how to [Use Data Sources](/cloud/platform-capabilities/core-concepts/data/data-source-connectors/use-data-sources).

* [Share this Data Source](/cloud/platform-capabilities/core-concepts/data/sharing-and-security/share-data-sources) with your collaborators.
