# dbt Cloud

## 1. Setup a dbt Cloud Custom Job <a href="#dbt-cloud-custom-job" id="dbt-cloud-custom-job"></a>

Create a new DBT Job:

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-8f8724a96cc166bc8e483d1c4a0f30f64516eabf%2FScreen%20Recording%202022-05-13%20at%201.34.16%20PM.gif?alt=media)

Set it up with the following settings:

* Select the environment
* Select `Generate Docs`
* add a command `dbt compile --full-refresh`

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-66218ce66650bfa3ec643f30a15981b1dd5a4467%2Fimage.png?alt=media)

Schedule, select every day at exactly hour 4. This will run the job before we run our ingestion, so your data source is always up to date.

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-b2654ad56eeb502fffb55af6c424ce77ae91957a%2Fimage.png?alt=media)

Finally, don't forget to save!

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-d5035b1264e0a3175f57915ccd8083e5d87aed70%2Fimage.png?alt=media)

You should now see a page like this:

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-c00a9a66c6ab923922694ee9cc92481ea5f86cc9%2Fimage.png?alt=media)

To get your job id, check the URL, you should see something like this:

> [https://cloud.getdbt.com/#/accounts/\<account-id>/projects/\<project-id>/jobs/\<job-id>/](https://cloud.getdbt.com/#/accounts/43365/projects/69225/jobs/76899/)

the job id is the last number in the URL.

{% hint style="info" %}
This job needs to run at least once successfully in order for Select Star to be able to process your dbt project.
{% endhint %}

### a. Running your new job

Click the Green `Run now` button in the top right corner

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-6aa6e46ef0f6e2a9572588b6bcea6e16c86f4893%2Fimage%20\(5\)%20\(2\)%20\(2\).png?alt=media)

Click on the new run generated in the list below:

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-e24756b47a1fcbb63ab9268cbef15a7b580c23b5%2Fimage.png?alt=media)

You should see the following screen:

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-1d63b21d32cf2fa7143a5a546f54415abc9b37bc%2Fimage.png?alt=media)

Wait until that grey `Running` status in the top left corner changes to a green `Success` status:

![](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-6e39046cdb48ac56337465a48f6769c4a7c30993%2Fimage.png?alt=media)

Once the run finishes successfully, you can go to Select Star to add your dbt data source.

## 2. Add dbt Cloud to Select Star

From your +Add Data Source, select `dbt Cloud` in the `dbt Type` drop down

![Select dbt Cloud in the dbt Type drop down](https://3470314135-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgAiVthA_yg9UXKuhyY%2Fuploads%2Fgit-blob-d87aedef3be509538f1f10aa2e3fd936d4d2c88b%2FScreenshot%202024-04-11%20at%2010.11.47.png?alt=media)

Provide your service token and job id (see [#dbt-cloud-custom-job](#dbt-cloud-custom-job "mention") for setting up your custom job and getting it's Job Id).

#### Data Source Options <a href="#dsoptions" id="dsoptions"></a>

* **Display Name:** This value is `dbt` by default, but you can override it if desired.
* **Data Source:** Select one of your existing warehouse data sources to connect to (i.e. Snowflake, BigQuery, Redshift).
  * Note: if you don't have any other data source, you'll need to select the SQL dialect according to which data warehouse you use (i.e. Snowflake, BigQuery, Redshift). This will be labelled as **Dialect** instead of **Data Source**.
* **API Key:** You may either use a ...
  * dbt [service token](https://docs.getdbt.com/docs/dbt-cloud/dbt-cloud-api/service-tokens) (preferred)
    * Permissions: we need the **Metadata Only** and **Read Only** permission for the projects that you are connecting
    * For enterprise customers of dbt, we need [**Job Viewer**](https://docs.getdbt.com/docs/collaborate/manage-access/enterprise-permissions#job-viewer) and [**Account View**](https://docs.getdbt.com/docs/collaborate/manage-access/enterprise-permissions#account-viewer) permissions.
  * dbt [user token](https://docs.getdbt.com/docs/dbt-cloud/dbt-cloud-api/user-tokens)
* **Job Id:** The id for the custom job which will generate the dbt metadata needed for ingestion
* **Access URL**: The [URL for your account ](https://docs.getdbt.com/docs/cloud/about-cloud/access-regions-ip-addresses#accessing-your-account)(given by dbt, based on your region, tenancy and plan). For most accounts this will be the default <https://cloud.getdbt.com>, which can be updated if needed.

Click the **Connect** button at the bottom of the **Add Data Source** modal.

Your metadata should start loading automatically. When the sync is complete, we'll email you and you'll be able to explore dbt in Select Star!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.selectstar.com/integrations/dbt/dbt-cloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
