This article covers:

  1. How to set up a connection to a Trino/Presto database
  2. How to add datasets
  3. How to do connection overrides on a Trino/Presto connection
  4. The supported Trino/Presto data types and the respective Luzmo data type they are mapped to

1. How to setup a Trino/Presto connection

To make a connection to Trino or Presto, navigate to the Connections page, select New Connection, then select Trino or Presto from the New Connection modal. You'll be asked to provide a host, port, username and password:

  • host: this is the HTTP(S) endpoint of your Trino or Presto cluster. Make sure to include https:// in front of the host URL!
  • port: the port of your Trino or Presto cluster. This will typically be 8080 (default) or 443 (if the cluster is accessible via a HTTPS load balancer).
  • database: the initial collection to connect to. This is set as X-Trino-Catalog header in calls.
  • username: the user to connect to your Trino or Presto cluster. This user is used as the X-Trino-User header in calls to Trino or Presto.
  • password: the password associated with the user. This password is used in the Authorization header in calls to Trino or Presto.

Please refer to the examples in our developer documentation to find out how to create a connection to Trino or Presto via our API.

Notes:

  • Make sure Luzmo can reach your cluster by whitelisting Luzmo's range of IP addresses as described here
  • Luzmo connects via Trino / Presto's HTTP REST interface. Make sure it is enabled.
  • Starburst Trino is currently not supported, as this distribution does not enable the /v1/status HTTP endpoint which is used for verifying the cluster is reachable to Luzmo.

2. How to add datasets

Once you have connected your Trino/Presto you can add datasets as explained here.

  1. You can select one or multiple datasets as available in your Trino/Presto and link them in Luzmo to ensure they can be used together in a dashboard.
  2. You can also add SQL datasets by switching to the SQL tab in the dataset creation modal. While creating or editing a SQL dataset, you can parameterize anything within the query by specifying {{metadata.< parameter name >|< default value >}}. Find out more about parameterized SQL Datasets.

Also make sure to check out this article on Preparing your data for analytics.

To find out how to add datasets using our API, please refer to the examples in our developer documentation for Trino or Presto.

3. Trino/Presto Connection Overrides

When generating an Authorization token to grant a user acces to your embedded dashboards it is possible to override the data source properties in the authorization request to dynamically use different properties. Find out more about connection overrides.

The fields available for overriding a Trino/Presto connection are as follows:

  • Connection ID: The ID of the Connection to be overridden. Retrieve the ID to specify as detailed here.
  • host: The new database host to connect to. The database must be of the same type as the originally configured database.
  • port: The new port to connect to.
  • user: The new user to use when connecting.
  • password: The new password to use when connecting.
  • database: The new database to retrieve data from.
  • schema: The new schema to retrieve data from.
  • table: The new table to retrieve data from.
  • datasets: List of dataset-level overrides. Useful if you want to override only a single dataset in your dashboard or if you have a separate table per client.
    • schema: The database to query.
    • table: The new Trino/Presto table to query.
    • sql: The new SQL query to run (only for SQL datasets). Alternatively, you could also use parameterized SQL Datasets.

Our developer documentation has more info about connection overrides and an example of a Trino connection override or Presto connection override.

Example code demonstrating how to override a Trino/Presto connection:

import Luzmo from '@luzmo/nodejs-sdk';
const client = new Luzmo({
api_key: '<your Luzmo API key>',
api_token: '<your Luzmo API token>',
host: 'https: //api.luzmo.com:443'
});


const response = await client.create('authorization',
{
  type: "embed",
  username: "< A unique and immutable identifier for your user >",
  name: "< user name >",
  email: "< user email >",
  suborganization: "< a suborganization name >",
  access: {
    collections: [
          {
        id: "<collection_id>",
        inheritRights: "use"
          }
      ]
  },
  account_overrides: {
    <account_id>: {
      host: "<new_https_endpoint>",
      port: "<new_https_port>",
      database: "<new_collection>",
      user: "<new_username>",
      password: "<new_password>",
      datasets: {
          <dataset_id>: {
              table: "<new_table_or_view>",
              sql: "<new_sql_for_sql_dataset>"
              }
          }
      }
);

4. Supported Data Types

Data Type in Trino Data Type in Luzmo
boolean hierarchy
tinyint numeric
smallint numeric
integer numeric
int numeric
bigint numeric
real numeric
double numeric
decimal numeric
varchar hierarchy
char hierarchy
varbinary hierarchy
json hierarchy
date datetime
time without time zone datetime
time with time zone datetime
timestamp without time zone datetime
timestamp with time zone datetime
ipaddress hierarchy
uuid hierarchy

Need more information?

Do you still have questions? Let us know how we can help.
Send us feedback!