Catalogs

Trino does not have a built-in catalog and instead provides connectors to external data sources. This allows Trino to connect to, read from and join a wide variety of data sources.

Using catalogs

Catalogs are defined in their own resources and referenced from cluster objects. See the Concepts page for more details.

Create a catalog

You can create a catalog using the TrinoCatalog object as follows.

apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCatalog
metadata:
  name: hive-catalog
  labels:
    trino: simple-trino
spec:
  connector:
    hive:
      metastore:
        configMap: simple-hive
      s3:
        inline:
          host: test-minio
          port: 9000
          accessStyle: Path
          credentials:
            secretClass: minio-credentials
---
apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCatalog
metadata:
  name: iceberg
  labels:
    trino: simple-trino
spec:
  connector:
    iceberg:
      metastore:
        configMap: simple-hive
      s3:
        inline:
          host: test-minio
          port: 9000
          accessStyle: Path
          credentials:
            secretClass: minio-credentials

The metadata.name is the name of the catalog that shows up in your Trino instance. The metadata.labels are used by TrinoCluster to determine the link between Trino clusters and TrinoCatalogs. The spec.connector.<connector> determines which connector is used. Each connector supports a different set of attributes.

Config overrides and config removals

You can use .spec.configOverrides to set arbitrary additional properties, which will be added to the catalog.

There is also .spec.experimentalConfigRemovals to remove any properties the operator might set, but are not used by Trino. This causes Trino to refuse to startup with an error message such as Error: Configuration property 'hive.s3.aws-access-key' was not used. By removing the unneeded properties you can get Trino to start again.

This example illustrates how to use config overrides and config removals

apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCatalog
spec:
  # Add some properties
  configOverrides:
    hive.metastore.username: trino
  # Remove some properties
  experimentalConfigRemovals:
    - hive.s3.aws-access-key

Add a catalog to a Trino cluster

It is necessary to specify within the TrinoCluster which catalogs it should use. Here is an example of this:

apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCluster
metadata:
  name: simple-trino
spec:
  image:
    productVersion: "470"
  clusterConfig:
    catalogLabelSelector:
      matchLabels:
        trino: simple-trino
# ...

The spec.catalogLabelSelector is used to fetch the list of TrinoCatalogs used for this Trino cluster. In this case the hive and iceberg catalogs will be used as they both match the catalogLabelSelector value simple-trino.

A TrinoCluster can, once created, detect and use new catalogs that have been subsequently created with a matching label. This also means that it is possible to reuse a TrinoCatalog within multiple TrinoClusters.

Generic fallback connector

Trino supports lots of different connectors and we can not cover all the available connectors. In case the Trino operator does not support a specific connector, there is a fallback mechanism: The Generic.