# Trino

{% hint style="info" %}
Soda uses the official [Trino Python client](https://github.com/trinodb/trino-python-client) internally to establish connections and execute queries.
{% endhint %}

## Connection configuration reference

Install the following package:

```bash
pip install soda-trino
```

### Data source YAML

#### Core connection

**Create the config file:**

```shellscript
soda data-source create -f ds_config.yml
```

**Configure connection**

To connect to Trino, add a `data_source` block to your `ds_config.yml` file.

<table><thead><tr><th width="304.99993896484375">Authentication method</th><th>Soda Cloud support</th><th>Soda Core support</th></tr></thead><tbody><tr><td>Username/password</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>JWT (existing token)</td><td></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>JWT (OAuth – client credentials flow)</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>No authentication</td><td></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr></tbody></table>

**Core connection parameters**

| Parameter | Required | Default | Description                                      |
| --------- | -------- | ------- | ------------------------------------------------ |
| `type`    | Yes      | —       | Must be `trino`.                                 |
| `host`    | Yes      | —       | Hostname or IP address of the Trino coordinator. |
| `catalog` | Yes      | —       | Trino catalog name.                              |
| `verify`  | No       | `True`  | SSL verification. Supported in Soda Core only.   |

#### 1. Username/password

Supported in Soda Cloud and Soda Core.

{% code title="ds\_config.yml" %}

```yaml
type: trino
name: my_trino
connection:
  host: trino.example.com
  catalog: hive

  # Optional connection settings
  port: 443
  http_scheme: https
  source: soda-core
  client_tags: ["dq", "prod"]

  # Authentication
  # auth_type: BasicAuthentication  # Optional
  user: ${TRINO_USER}
  password: ${TRINO_PASSWORD}
```

{% endcode %}

| Parameter     | Required          | Default     | Description                              |
| ------------- | ----------------- | ----------- | ---------------------------------------- |
| `port`        | No                | `443`       | Trino port.                              |
| `http_scheme` | No                | `https`     | One of `http`, `https`.                  |
| `source`      | No                | `soda-core` | Trino-internal label for the connection. |
| `client_tags` | No                | —           | Trino-internal tags for this connection. |
| `auth_type`   | Depends           | —           | Authentication type. See modes above.    |
| `user`        | Username/password | —           | Trino username.                          |
| `password`    | Username/password | —           | Trino password.                          |

***

#### 2. JWT (existing token)

Supported in Soda Core only.

{% code title="ds\_config.yml" %}

```yaml
type: trino
name: my_trino
connection:
  host: trino.example.com
  catalog: hive

  auth_type: JWTAuthentication
  access_token: ${TRINO_JWT_ACCESS_TOKEN}
```

{% endcode %}

| Parameter      | Required             | Default | Description                           |
| -------------- | -------------------- | ------- | ------------------------------------- |
| `auth_type`    | Depends              | —       | Authentication type. See modes above. |
| `access_token` | JWT (existing token) | —       | JWT access token.                     |

***

#### 3. JWT (OAuth – client credentials)

Supported in Soda Cloud and Soda Core.

```yaml
type: trino
name: my_trino
connection:
  host: trino.example.com
  catalog: hive

  auth_type: OAuth2ClientCredentialsAuthentication
  oauth:
    token_url: https://auth.example.com/oauth2/token
    client_id: ${TRINO_OAUTH_CLIENT_ID}
    client_secret: ${TRINO_OAUTH_CLIENT_SECRET}
    scope: "scope1 scope2"         # Optional
    grant_type: client_credentials
```

| Parameter             | Required    | Default              | Description                           |
| --------------------- | ----------- | -------------------- | ------------------------------------- |
| `auth_type`           | Depends     | —                    | Authentication type. See modes above. |
| `oauth`               | JWT (OAuth) | —                    | OAuth configuration block.            |
| `oauth.token_url`     | JWT (OAuth) | —                    | OAuth token endpoint.                 |
| `oauth.client_id`     | JWT (OAuth) | —                    | OAuth client ID.                      |
| `oauth.client_secret` | JWT (OAuth) | —                    | OAuth client secret.                  |
| `oauth.scope`         | No          | `null`               | Space-separated scopes.               |
| `oauth.grant_type`    | No          | `client_credentials` | OAuth grant type.                     |

***

#### 4. No authentication

Supported in Soda Core only.

```yaml
type: trino
name: my_trino
connection:
  host: trino.example.com
  catalog: hive
  port: 8080
  http_scheme: http

  auth_type: NoAuthentication
```

***

### Test the connection

To test your connection configuration:

```bash
soda data-source test -ds ds_config.yml
```

***

## Limitations & edge cases

Using Trino as a Diagnostics Warehouse destination through between-source copying is available but **not fully supported**.

There is a known issue when the Trino catalog is Iceberg-based. You are advised to:

* Use within-source copying, or
* Configure Soda to connect directly to the destination data source instead of routing through the Trino catalog connection.

<br>

***

{% if (visitor.claims.plan === 'datasetStandard')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Free license** documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}

{% if (visitor.claims.plan === 'enterprise')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Team license** documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}

{% if (visitor.claims.plan === 'enterpriseUserBased')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Enterprise license** documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}

{% if !(visitor.claims.plan === 'enterprise' || visitor.claims.plan === 'enterpriseUserBased' || visitor.claims.plan === 'datasetStandard')%}
{% hint style="info" %}
You are **not logged in to Soda** and are viewing the default public documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}


---

# 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.soda.io/reference/data-source-reference-for-soda-core/trino.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.
