> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/use-fme/warehouse-native-experimentation/integrations/trino.md).

# Connect Trino

Learn how to integrate Trino with Harness FME to enable Warehouse Native Experimentation.

{% hint style="info" %}
This feature is in Beta[^1] and requires enablement. [View all early access features.](https://developer.harness.io/release-notes/features.md)

{% @harness-feature-flag-access/request-feature-flag-access module="feature-management-experimentation" pagePath="feature-management-experimentation/use-fme/warehouse-native-experimentation/integrations/trino" pageTitle="Connect%20Trino" featureFlags="%5B%7B%22name%22%3A%22Trino%20for%20Warehouse%20Native%20Experimentation%20(New%20Experience)%22%2C%22key%22%3A%22FME\_ENABLE\_WHN\_TRINO%22%2C%22status%22%3A%22BETA%22%2C%22description%22%3A%22Enables%20the%20Trino%20data%20source%20option%20in%20the%20Harness%20FME%20New%20Experience.%20Must%20be%20enabled%20together%20with%20whn\_trino\_enabled.%22%7D%2C%7B%22name%22%3A%22Trino%20for%20Warehouse%20Native%20Experimentation%20(Backend)%22%2C%22key%22%3A%22whn\_trino\_enabled%22%2C%22status%22%3A%22BETA%22%2C%22description%22%3A%22Enables%20Trino%20support%20in%20the%20Harness%20FME%20backend.%20Must%20be%20enabled%20together%20with%20FME\_ENABLE\_WHN\_TRINO.%22%7D%5D" %}
{% endhint %}

Warehouse Native Experimentation allows you to run experiments on data that already lives in your data warehouse. [Trino](https://trino.io/) is a distributed SQL query engine that queries data where it lives, so connecting Trino lets you run experiments across the catalogs your cluster already exposes without moving that data into a separate warehouse.

Unlike the other supported data warehouses, Harness FME connects to Trino through a [Harness connector](https://developer.harness.io/harness-platform/use-harness-platform/connectors) rather than through credentials that you enter in FME. You select an existing Database (JDBC) connector, and Harness FME uses that connector to reach your cluster. No passwords, tokens, or key pairs are stored in your FME data source configuration.

### Prerequisites

Ensure that you have the following before getting started:

* Warehouse Native Experimentation enabled for your account
* A running Trino cluster that your Harness delegate can reach
* A Harness [Database (JDBC) connector](https://developer.harness.io/harness-platform/use-harness-platform/connectors) configured for your Trino cluster, created at the account, organization, or project scope
* A Harness delegate on version `26.10.90300` or later. Earlier delegate versions cannot run the connection test, and because a passing test is required to load the catalog and schema lists, setup cannot be completed without it.
* A Trino catalog and schema containing your assignment and event data
* A designated results table where experiment results are stored

### Setup

Harness recommends the following best practices:

* Use a dedicated Trino user for the connector rather than a user tied to an individual.
* Grant read-only access to the catalog and schema containing the assignment and event data.
* Grant write access only to the experiment results table.

To integrate Trino as a data warehouse for Warehouse Native Experimentation:

1. From the Harness FME navigation menu, click **FME Settings** and click **View** on a project on the **Projects** page. Then, navigate to the **Data Source** tab.
2. Select Trino as your data warehouse. In the **Data Source** tab of your Harness FME project, select **Trino** from the list of supported data warehouses.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>PROJECT EXPERIMENTATION TYPE</strong></p><p>A project uses a single experimentation type based on the metric source used.</p><p>When you add a data source to a project, the project's experimentation type is set to <code>Warehouse Native</code>. All metrics in the project must then use Warehouse Native metric sources.</p><p>If a project instead uses metrics created from an <a href="https://developer.harness.io/feature-management-experimentation/new-to-fme/get-started/send-event-data.md">ingested event source</a>, the project's experimentation type is set to <code>Cloud</code>.</p></div>
3. Select the Harness connector for your Trino cluster.

   | Field     | Description                                                                                                           |
   | --------- | --------------------------------------------------------------------------------------------------------------------- |
   | Connector | The Harness Database (JDBC) connector for your Trino cluster. The connector holds the connection URL and credentials. |

   The connector is the only connection detail you enter. Harness FME derives the account, organization, and project scope from the connector itself, so there are no separate identifier, host, port, or credential fields as there are for the other supported data warehouses.

   ![](https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-ad464fd0633ad83f05c1ae34620ef86681c02215%2Ftrino-data-source.png?alt=media)
4. Test the connection by clicking **Test Connection**. **Test Connection** stays disabled until you have selected a connector.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>A successful connection test is required. Harness FME loads the available catalogs and schemas from your cluster through the connector, and there is no way to type a catalog or schema name by hand. Until the test passes, the <strong>Catalog</strong> and <strong>Schema</strong> fields remain read-only and you cannot save the data source.</p></div>
5. Select a catalog. After the connection test passes, **Catalog** becomes a dropdown listing the catalogs your Trino user can access, and Harness FME selects the first one for you. Select the catalog containing your assignment and metric source tables.
6. Select a schema. **Schema** lists the schemas in the selected catalog, and Harness FME selects the first one for you. If you change the catalog, the selected schema is cleared and the schema list reloads for the new catalog.
7. Specify a results table. Create a results table where Harness FME will write experiment analysis results, and ensure that:

   * The table exists in your selected catalog and schema.
   * The catalog is backed by a connector that permits writes, such as Hive, Iceberg, or Delta Lake.
   * The schema matches the expected format for experiment results below.

   | Field                 | Type                          | Description                                                                                         |
   | --------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------- |
   | `METRICID`            | `VARCHAR`                     | Unique identifier for the metric being calculated.                                                  |
   | `METRICNAME`          | `VARCHAR`                     | Human-readable name of the metric being calculated.                                                 |
   | `METRICRESULTID`      | `VARCHAR`                     | Unique identifier representing a specific calculation per metric, per experiment, per analysis run. |
   | `EXPID`               | `VARCHAR`                     | Unique identifier for the experiment associated with this metric calculation.                       |
   | `EXPNAME`             | `VARCHAR`                     | Human-readable name of the experiment associated with this metric calculation.                      |
   | `TREATMENT`           | `VARCHAR`                     | The experiment variant (e.g., Control or Treatment) associated with the metric results.             |
   | `DIMENSIONNAME`       | `VARCHAR`                     | The name of the dimension being analyzed (e.g., country, platform).                                 |
   | `DIMENSIONVALUE`      | `VARCHAR`                     | The corresponding value of the analyzed dimension.                                                  |
   | `ATTRIBUTEDKEYSCOUNT` | `BIGINT`                      | Count of unique keys (users, sessions, etc.) attributed to this metric result.                      |
   | `REQUESTTIMESTAMP`    | `TIMESTAMP(3) WITH TIME ZONE` | Timestamp when the metric computation request occurred.                                             |
   | `MIN`                 | `DOUBLE`                      | Minimum observed value for the metric.                                                              |
   | `MAX`                 | `DOUBLE`                      | Maximum observed value for the metric.                                                              |
   | `COUNT`               | `BIGINT`                      | Total number of observations included in the metric calculation.                                    |
   | `SUM`                 | `DOUBLE`                      | Sum of all observed metric values.                                                                  |
   | `MEAN`                | `DOUBLE`                      | Average (mean) of the metric values.                                                                |
   | `P50`                 | `DOUBLE`                      | 50th percentile (median) metric value.                                                              |
   | `P95`                 | `DOUBLE`                      | 95th percentile metric value.                                                                       |
   | `P99`                 | `DOUBLE`                      | 99th percentile metric value.                                                                       |
   | `VARIANCE`            | `DOUBLE`                      | Variance of the metric values.                                                                      |
   | `EXCLUDEDUSERCOUNT`   | `BIGINT`                      | Number of users excluded from the analysis (due to filters, SRM, etc.).                             |
   | `ASOFTIMESTAMP`       | `TIMESTAMP(3) WITH TIME ZONE` | Timestamp representing when the result snapshot was written.                                        |

   Harness FME matches these columns by name rather than by position, so column order does not matter. For two of them, either spelling is accepted: `COUNT` or `KEY_COUNT`, and `EXCLUDEDUSERCOUNT` or `EXCLUDED_USER_COUNT`.

   <div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p><strong>TIMESTAMP COLUMNS</strong></p><p>Harness FME writes the timestamp columns at millisecond precision, so declare them as <code>TIMESTAMP(3)</code>.</p><p>Include the time zone. When FME reads <code>ASOFTIMESTAMP</code> back as text, it requires a UTC offset in the value. A column declared as a plain <code>TIMESTAMP</code> can return a value with no offset, which fails to parse. Declaring the column as <code>TIMESTAMP(3) WITH TIME ZONE</code> avoids this.</p><p>If you hit parsing errors on <code>ASOFTIMESTAMP</code>, declare that one column as <code>BIGINT</code> instead. Harness FME also accepts an epoch value for it, and behavior around timestamp types varies by underlying connector, so <code>BIGINT</code> is the more portable choice if your connector returns <code>ASOFTIMESTAMP</code> without a usable offset.</p></div>

   To create the results table with the correct structure, run the following SQL statement in Trino:

   ```sql
   CREATE TABLE IF NOT EXISTS <CATALOG_NAME>.<SCHEMA_NAME>.<TABLE_NAME> (
      METRICRESULTID      VARCHAR,
      TREATMENT           VARCHAR,
      DIMENSIONNAME       VARCHAR,
      DIMENSIONVALUE      VARCHAR,
      ATTRIBUTEDKEYSCOUNT BIGINT,
      REQUESTTIMESTAMP    TIMESTAMP(3) WITH TIME ZONE,
      MIN                 DOUBLE,
      MAX                 DOUBLE,
      COUNT               BIGINT,
      SUM                 DOUBLE,
      MEAN                DOUBLE,
      P50                 DOUBLE,
      P95                 DOUBLE,
      P99                 DOUBLE,
      VARIANCE            DOUBLE,
      EXCLUDEDUSERCOUNT   BIGINT,
      ASOFTIMESTAMP       TIMESTAMP(3) WITH TIME ZONE,
      METRICID            VARCHAR,
      METRICNAME          VARCHAR,
      EXPID               VARCHAR,
      EXPNAME             VARCHAR
   );
   ```
8. Save and activate. Once the test passes and you have selected a catalog, schema, and results table, click **Save** to create the connection.

Your Trino data source can now be used to create assignment and metric sources for Warehouse Native Experimentation.

### Network access

Trino connectivity is governed entirely by your Harness delegate and connector. Harness FME does not connect to your cluster directly. Queries follow this path:

Harness FME → Harness Platform JDBC query API → Harness delegate → Trino, through the Database (JDBC) connector.

Because the delegate makes the connection, your cluster only needs to be reachable from the delegate, not from the public internet.

This differs from [Amazon Redshift](https://developer.harness.io/feature-management-experimentation/use-fme/warehouse-native-experimentation/integrations/amazon-redshift.md) and [Databricks](https://developer.harness.io/feature-management-experimentation/use-fme/warehouse-native-experimentation/integrations/databricks.md), where private or IP-restricted deployments require the Harness static outbound IP addresses to be allowlisted. **That list does not apply to Trino.** If your cluster is private or IP-restricted, run a delegate that can reach it rather than allowlisting FME outbound IP addresses.

{% hint style="info" %}
When you reopen a saved Trino data source, Harness FME reloads the catalog list and then the schema list for the saved catalog. If the cluster is unreachable or the connector credentials have changed, these lists can come back empty without an error message. Run **Test Connection** again to see the underlying failure.
{% endhint %}

### Example Trino configuration

| Setting        | Example              |
| -------------- | -------------------- |
| Data Warehouse | `Trino`              |
| Connector      | `trino_analytics`    |
| Catalog        | `hive`               |
| Schema         | `demo`               |
| Results Table  | `whn_metric_results` |

{% @harness-feedback/feedback %}

[^1]: Off by default. If you want to try it and share feedback, request access and Harness will turn it on for your account. Beta features can change and may not be ready for production use.
