> ## 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, MotherDuck, and DuckLake**.

## 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/mZYKvkBoBjRf6Rhw/images/admin/bigquery_connection.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=8f10ea1ded204f4e63eae0a3174a97a0" alt="BigQuery Connection" style={{maxWidth: "100%", height: "auto"}} width="1870" height="1298" data-path="images/admin/bigquery_connection.png" />
  </Tab>

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

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

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

  <Tab title="Databricks">
    <img src="https://mintcdn.com/ms2/mZYKvkBoBjRf6Rhw/images/admin/databricks_connection.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=0badcd08ca2e7addde56c6e80e49528c" alt="Databricks Connection" style={{maxWidth: "100%", height: "auto"}} width="1870" height="1310" data-path="images/admin/databricks_connection.png" />

    **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/mZYKvkBoBjRf6Rhw/images/admin/mysql_connection.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=7d6263d3494a4afaf67658854b2acc6f" alt="MySQL Connection" style={{maxWidth: "100%", height: "auto"}} width="1870" height="1068" data-path="images/admin/mysql_connection.png" />
  </Tab>

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

    DuckDB runs in-process and can attach to external databases (PostgreSQL, BigQuery, Snowflake) and object storage (GCS, S3). With no attached databases it runs in standalone mode — useful for working with embedded data files (CSV, Parquet) included in your packages.
  </Tab>

  <Tab title="MotherDuck">
    <img src="https://mintcdn.com/ms2/mZYKvkBoBjRf6Rhw/images/admin/motherduck-connection.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=897d8f27e73a68a9b58de40c023e4c90" alt="MotherDuck Connection" style={{maxWidth: "100%", height: "auto"}} width="1870" height="872" 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>

  <Tab title="DuckLake">
    <img src="https://mintcdn.com/ms2/mZYKvkBoBjRf6Rhw/images/admin/ducklake_connection.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=e95c7daddc602ba7c04db09717577854" alt="DuckLake Connection" style={{maxWidth: "100%", height: "auto"}} width="1870" height="2250" data-path="images/admin/ducklake_connection.png" />

    DuckLake needs two backing connections: a **catalog** for metadata (currently PostgreSQL) and **storage** for data (S3 or GCS). Configure both, then test the connection.
  </Tab>
</Tabs>

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

### Configure Scope for AI-Assisted Modeling

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

<img src="https://mintcdn.com/ms2/mZYKvkBoBjRf6Rhw/images/quickstart/connection-scope.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=0e9ee82a2bc4f60270fc9b06cd86d9d4" alt="Configure scope - select tables for AI indexing" style={{maxWidth: "100%", height: "auto"}} width="1870" height="1456" 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/mZYKvkBoBjRf6Rhw/images/quickstart/connection-status.png?fit=max&auto=format&n=mZYKvkBoBjRf6Rhw&q=85&s=74ffa5f68dca70e6db3e87fd68cf4933" alt="Connection indexing status" style={{maxWidth: "100%", height: "auto"}} width="1870" height="1222" 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>
