# Data connections (/docs/sql-and-data/data-connections.md)



A data connection tells ByteRun how to reach a source and holds its credential. Credentials are stored by
ByteRun; a notebook never sees them.

| Source         | You provide                                                                           |
| -------------- | ------------------------------------------------------------------------------------- |
| **PostgreSQL** | Host, port (5432), database, TLS mode, optional CA certificate, username and password |
| **MySQL**      | Host, port (3306), database, TLS mode, optional CA certificate, username and password |
| **Snowflake**  | Account, warehouse, database, optional schema, and a password or private key          |
| **BigQuery**   | Project, optional default dataset, and a service account key                          |
| **Amazon S3**  | Bucket, region, and either a role ARN or an access key pair                           |

<Shot id="data-connection-form" alt="The Add a data connection form for PostgreSQL, filled in with example values: name, host, port, database, TLS, username, a masked password and the Public or Private choice" />

## TLS for PostgreSQL and MySQL [#tls-for-postgresql-and-mysql]

The **TLS to the database** setting has four choices: **Prefer** (encrypt if the database offers it),
**Require** (encrypt, but do not verify the certificate), **Verify** (encrypt and check the certificate), and
**Disable**. Add a **CA certificate** when an internal certificate authority issued the database's certificate;
it is accepted only with **Verify**.

## Snowflake [#snowflake]

Give the account (for example `xy12345.us-east-1`), warehouse, database, an optional schema, and a username with
either a password or a private key (a PEM key starting `-----BEGIN PRIVATE KEY-----`). Paste the key in the same
field as the password. [Native SQL cells](/docs/sql-and-data/sql-cells.md) on Snowflake need the **key pair**.

ByteRun only sends read-style statements, but the role you connect with is the real read-only control: give it
read access only. The same applies to a BigQuery service account.

<Shot id="data-connection-form-snowflake" alt="The Add a data connection form for Snowflake: account, warehouse, database, schema, username and a field for a password or private key" />

## Amazon S3 [#amazon-s3]

Give a **role ARN** and ByteRun assumes the role, so no key is stored at all. Otherwise supply an access
key pair. Either way, a notebook only ever receives a read-only session for that bucket, and the session
lasts 15 minutes.

With a role ARN, the form shows the **trust policy** your role must allow: ByteRun's principal, and an
`sts:ExternalId` that is specific to your workspace. Copy both from the form into the role's trust relationship
before you test the connection.

<Shot id="data-connection-form-s3" alt="The Add a data connection form for Amazon S3 with a role ARN, and the trust policy the role must allow" />

## Adding a connection [#adding-a-connection]

Connections belong to a workspace, and the workspace's **manager** adds them in workspace settings.
Choose **Add connection**, pick the source type and fill in its fields. The **Name** may use letters, digits
and `_`, and it is how SQL refers to the connection. **Test connection** checks the details before you add
it, and you decide whether the connection is **Public** to every project in the workspace or **Private** to
the projects you pick (see [connection access](/docs/sql-and-data/connection-access.md)). The form only asks for what that
source needs, and the server makes the final check.

In the workspace's connection list, each connection has **View connection**, **Change access** and **Remove**.

Members use connections; they do not manage them. In a project, the **Data connections** panel in the file
tree lists the connections you may use.

<Shot id="data-connections" alt="The Data connections panel in the project file tree" />
