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

# Connect a data source

> Add a read-only connection to PostgreSQL, Supabase, MySQL, Snowflake, Databricks or BigQuery.

Matys answers from the databases and warehouses you connect. It reads each one's schema so it knows which tables and columns exist.

Matys only runs read-only queries on your data sources. A query that tries to change data is refused.

> [!NOTE]
>
> Only admins can add, edit or remove data sources. Members use the data sources an admin opened to
> them.

## Supported data sources

| Type | What you need |
| - | - |
| PostgreSQL | Connection URL or credentials |
| Supabase | Pooler connection URL |
| MySQL | Host, port and credentials |
| Snowflake | Account and key pair |
| Databricks | Workspace and access token |
| Google BigQuery | Service account key |

> [!TIP]
>
> Create a dedicated user or service account with read-only access for Matys. Don't reuse a personal
> login.

## Add a data source

**1. Open Data sources**

Select **Data sources** in the sidebar, then **Add data source**. You can also press&#x20;
<kbd>S</kbd> anywhere in the app. Only admins see **Data sources** in the sidebar.

**2. Pick a type**

Choose PostgreSQL, Supabase, MySQL, Snowflake, Databricks or Google BigQuery.

**3. Fill in the connection**

Enter the details for your type. See [Per-type setup](#per-type-setup) below. The **Name** is
how the data source appears in Matys.

**4. Test the connection**

Select **Test connection**. Matys connects and shows **Connected** or **Connection failed** with
the reason.

**5. Choose what Matys may read**

Once connected, you can limit Matys to some schemas or datasets. See [Limit what Matys can
read](#limit-what-matys-can-read).

**6. Save**

Select **Add data source**. The button stays disabled until the test passes.

> [!NOTE]
>
> Your plan can limit how many data sources you can add. See [Billing](/docs/workspace/billing.md).

## Per-type setup

> [tab] PostgreSQL
>
> Paste a **Connection URL (Optional)** such as `postgres://user:password@host:port/database`. Matys fills in the fields below from it.
>
> Or fill in the fields yourself: **Database name**, **Host**, **Port**, **Username** and **Password**.
>
> Set up [SSL](#ssl) below the fields.

> [tab] Supabase
>
> Paste the connection string from your Supabase project into **Connection URL (Optional)**.
>
> > [!WARNING]
> >
> > Use the Transaction pooler or Session pooler connection string. The direct connection does not work: it only accepts IPv6, unless your project has the IPv4 add-on.
>
> A PostgreSQL connection whose host is a Supabase host also shows as Supabase.

> [tab] MySQL
>
> Paste a **Connection URL (Optional)** such as `mysql://user:password@host:port/database`, or fill in **Database name**, **Host**, **Port**, **Username** and **Password**.
>
> Set up [SSL](#ssl) below the fields.

> [tab] Snowflake
>
> Matys connects to Snowflake with key-pair authentication. Fill in:
>
> * **Account**, for example `myorg-myaccount`
> * **Username**
> * **Private key**: upload your private key file (`.p8`, `.pem` or `.key`)
> * **Key passphrase**: only if the key is encrypted
> * **Warehouse**
> * **Database**
> * **Role**: a role with read-only access
>
> The form has a **How to set up key-pair access** section. Create a dedicated service user with a read-only role, then generate a key pair:
>
> ```bash theme={null}
> openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
> openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
> ```
>
> Register the public key body (without the BEGIN and END lines) on the user in Snowflake:
>
> ```sql theme={null}
> ALTER USER <username> SET RSA_PUBLIC_KEY='<public key body>';
> ```
>
> Then upload `rsa_key.p8` as the private key file.

> [tab] Databricks
>
> Fill in:
>
> * **Workspace URL**, for example `dbc-a1b2c3d4-e5f6.cloud.databricks.com`. The workspace must be on cloud.databricks.com, azuredatabricks.net or gcp.databricks.com.
> * **HTTP path**, for example `/sql/1.0/warehouses/abcdef1234567890`
> * **Access token**
> * **Catalog**, for example `main`
>
> The form has a **How to set up Databricks access** section:
>
> * Create a service principal and generate an access token for it, rather than using a personal token.
>
> * Grant it CAN USE on the SQL warehouse, then USE CATALOG, USE SCHEMA and SELECT on what Matys should read.
>
> * Find the workspace URL and HTTP path on the SQL warehouse's **Connection details** tab.
>
> > [!TIP]
> >
> > A stopped warehouse can take a minute to start, so the first test may take a while.

> [tab] BigQuery
>
> Upload the JSON key file of a service account under **Service account**. Matys uses the key's project as the default name.
>
> When you test the connection, Matys lists the datasets the service account can see.

## SSL

PostgreSQL, Supabase and MySQL connections have two switches:

* **SSL Connection**: encrypt the connection. It is on by default.
* **Verify certificate**: check the server's certificate. It is off by default.

When you verify the certificate, Matys checks it against the system trust store. If your database uses a private certificate authority, select **Upload custom root certificate** and upload its file (`.pem`, `.crt` or `.cer`).

On PostgreSQL and Supabase, a connection URL with an `sslmode` sets these switches for you. `disable` turns SSL off. `verify-ca` and `verify-full` turn on certificate verification. Any other value keeps SSL on without verification.

On MySQL, a connection URL turns SSL on only when it has `ssl=true` or `sslmode=require`. Otherwise it turns SSL off, so check the switch after you paste the URL.

## Allow Matys's IP addresses

The form shows a **Whitelist IPs** box with the addresses Matys connects from. If your database only accepts connections from known IP addresses, select the copy button and add them to your database's allowlist.

> [!NOTE]
>
> The **Whitelist IPs** box is not shown in every environment. If you don't see it, contact the
> Matys team for the addresses.

## Limit what Matys can read

After a successful test, turn on **Limit to specific schemas** (or **Limit to specific datasets** on BigQuery) and tick the ones Matys may read. Select at least one.

When the switch is off, Matys can read all schemas or datasets, including ones you create later.

You can limit:

* schemas on PostgreSQL, Supabase, Snowflake and Databricks
* datasets on BigQuery

MySQL connections have no schema limit. Restrict the database user's grants instead.

## Choose who can use a data source

Each data source has an audience. Admins can use every data source.

**1. Open the settings**

Go to **Settings**, then **Data sources**. Each data source shows its audience: **Everyone** or
**Specific groups**.

**2. Edit access**

Select the audience next to a data source. Choose **Everyone in org** or **Specific groups**.

**3. Pick groups**

With **Specific groups**, add the groups whose members may use it. Leave the list empty to keep
it for admins only.

**4. Save**

Select **Save**. Matys only queries the data sources the person asking can use.

See [Permissions](/docs/workspace/permissions.md) for how groups work.

## Edit a data source

On the **Data sources** page, select the pencil next to a data source. Change what you need and select **Save changes**.

Matys keeps your password, token or key when you leave its field empty. If you change the host or port of a PostgreSQL, Supabase or MySQL connection, enter the password again.

If you change connection details, test the connection again before you save.

## Remove a data source

On the **Data sources** page, select the trash icon next to a data source and confirm. This can't be undone.

> [!WARNING]
>
> You can't delete a data source that has saved charts. Edit its connection instead.

## Try Matys with sample data

No access to a database yet? Add the demo data source:

* On the empty **Data sources** page, select **Demo data source**.
* In the **Add a data source** dialog, select **I don't have access to a data source**.
* On the chat banner, select **Try with demo data**.

The demo data source shows as **Sample data**. You can't edit it. You can remove it when you connect your own, as long as it has no saved charts.

> [card] [Teach Matys your business](/docs/context.md)
>
> Explain your metrics and tables so answers match how your team works.

> [card] [Connect your tools](/docs/integrations/connectors.md)
>
> Bring in GitHub, Metabase and the apps your team uses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.