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

# Connect a Database

> Add secure, managed database connections to your environment

A **connection** is a secure, managed link to a database or warehouse. Connection configurations are stored in a Credible [environment](/how-to/modeling/environment-overview), and every package in that environment can use them. Credentials never leave the Credible service — all access, for modeling and for serving, is proxied through the platform, making Credible a secure perimeter around your databases.

Credible supports **BigQuery, Snowflake, PostgreSQL, Trino, Databricks, MySQL, DuckDB, and MotherDuck**.

## Prerequisites

* **Admin access** to an organization in the Credible platform, in order to create environments and connections. If you don't have it, ask your organization administrator to set up connections for you.

## Setup Process

### Credible App (Recommended)

1. **Access your organization** at `https://your-org.app.credibledata.com`
2. **Select your environment** from the left sidebar under **Packages & Connections**
3. **Click "+ Add Connection"** in the Connections section
4. **Choose your data source type** and fill in the connection details:

<Note>
  Connection names cannot contain spaces or hyphens. Use underscores instead
  (e.g., `my_connection`).
</Note>

<Tabs>
  <Tab title="BigQuery">
    <img src="https://mintcdn.com/ms2/mEb7Znd1qlLuHoHM/images/admin/bigquery_connection.png?fit=max&auto=format&n=mEb7Znd1qlLuHoHM&q=85&s=27a70426bde7cfb8e33aaec070642365" alt="BigQuery Connection" style={{maxWidth: "100%", height: "auto"}} width="2334" height="2194" data-path="images/admin/bigquery_connection.png" />
  </Tab>

  <Tab title="PostgreSQL">
    <img src="https://mintcdn.com/ms2/mEb7Znd1qlLuHoHM/images/admin/postgres_connection.png?fit=max&auto=format&n=mEb7Znd1qlLuHoHM&q=85&s=f7a28497f13a5079a53c1ab4becefd84" alt="PostgreSQL Connection" style={{maxWidth: "100%", height: "auto"}} width="2330" height="2538" data-path="images/admin/postgres_connection.png" />
  </Tab>

  <Tab title="Snowflake">
    <img src="https://mintcdn.com/ms2/WD04lKtUzS0jlfCI/images/admin/snowflake-connection-RSA.png?fit=max&auto=format&n=WD04lKtUzS0jlfCI&q=85&s=93ec828e3a1d40ea253fbe12e40f5b2e" alt="Snowflake Connection" style={{maxWidth: "100%", height: "auto"}} width="1610" height="2300" data-path="images/admin/snowflake-connection-RSA.png" />
  </Tab>

  <Tab title="Trino">
    <img src="https://mintcdn.com/ms2/NZ9XliY_RY423ine/images/admin/trino_connection.png?fit=max&auto=format&n=NZ9XliY_RY423ine&q=85&s=046d761134718e276c7b327d552e50df" alt="Trino Connection" style={{maxWidth: "100%", height: "auto"}} width="1630" height="1996" data-path="images/admin/trino_connection.png" />
  </Tab>

  <Tab title="Databricks">
    **Required:**

    * Connection name
    * Host (e.g., `dbc-xxxxxxxx-xxxx.cloud.databricks.com`)
    * HTTP Path (e.g., `/sql/1.0/warehouses/<warehouse-id>`)
    * Default Catalog (e.g., `main`)

    **Authentication (choose one):**

    * **Personal Access Token** - paste a Databricks PAT
    * **OAuth M2M** - service principal Client ID + Client Secret

    **Optional:**

    * Default Schema (e.g., `default`)

    See the [Databricks connection reference](/reference/connections/databricks) for details on creating a SQL warehouse, generating a PAT, or configuring an OAuth M2M service principal.
  </Tab>

  <Tab title="MySQL">
    <img src="https://mintcdn.com/ms2/NZ9XliY_RY423ine/images/admin/mysql_connection.png?fit=max&auto=format&n=NZ9XliY_RY423ine&q=85&s=85dfb97947ef0818be141eeafa8542e0" alt="MySQL Connection" style={{maxWidth: "100%", height: "auto"}} width="1622" height="1660" data-path="images/admin/mysql_connection.png" />
  </Tab>

  <Tab title="DuckDB">
    <img src="https://mintcdn.com/ms2/WD04lKtUzS0jlfCI/images/admin/duckdb-connection.png?fit=max&auto=format&n=WD04lKtUzS0jlfCI&q=85&s=332d45421bf537563cb090830a22c0e5" alt="DuckDB Connection" style={{maxWidth: "100%", height: "auto"}} width="1608" height="1432" data-path="images/admin/duckdb-connection.png" />

    DuckDB connections use an in-process database engine. This is useful for working with embedded data files (CSV, Parquet) included in your packages.
  </Tab>

  <Tab title="MotherDuck">
    <img src="https://mintcdn.com/ms2/WD04lKtUzS0jlfCI/images/admin/motherduck-connection.png?fit=max&auto=format&n=WD04lKtUzS0jlfCI&q=85&s=ce98cd5e991978e4409c90df4dd00300" alt="MotherDuck Connection" style={{maxWidth: "100%", height: "auto"}} width="1610" height="1020" data-path="images/admin/motherduck-connection.png" />

    MotherDuck is a serverless cloud analytics platform built on DuckDB. Get your access token from your [MotherDuck account settings](https://app.motherduck.com/).
  </Tab>
</Tabs>

5. **Test the connection**
6. Click **Next: Configure Scope**

<img src="https://mintcdn.com/ms2/hbN0V7V2tgDWdpis/images/quickstart/connection-detail.png?fit=max&auto=format&n=hbN0V7V2tgDWdpis&q=85&s=45bb436c92d76420b807d73fb49adadb" alt="Connection details - step 1 of the connection wizard" style={{maxWidth: "100%", height: "auto"}} width="1620" height="1588" data-path="images/quickstart/connection-detail.png" />

### Configure Scope for AI-Assisted Modeling

Next, select which schemas and tables to index for AI-assisted modeling:

<img src="https://mintcdn.com/ms2/hbN0V7V2tgDWdpis/images/quickstart/connection-scope.png?fit=max&auto=format&n=hbN0V7V2tgDWdpis&q=85&s=a866aeb5dd3afc3e6d60425387b6f249" alt="Configure scope - select tables for AI indexing" style={{maxWidth: "100%", height: "auto"}} width="1642" height="1856" data-path="images/quickstart/connection-scope.png" />

* Browse schemas on the left, select tables on the right
* Use **Select All** to include all tables in a schema, or pick individual tables
* Check **"Do not include any tables for AI-assisted modeling"** if you only need the connection for manual queries

<Note>
  These indexing limits apply to AI-assisted model creation:

  * **100 tables per schema** for metadata indexing
  * **25 tables or fewer** for automated join inference

  You can manually write Malloy models for any size dataset. Published models are indexed separately for analysis.
</Note>

Click **Update Connection** to save. You'll see an indexing status page confirming the connection is being indexed:

<img src="https://mintcdn.com/ms2/hbN0V7V2tgDWdpis/images/quickstart/connection-status.png?fit=max&auto=format&n=hbN0V7V2tgDWdpis&q=85&s=883ab57d04654a9a7adf20aad28d2b37" alt="Connection indexing status" style={{maxWidth: "100%", height: "auto"}} width="1684" height="1008" data-path="images/quickstart/connection-status.png" />

### CLI Option

Use the Credible command-line tool for programmatic connection management and automation.

1. **Install the CLI**:

   ```bash theme={"languages":{"custom":["/languages/motly.tmGrammar.json","/languages/malloy.tmGrammar.json"]}}
   npm i -g @credibledata/cred-cli
   ```

2. **Login to your organization**:

   ```bash theme={"languages":{"custom":["/languages/motly.tmGrammar.json","/languages/malloy.tmGrammar.json"]}}
   cred login <organizationName>
   ```

3. **Add a connection**:

   ```bash theme={"languages":{"custom":["/languages/motly.tmGrammar.json","/languages/malloy.tmGrammar.json"]}}
   cred add connection <connectionFileName>
   ```

   The connection file should be a JSON file containing an array of connection objects. See the [CLI reference](/platform-admin/cli) for detailed connection file formats and examples.

4. **Configure scope** (optional): Control which tables are indexed for AI-assisted modeling with scope flags on `cred add connection`. Tables are referenced as `{dataset/schema}.{table}`, and `*` matches all tables in a schema:

   ```bash theme={"languages":{"custom":["/languages/motly.tmGrammar.json","/languages/malloy.tmGrammar.json"]}}
   # Index only the sales schema and one finance table
   cred add connection connections.json --include-tables "sales.*,finance.orders"

   # Index everything except temporary and backup data
   cred add connection connections.json --exclude-tables "temp_data.*,backup.records"

   # Create the connection without indexing any tables
   cred add connection connections.json --skip-indexing
   ```

   `--include-tables` and `--exclude-tables` are mutually exclusive (and cannot be combined with `--skip-indexing`).

<Note>
  Scope flags apply at connection creation. To change the scope of an existing connection, edit it in the Credible App (see [Configure Scope](#configure-scope-for-ai-assisted-modeling) above).
</Note>

## Next Steps

With your data connected, pick how you want to build models:

<CardGroup cols={2}>
  <Card title="Build & Publish" icon="sparkles" color="#5C7A93" href="/how-to/modeling/in-app-development">
    Build models with the agent in your browser — no setup, recommended to start
  </Card>

  <Card title="Developer Overview" icon="laptop-code" color="#5C7A93" href="/how-to/developers/overview">
    Build in your IDE with your preferred coding agent
  </Card>
</CardGroup>
