Skip to main content

Prerequisites

  • The hostname for the Trino database server
  • The username/password for the Trino database server
  • The name of the database to use within the Trino database server

Setup

Manual

Add the following to a .env file in your Cube project:

Environment Variables

Pre-Aggregation Feature Support

count_distinct_approx

Measures of type count_distinct_approx can be used in pre-aggregations when using Trino as a source database. To learn more about Trino support for approximate aggregate functions, click here.

Pre-Aggregation Build Strategies

To learn more about pre-aggregation build strategies, head here.
By default, Trino uses a simple strategy to build pre-aggregations.

Simple

No extra configuration is required to configure simple pre-aggregation builds for Trino.

Export Bucket

Trino supports using both AWS S3 and Google Cloud Storage for export bucket functionality.

AWS S3

Ensure the AWS credentials are correctly configured in IAM to allow reads and writes to the export bucket in S3.

Google Cloud Storage

When using an export bucket, remember to assign the Storage Object Admin role to your Google Cloud credentials (CUBEJS_DB_EXPORT_GCS_CREDENTIALS).

SSL

To enable SSL-encrypted connections between Cube and Trino, set the CUBEJS_DB_SSL environment variable to true. For more information on how to configure custom certificates, please check out Enable SSL Connections to the Database.

Custom headers

The Trino driver supports forwarding custom HTTP headers (e.g., X-Trino-Source, X-Trino-Routing-Group, X-Trino-Client-Tags, or any other custom header) on every request to the Trino coordinator. See the Trino client protocol for the list of headers accepted by Trino. Custom headers can’t be configured via environment variables. Instead, use the driver_factory configuration option to pass a headers object to the driver:
In multitenant deployments, you can use the security context to pass per-tenant headers, for example to forward a user token from the API request down to Trino: