> For the complete documentation index, see [llms.txt](https://docs.soda.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.soda.io/soda-documentation/reference/data-source-reference-for-soda-core/trino.md).

# Trino

Access configuration details to connect Soda to a Trino data source.

{% 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
```

***

## Required permissions

The user Soda connects as needs `SELECT` on the tables you want to scan. How you grant it depends on how your Trino cluster manages access. Depending on the cluster, that's handled by Trino access control rules (such as file-based rules, Open Policy Agent, or Ranger), by the connector for the catalog, or by the underlying data source's own permissions.

If the catalog's connector supports SQL `GRANT` statements, grant access to a table or to a whole schema:

```sql
-- One table
GRANT SELECT ON <catalog>.<schema>.<table> TO <soda_user>;

-- All current and future tables in a schema
GRANT SELECT ON SCHEMA <catalog>.<schema> TO <soda_user>;
```

{% hint style="info" %}
Some connectors don't support `GRANT`. Check the documentation for your catalog's connector.
{% endhint %}

***

## 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>

***

{% hint style="info" %}
You are **not logged in to Soda** and are viewing the default public documentation. Learn more about [Licensing & documentation access](/soda-documentation/reference/documentation-access-and-licensing.md).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.soda.io/soda-documentation/reference/data-source-reference-for-soda-core/trino.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
