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

# Monte Carlo

> Connect Monte Carlo to Paradime so Bolt uploads your dbt™ run artifacts to Monte Carlo, overlaying dbt™ context onto its lineage and observability.

[Monte Carlo](https://www.montecarlodata.com/) is a data observability platform that helps data teams monitor, resolve, and prevent data quality issues. Connecting Monte Carlo to Paradime lets Bolt upload your dbt™ run artifacts to Monte Carlo, overlaying dbt™ context onto its lineage graph and centralizing observability of your production jobs and dbt™ models.

## What you can do

<CardGroup cols={2}>
  <Card title="Orchestration" icon="rotate" href="/products/bolt/creating-schedules/command-settings/monte-carlo-commands">
    Upload dbt™ run artifacts to Monte Carlo from a Bolt schedule or the CLI, so model runs, test results, and lineage stay in sync with your observability platform.
  </Card>
</CardGroup>

Once connected, upload dbt™ artifacts to Monte Carlo from either surface:

| Surface       | Where                                                                                           |
| ------------- | ----------------------------------------------------------------------------------------------- |
| Bolt schedule | [Monte Carlo commands](/products/bolt/creating-schedules/command-settings/monte-carlo-commands) |
| CLI           | [`paradime bolt` Monte Carlo CLI](/developers/paradime-cli/montecarlo-cli)                      |

Key benefits include:

* **Enhanced Observability**: Overlay dbt™ context onto Monte Carlo's lineage graph for easier troubleshooting.
* **Incident Detection**: Detect and centralize dbt™ model errors, test failures, and other data incidents in one place.
* **Run Insights**: Visualize dbt™ job execution times, success/error statuses, and run histories.
* **Simplified Impact Analysis**: Evaluate downstream and upstream impacts of dbt™ transformations on table updates.

## Setting Up the Integration

Follow these steps to configure the Monte Carlo integration within Paradime.

### Step 1: Generate API Key and API ID

1. Log in to your Monte Carlo account.
2. Follow the instructions in [Monte Carlo Docs](https://docs.getmontecarlo.com/docs/developer-resources#creating-an-api-key) to generate:
   * **API Key**
   * **API ID**

<Info>
  The key is required to be generated with the "Editor" or "Owner" roles, for example if you create a Service Account Key you need to select "Editors" or "Account Owners" under "Authorization Groups".

  If you're using a personal key, the user that generated it needs to be an "Editor" or "Owner".
</Info>

### Step 2: Add API Credentials to Paradime

1. From the Paradime home page, click the Settings icon (⚙️) on the bottom right hand side of the screen
2. Navigate to *Workspaces >* [*Environment Variables*](/products/settings/environment-variables/bolt-schedule-env-variables)
3. In the Bolt Schedules section, add the following variables and their respective values from Step 1:
   * `MCD_DEFAULT_API_TOKEN`
   * `MCD_DEFAULT_API_ID`
4. Click the Save icon (💾)

### Step 3: Set Your Project Name

* In the same Bolt Schedules section, add:
  * `MONTECARLO_PROJECT_NAME`
* Set a value for the project name

<Info>
  You can reuse [your existing dbt project name](/guides/dbt-fundamentals/configuring-your-dbt-project/setting-up-your-dbt_project.yml#project-name-and-version) or create any name that aligns with your dbt models.
</Info>

### Step 4: Obtain the Connection ID

The **Connection ID** identifies the warehouse or lake connection in Monte Carlo. You can do this by retrieving the connection UUID via the [getUser](https://apidocs.getmontecarlo.com/#query-getUser) API through the [API Explorer](https://docs.getmontecarlo.com/docs/api-explorer) by running the below query.

<Tabs>
  <Tab title="Example Query">
    ```graphql theme={"system"}
    query getConnections {
      getUser {
        email
        account {
          connections {
            uuid
            type
            warehouse {
              name
            }
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Example response">
    ```json theme={"system"}
    {
    	"data": {
    		"getUser": {
    			"email": "example@montecarlodata.com",
    			"account": {
    				"connections": [{
    					"uuid": "9b265c4d-931f-4584-99c6-42ea37155a99",
    					"type": "SNOWFLAKE",
    					"warehouse": {
    						"name": "snowflake-artemis"
    					}
    				}]
    			}
    		}
    	}
    }
    ```
  </Tab>
</Tabs>

If you prefer you can also use the [list](https://clidocs.getmontecarlo.com/#montecarlo-integrations-list) command in the Monte Carlo CLI to retrieve your connection ID (UUID).

```markdown theme={"system"}
% montecarlo integrations list
╒════════════════════════╤══════════════════╤══════════════════════════════════════╤═════════════════════════════════════════════════════════╕
│ Integration            │ Name             │ ID                                   │ Connection           │ Created on (UTC)                 │
╞════════════════════════╪══════════════════╪══════════════════════════════════════╪══════════════════════╪══════════════════════════════════╡
│ Redshift               │ prod-redshift    │ 12345678-1234-1234-1234-123456789012 │ host: redacted       │ 2022-12-14T14:54:15.944774+00:00 │
├────────────────────────┼──────────────────┼──────────────────────────────────────┼──────────────────────┼──────────────────────────────────┤
│ BigQuery               │ prod-bigquery    │ 12345678-1234-1234-1234-123456789013 │ client_id: redacted  │ 2022-12-14T18:02:54.644654+00:00 │
╘════════════════════════╧══════════════════╧══════════════════════════════════════╧══════════════════════╧══════════════════════════════════╛
```

### Step 5: Add the Connection ID

1. Copy the **Connection ID** from the logs.
2. Go back to the [**Environment Variables**](/products/settings/environment-variables/bolt-schedule-env-variables) section in Paradime.
3. Add the following variable:
   * `MONTECARLO_CONNECTION_ID`
4. Click **Save** to confirm.

### Step 6: Enable the Integration

<Info>
  This Flag will enable uploading automatically all schedules dbt run artifacts to Montecarlo.
</Info>

1. In the same [**Environment Variables**](/products/settings/environment-variables/bolt-schedule-env-variables) section, add the following variable:
   * `RUN_MONTECARLO_UPLOAD`
2. Set its value to `TRUE`.

By the end of this step, your Monte Carlo environment variables should include:

<Frame>
  <img src="https://mintcdn.com/paradime-docs/0NDrELNNK4-2tLpg/images/monte_Carlo_env_variables.png?fit=max&auto=format&n=0NDrELNNK4-2tLpg&q=85&s=6061f516fcd7a58239180ba8aa74e3da" alt="Monte Carlo environment variables in Paradime" width="1200" height="424" data-path="images/monte_Carlo_env_variables.png" />
</Frame>

## Connection parameters

Set the following environment variables in your Paradime Workspace Settings > Environment Variables, in the Bolt Schedules section.

| Variable                   | Required | Description                                              |
| -------------------------- | -------- | -------------------------------------------------------- |
| `MCD_DEFAULT_API_TOKEN`    | ✅        | The Monte Carlo API Key generated in Step 1              |
| `MCD_DEFAULT_API_ID`       | ✅        | The Monte Carlo API ID generated in Step 1               |
| `MONTECARLO_PROJECT_NAME`  | ✅        | A project name that aligns with your dbt™ models         |
| `MONTECARLO_CONNECTION_ID` | ✅        | The warehouse or lake connection UUID from Monte Carlo   |
| `RUN_MONTECARLO_UPLOAD`    | ✅        | Set to `TRUE` to upload dbt™ run artifacts automatically |

## Testing the Integration

To verify the integration, run the following steps in Paradime's Bolt:

1. Trigger a Run for one of you Bolt schedule which which contains either `dbt build`, `dbt run` or `dbt test` command.
2. Verify the results in Monte Carlo:
   * Check the **lineage graph** for updated dbt™ context.

<Frame>
  <img src="https://mintcdn.com/paradime-docs/KJcB9NhKTmxLMoZP/images/image-122.png?fit=max&auto=format&n=KJcB9NhKTmxLMoZP&q=85&s=7ec4d9b3563fffa8ea0f0e811c7cc1a0" alt="Monte Carlo lineage graph with dbt context" width="2470" height="1110" data-path="images/image-122.png" />
</Frame>

* View job statuses, model run results, and test outcomes.

<Frame>
  <img src="https://mintcdn.com/paradime-docs/KJcB9NhKTmxLMoZP/images/image-123.png?fit=max&auto=format&n=KJcB9NhKTmxLMoZP&q=85&s=1300bc27225490ad082a778c29a3ae0f" alt="Monte Carlo job statuses and run results" width="2840" height="1458" data-path="images/image-123.png" />
</Frame>

<Info>
  For more details on the logs that Montecarlo will ingest check the [Montecarlo dbt integration documentation](https://docs.getmontecarlo.com/docs/dbt-integration).
</Info>


## Related topics

- [Monte Carlo CLI](/developers/paradime-cli/montecarlo-cli.md)
- [Run MonteCarlo CLI](/products/bolt/creating-schedules/command-settings/monte-carlo-commands.md)
- [Integrations](/integrations/index.md)
- [Commands](/products/bolt/creating-schedules/command-settings/index.md)
