> For the complete documentation index, see [llms.txt](https://docs.upriverdata.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.upriverdata.com/integrations/trino.md).

# Trino

## Connecting Trino to Upriver

Upriver connects to your Trino cluster to monitor tables, run data quality checks, and support agent workflows over your lakehouse data. Access is **read-only**: Upriver queries table metadata and runs `SELECT` statements against the tables you configure—it does not modify data or schema objects.

To connect Trino, you will:

1. Create a dedicated Trino user with the minimum read permissions.
2. Ensure the Trino coordinator is reachable from Upriver over the network.
3. Register the cluster as a **Trino** integration in Upriver.
4. Create a **Trino** data source that points at the catalog, schema, and table to monitor.

***

### Prerequisites

#### Network access

The Trino **coordinator** must be reachable from your Upriver deployment using the host and port you provide during setup (default coordinator port is **8080** unless your cluster uses another value).

* **SaaS:** Allow inbound connections from Upriver’s network to the coordinator (firewall, security group, or private link—coordinate with your Upriver representative if you need egress/ingress details).
* **Self-hosted:** Ensure routing and DNS resolve from the Upriver runtime to the coordinator hostname.

***

### Step 1: Create a dedicated Trino user

Create a service account for Upriver (for example, `upriver`) rather than reusing a personal login. Grant **read-only** access only to the catalogs and schemas you intend to monitor.

#### Required capabilities

The Upriver user must be able to:

1. **Query monitored tables** — run `SELECT` (and limited metadata queries) on the catalog, schema, and table you configure in Upriver.
2. **Read `information_schema`** — Upriver introspects `information_schema.tables` and `information_schema.columns` in your catalog to discover schema and column metadata.
3. **Read Iceberg partition metadata (Iceberg catalogs only)** — for **Iceberg** tables, the user also needs access to the `$partitions` system table on monitored tables so Upriver can discover partition columns for time-based filtering.

#### Example grants

Exact syntax depends on your Trino version and access-control plugin (file-based, Ranger, OPA, etc.). Adapt catalog and schema names to your environment:

```sql
-- Example: create a dedicated user (syntax may vary by auth backend)
CREATE USER upriver WITH PASSWORD '<strong-password>';

-- Read access to the schema that contains monitored tables
GRANT SELECT ON SCHEMA iceberg.analytics TO upriver;

-- If your deployment uses table-level grants instead:
-- GRANT SELECT ON TABLE iceberg.analytics.orders TO upriver;
```

Work with your Trino administrator to ensure:

* The user cannot `INSERT`, `UPDATE`, `DELETE`, or `CREATE` objects outside what you explicitly allow.
* `information_schema` in the target **catalog** is readable for the schemas you monitor.
* For **Iceberg**, `SELECT` on `"<catalog>"."<schema>"."<table>$partitions"` is allowed when partition discovery is enabled.

***

### Step 2: Add the Trino integration in Upriver

1. In Upriver, go to **Settings → Integrations**.
2. Click **Add integration** and choose **Trino**.
3. On the **Connect** step, review the user and network requirements above.
4. On the **Finalize** step, enter:

| Field        | Description                                                                                           |
| ------------ | ----------------------------------------------------------------------------------------------------- |
| **Host**     | Trino coordinator hostname or IP (required).                                                          |
| **Port**     | Coordinator port (required; commonly `8080`).                                                         |
| **Username** | The dedicated Trino user (required).                                                                  |
| **Password** | Password for the user, if your cluster uses password authentication (optional when auth is disabled). |

5. Save the integration.

Credentials are stored securely and keyed by coordinator host so you can reuse the same integration across multiple Trino data sources on that cluster.

***

### Step 3: Create a Trino data source

After the integration exists, create a data source that identifies the table Upriver should monitor:

1. Go to **Data sources** and create a new source of type **Trino**.
2. Select the **Trino** integration you created.
3. Provide:

| Field            | Description                                                              |
| ---------------- | ------------------------------------------------------------------------ |
| **Catalog**      | Trino catalog name (for example, `iceberg`, `hive`, or `delta`).         |
| **Catalog type** | `iceberg`, `hive`, or `delta`—must match how the catalog is implemented. |
| **Schema**       | Schema containing the table.                                             |
| **Table**        | Table to monitor.                                                        |

4. Complete the remaining data source wizard steps (scheduling, columns, etc.) as needed.

Upriver connects using the integration’s host, port, and username, and runs read queries of the form:

```sql
SELECT * FROM "<catalog>"."<schema>"."<table>" ...
```

***

### Catalog-specific notes

| Catalog type | Notes                                                                                                                                                        |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Iceberg**  | Ensure read access to `information_schema` and to the `$partitions` metadata table for monitored Iceberg tables when partition-based time filtering is used. |
| **Hive**     | Grant `SELECT` on the target schema or tables; partition behavior follows Hive layout and Upriver’s partition configuration for the data source.             |
| **Delta**    | Grant `SELECT` on the target schema or tables in the Delta catalog connector you use with Trino.                                                             |
