Creating a Managed Service for Trino catalog
A Trino catalog defines a connection to an external data source. Each catalog is described using a TrinoCatalog resource and associated with a specific cluster via the spec.cluster field.
Supported catalog types:
postgresql: PostgreSQL connection.clickhouse: ClickHouse® connection.iceberg: Apache Iceberg™ connection via the REST catalog.
Note
When you create a catalog, Managed Service for Trino recreates the cluster. While the new configuration is being applied, the cluster switches to Updating, and active queries get interrupted. For more information, see Updating a cluster.
Using the CLI
-
Prepare a Secret containing credentials for connecting to the data source.
-
Create the
TrinoCatalogresource file, e.g., using thetouch trinocatalog.yamlcommand. -
Open the file and paste the configuration for the appropriate catalog type:
PostgreSQL--- apiVersion: v1 kind: Secret metadata: name: postgres-secret stringData: username: <username> password: <user_password> --- apiVersion: trino.stackland.yandex.cloud/v1alpha1 kind: TrinoCatalog metadata: name: postgresql-test-trino-full spec: cluster: trino-full type: postgresql name: postgresql-test postgres: url: postgres.example.svc.cluster.local:5432/database credentialsSecretRef: name: postgres-secret usernameKey: username passwordKey: passwordSettings:
spec.cluster: Name of the Trino cluster you want to associate the catalog with.spec.name: Catalog name in Trino (used in SQL queries, such asSELECT * FROM <catalog_name>.schema.table).spec.postgres.url: PostgreSQL server address inhost:port/databaseformat.spec.postgres.credentialsSecretRef: Reference to the Secret with credentials, and the names ofusernameKeyandpasswordKey.
Tip
Make sure the resource name (
metadata.name) follows the<spec.name>-<spec.cluster>format as shown above. Otherwise, the operator will reject catalog creation. -
Apply the manifest:
kubectl apply -f trinocatalog.yaml -n <namespace>.
Using the management console
-
If you have not opened a project yet, select one.
-
Select the namespace the cluster was created in.
-
In the left-hand menu, select Trino → Clusters.
-
Select the cluster.
-
Open the Catalogs tab and click Create catalog.
-
Fill out the fields as follows:
Basic settings
- Name: Catalog name in Trino. It is defined in
spec.name. The management console automatically uses the<catalog_name>-<cluster_name>format for the Kubernetes resource name (metadata.name). - Type: Connector type. Valid values:
postgresql,clickhouse,iceberg.
After selecting the type, the Catalog settings section appears.
Catalog settings: PostgreSQL
- URL: Server address in
host:port/databaseformat. - Username: PostgreSQL user.
- Password: User password.
Catalog settings: ClickHouse
- URL: Server address in
host:port/databaseformat. - Username: ClickHouse® user.
- Password: User password.
Catalog settings: Iceberg (REST catalog)
Connection:
- URL: REST catalog URL.
- Warehouse: REST catalog name. This is an optional setting.
Authentication (optional subsection):
- Authentication method:
No authentication,Static token, orClient credentials. - For a static token: Access token.
- For client credentials: Authorization server URL, Client ID, and Client secret. For a platform Iceberg REST Catalog, set Client ID and Client secret to
clientIdandclientSecretof theRestCatalogPrincipaluser, respectively. In the Additional submenu, you can specify Scope, Token update, and Token exchange.
Data storage:
- Storage type:
s3orstackland-storage.stackland-storageis only available for clusters with enabled Object Storage. - For
s3: Endpoint, Region, Access key ID, Secret access key, and Path-style access. - For
stackland-storage: Bucket: Selecting a bucket from the list ofBucketresources in the current namespace.
Additional settings (optional)
This section contains custom connector settings in
key-valueformat. You can add each key only once. - Name: Catalog name in Trino. It is defined in
-
Click Create.
The new catalog is ready and shown in the Catalogs list. After the operator applies the new configuration and the cluster switches to Running, the catalog will be available in SQL queries.