# MotherDuck

{% hint style="warning" %}
**IP RESTRICTIONS**

Make sure to allow traffic from one of the Paradime IPs in your firewall depending on the data location selected.

👉 See also: [Paradime IP addresses](https://docs.paradime.io/app-help/app-settings/ip-restrictions).
{% endhint %}

## Add Code IDE Connection <a href="#add-development-connection" id="add-development-connection"></a>

You will be prompted to add a Development connection during the onboarding, or you can add more connections by completing the following steps:

1. Click **Settings** in the top menu bar of the Paradime interface to access **Account Settings**
2. In the left sidebar, click "**Connections**"
3. Click "**Add New**" next to the Code IDE section
4. Select "MotherDuck"

## Configuration for a MotherDuck Connection <a href="#configuration-for-duckdb--motherduck" id="configuration-for-duckdb--motherduck"></a>

In the Development connection setup screen, you will need to fill in the form with the details of the connection you want to use to run dbt™️ models against a MotherDuck database.

In this example we are  connecting to `s3` to read/write `parquet` files using an AWS access key and secret, these secrets can be stored in the [user environment variable settings](https://docs.paradime.io/app-help/documentation/settings/environment-variables/code-ide-env-variables).&#x20;

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2FiO8obtX7kne7Z8GHFLd5%2FScreenshot%202024-07-29%20at%2022.01.07.png?alt=media&#x26;token=cd5e969e-044d-463b-8bc6-141bdfafeeac" alt="" width="563"><figcaption></figcaption></figure>

Below are list of fields and example to create a connection.

<table><thead><tr><th width="172">Field</th><th width="365">Description</th><th width="482">Example</th><th>Level<select><option value="68214e8af13b4195be9680e885fb53b6" label="🏢 Workspace level" color="blue"></option><option value="8d5e011bb33d4009b5d0ff39e2f65168" label="👥 User level" color="blue"></option></select></th></tr></thead><tbody><tr><td>Profile Name</td><td>The profile name set in your <code>dbt_project.yaml</code> . See more <a href="https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles">here</a>.</td><td><strong><code>dbt-motherduck</code></strong></td><td><span data-option="68214e8af13b4195be9680e885fb53b6">🏢 Workspace level</span></td></tr><tr><td>Target</td><td>The target name used to identify the connection. See more <a href="https://docs.getdbt.com/reference/dbt-jinja-functions/target">here</a>.</td><td><strong><code>dev</code></strong></td><td><span data-option="68214e8af13b4195be9680e885fb53b6">🏢 Workspace level</span></td></tr><tr><td>Profile Configuration</td><td><ul><li>Here is where you can define the path to the MotherDuck database where the dbt™️ will run.</li><li>Additionally you will be able to configure  any supported <a href="https://duckdb.org/docs/extensions/overview">DuckDB extensions</a> by listing them in the <code>extensions</code></li><li>You can also set any additional <a href="https://duckdb.org/docs/sql/configuration">DuckDB configuration options</a> via the <code>settings</code> field, including options that are supported in any loaded extensions.</li></ul></td><td><pre class="language-yaml"><code class="lang-yaml">      extensions:
      - httpfs
      - parquet
      path: md:jaffle_shop_dev
      settings:
        s3_access_key_id: '{{ env_var("S3_ACCESS_KEY_ID") }}'
        s3_region: '{{ env_var("S3_REGION", "us-west-1") }}'
        s3_secret_access_key: '{{ env_var("S3_SECRET_ACCESS_KEY") }}'
</code></pre></td><td><span data-option="8d5e011bb33d4009b5d0ff39e2f65168">👥 User level</span></td></tr><tr><td>MotherDuck access token</td><td>The MotherDuck service token for authentication, see more <a href="https://motherduck.com/docs/key-tasks/authenticating-to-motherduck/#authentication-using-an-access-token">here</a>.<br>This will be stored with the name <code>motherduck_token</code>in your <a href="../../environment-variables/code-ide-env-variables">user environment variables</a>.</td><td><code>eyJhb.....0LXgyJFE695yrZx40UhAOF9JIFX8jNLf1WOAPO42Q</code></td><td><span data-option="8d5e011bb33d4009b5d0ff39e2f65168">👥 User level</span></td></tr><tr><td>Schema</td><td>The default schema used to build dbt™️ objects at runtime.</td><td><strong><code>dbt_john</code></strong></td><td><span data-option="8d5e011bb33d4009b5d0ff39e2f65168">👥 User level</span></td></tr><tr><td>Threads</td><td>The number of threads used in this connection. See more <a href="https://docs.getdbt.com/docs/running-a-dbt-project/using-threads">here</a>.</td><td><strong><code>8</code></strong></td><td><span data-option="8d5e011bb33d4009b5d0ff39e2f65168">👥 User level</span></td></tr></tbody></table>

### Authenticating to MotherDuck

When using MotherDuck we will need to persist your MotherDuck service token for authentication.&#x20;

To create an access token:

* Go to the [MotherDuck UI](https://app.motherduck.com/)
* In top left click on organization name and then `Settings`
* Click `+ Create token`
* Specify a name for the token that you'll recognize (like "Paradime")
* Choose whether you want the token to expire and then click on `Create token`
* Copy the access token token to your clipboard by clicking on the copy icon

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2FR0TeQdBO93Tp4b4xmmaf%2Fimage.png?alt=media&#x26;token=b82d428f-70b0-4774-b281-c335cec0844c" alt=""><figcaption></figcaption></figure>

### Check you are able to connect to MotherDuck

To test you connection to MotherDuck:

1. To launch the DuckDB CLI and connect to MotherDuck using Paradime terminal by running the following command:

```bash
duckdb "md:"
```

2. Test your MotherDuck connection using the following command. It will run in the cloud to display a list of your MotherDuck databases.

```bash
show all databases;
```

{% @arcade/embed flowId="oVWeTMPMz2Zpp1JPpFPR" url="<https://app.arcade.software/share/oVWeTMPMz2Zpp1JPpFPR>" %}

{% hint style="info" %}
For additional supporting docs, check [MotherDuck Key Features](https://motherduck.com/docs/category/key-tasks),[ MotherDuck SQL reference](https://motherduck.com/docs/category/motherduck-sql-reference) and [DuckDB SQL reference](https://motherduck.com/docs/category/duckdb-sql-reference)
{% endhint %}

## Explore data in your  MotherDuck database from Paradime

Paradime integrates with Harlequin out of the box - no installation required. Check our integration guide on how you can query where you can query data directly from the Paradime Terminal.&#x20;

{% content-ref url="../../../integrations/code-ide/harlequin" %}
[harlequin](https://docs.paradime.io/app-help/documentation/integrations/code-ide/harlequin)
{% endcontent-ref %}


---

# 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.paradime.io/app-help/documentation/settings/connections/development-environment/motherduck.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.
