[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for Trino](../index.md) > [Step-by-step guides](index.md) > Catalogs > Creating a catalog

# Creating a Trino catalog

## Roles for creating a Trino catalog {#roles}

To create a [Trino catalog](../concepts/index.md#catalog) with the [Connection Manager](../../metadata-hub/concepts/connection-manager.md) connection type, your Yandex Cloud account needs an additional role, [connection-manager.user](../../metadata-hub/security/connection-manager-roles.md#connection-manager-user), to use connections from Connection Manager.

Make sure you assign the [connection-manager.user](../../metadata-hub/security/connection-manager-roles.md#connection-manager-user) and [lockbox.payloadViewer](../../lockbox/security/index.md#lockbox-payloadViewer) roles to the cluster [service account](../../iam/concepts/users/service-accounts.md). The cluster will thus get the permissions it needs to work with connections from Connection Manager. For more information, see [Impersonation](../concepts/impersonation.md).

For more information about assigning roles, see [this Yandex Identity and Access Management guide](../../iam/operations/roles/grant.md).

## Creating a Trino catalog {#create-catalog}

{% list tabs group=instructions %}

- Management console {#console}

  1. Go to the [resource folder](https://console.yandex.cloud) page.
  1. Navigate to **Managed Service for&nbsp;Trino**.
  1. Click the cluster name.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/folder-tree.svg) **Catalogs**.
  1. Click **Create catalog**.
  1. In the **Catalog name** field, enter the catalog name, Trino.
  1. In the **Connector type** field, select the [connector](../concepts/index.md#connector) type.
  1. Configure [Trino catalog settings](#catalog-settings).
  1. Click **Create**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    1. View the description of the CLI command for creating a Trino catalog:

        ```bash
        yc managed-trino catalog create --help
        ```

    1. View the description of the CLI command for creating a Trino catalog with a specific connector:

        ```bash
        yc managed-trino catalog create <connector_type> --help
        ```

    1. To create a Trino catalog, run this command:

        ```bash
        yc managed-trino catalog create <connector_type> <Trino_catalog_name>
        ```

        In the command, you also need to provide the settings for your Trino catalog depending on the connector type. [Learn more about settings for various connector types](#catalog-settings).

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        To learn how to create this file, refer to [Creating a cluster](cluster-create.md).

    1. Add the `yandex_trino_catalog` resource:

        ```hcl
        resource "yandex_trino_catalog" "<Trino_catalog_name>" {
          name        = "<Trino_catalog_name>"
          cluster_id  = yandex_trino_cluster.<cluster_name>.id
          <connector_type> = {
            <Trino_catalog_settings>
          }
        }
        ```

        [Learn more about the Trino catalog settings](#catalog-settings) for various connector types.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Use the [Catalog.Create](../api-ref/Catalog/create.md) method and run the request, e.g., using [cURL](https://curl.se/):

        ```bash
        curl \
            --request POST \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
            --data '{
                      "catalog": {
                        "name": "<Trino_catalog_name>",
                        "connector": {
                          "<connector_type>": {
                            <Trino_catalog_settings>
                          }
                        }
                      }
                    }'
        ```

        [Learn more about the Trino](#catalog-settings) catalog settings for various connector types.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Catalog/create.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [CatalogService.Create](../api-ref/grpc/Catalog/create.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "<connector_type>": {
                            <Trino_catalog_settings>
                      }
                    }
                  }
                }' \
            trino.api.cloud.yandex.net:443 \
            yandex.cloud.trino.v1.CatalogService.Create
        ```

        [Learn more about the Trino](#catalog-settings) catalog settings for various connector types.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Catalog/create.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Trino catalog settings {#catalog-settings}

Trino catalog settings depend on the connector you select.

{% note info %}

Connectors marked with <code><b><small>Preview</small></b></code> are at the preview stage. Their stability is not guaranteed.

{% endnote %}

### ClickHouse® connector {#ch}

Select the connection type: [Connection Manager](../../metadata-hub/concepts/connection-manager.md) or **Manual setup** (custom installation), and configure it as needed.

With Connection Manager, you can create connections to a cluster with a managed database or to a custom database installation.

When connecting via Connection Manager, Trino automatically detects and applies any changes to the connection parameters. For connections of the **Manual setup** type, Trino does not track connection parameter changes. You need to track and apply them manually.

#### Connection Manager {#ch-connection-manager}

{% list tabs group=instructions %}

- Management console {#console}

    * **Connection ID**: Connection ID in Connection Manager for connection to the ClickHouse® cluster.

        To find out the connection ID:
        1. Go to the [resource folder](https://console.yandex.cloud) page.
        1. Navigate to **Managed Service for&nbsp;ClickHouse**.
        1. Click the cluster name and navigate to the **Connections** tab.

    * **Database**: DB name in the ClickHouse® cluster.
    * **Client parameters**: ClickHouse® client parameters in `key: value` format.

        {% cut "Available parameters" %}
        
        * `async`: Use of asynchronous mode, `true` or `false`.
        
        * `buffer_queue_variation`: How many times the buffer can be filled up before its size is increased.
        
        * `buffer_size`: Buffer size, increases to `max_buffer_size` on overflow.
        
        * `client_name`: Client name.
        
        * `compress`: Data compression in the server response, `true` or `false`.
        
        * `compress_algorithm`: Data compression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
        
        * `compress_level`: Data compression level.
        
        * `connect_timeout`: Maximum server connection timeout, in milliseconds.
        
        * `decompress`: Decompressing data in client request, `true` or `false`.
        
        * `decompress_algorithm`: Data decompression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
        
        * `decompress_level`: Data decompression level.
        
        * `failover`: Maximum number of attempts to connect to replicas if the server is unavailable.
        
        * `load_balancing_policy`: Replica selection algorithm for connection.
        
            * `firstAlive`: Request goes to the first available replica.
            * `random`: Request goes to a random replica.
            * `roundRobin`: Applies the [Round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) policy to select a replica.
        
        * `max_buffer_size`: Maximum buffer size.
        
        * `max_threads_per_client`: Maximum number of threads per client.
        
        * `product_name`: Product name in `User-Agent`.
        
        * `read_buffer_size`: Read buffer size, in bytes. The default value is `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
        
        * `request_buffering`: Request buffering mode.
        
            * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
            * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
            * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
        
        * `request_chunk_size`: Request chunk size, in bytes.
        
        * `response_buffering`: Response buffering mode.
        
            * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
            * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
            * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
        
        * `server_time_zone`: Serve time zone.
        
        * `use_server_time_zone`: Use of the server time zone, `true` or `false`.
        
        * `use_server_time_zone_for_dates`: Use of the server time zone when processing the `Date` values, `true` or `false`.
        
        * `use_time_zone`: What time zone to use, i.e., `Europe/Amsterdam`. Applies if `use_server_time_zone` is `false`.
        
        * `write_buffer_size`: Write buffer size, in bytes. By default, equals `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
        
        {% endcut %}

    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create clickhouse <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --connection-manager-connection-id <connection_ID> \
      --connection-manager-database <DB_name> \
      --connection-manager-connection-properties <list_of_ClickHouse®_client_parameters> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--connection-manager-connection-id`: Connection ID in Connection Manager for connecting to the ClickHouse® cluster.

      To find out the connection ID:
        1. Go to the [resource folder](https://console.yandex.cloud) page.
        1. Navigate to **Managed Service for&nbsp;ClickHouse**.
        1. Click the cluster name and navigate to the **Connections** tab.   

    * `--connection-manager-database`: DB name in the ClickHouse® cluster.
    * `--connection-manager-connection-properties`: ClickHouse® client parameters in `key=value` format.

        {% cut "Available parameters" %}
        
        * `async`: Use of asynchronous mode, `true` or `false`.
        
        * `buffer_queue_variation`: How many times the buffer can be filled up before its size is increased.
        
        * `buffer_size`: Buffer size, increases to `max_buffer_size` on overflow.
        
        * `client_name`: Client name.
        
        * `compress`: Data compression in the server response, `true` or `false`.
        
        * `compress_algorithm`: Data compression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
        
        * `compress_level`: Data compression level.
        
        * `connect_timeout`: Maximum server connection timeout, in milliseconds.
        
        * `decompress`: Decompressing data in client request, `true` or `false`.
        
        * `decompress_algorithm`: Data decompression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
        
        * `decompress_level`: Data decompression level.
        
        * `failover`: Maximum number of attempts to connect to replicas if the server is unavailable.
        
        * `load_balancing_policy`: Replica selection algorithm for connection.
        
            * `firstAlive`: Request goes to the first available replica.
            * `random`: Request goes to a random replica.
            * `roundRobin`: Applies the [Round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) policy to select a replica.
        
        * `max_buffer_size`: Maximum buffer size.
        
        * `max_threads_per_client`: Maximum number of threads per client.
        
        * `product_name`: Product name in `User-Agent`.
        
        * `read_buffer_size`: Read buffer size, in bytes. The default value is `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
        
        * `request_buffering`: Request buffering mode.
        
            * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
            * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
            * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
        
        * `request_chunk_size`: Request chunk size, in bytes.
        
        * `response_buffering`: Response buffering mode.
        
            * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
            * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
            * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
        
        * `server_time_zone`: Serve time zone.
        
        * `use_server_time_zone`: Use of the server time zone, `true` or `false`.
        
        * `use_server_time_zone_for_dates`: Use of the server time zone when processing the `Date` values, `true` or `false`.
        
        * `use_time_zone`: What time zone to use, i.e., `Europe/Amsterdam`. Applies if `use_server_time_zone` is `false`.
        
        * `write_buffer_size`: Write buffer size, in bytes. By default, equals `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
        
        {% endcut %}

    * `additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      clickhouse = {
        connection_manager = {
          connection_id = "<connection_ID>"
          database      = "<DB_name>"
          connection_properties = {
            <list_of_ClickHouse®_client_settings>
          }
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Connection ID in Connection Manager for connecting to the ClickHouse® cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;ClickHouse**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `database`: DB name in the ClickHouse® cluster.
        * `connection_properties`: List of ClickHouse® client settings in `"key" = "value"` format.

            {% cut "Available parameters" %}
            
            * `async`: Use of asynchronous mode, `true` or `false`.
            
            * `buffer_queue_variation`: How many times the buffer can be filled up before its size is increased.
            
            * `buffer_size`: Buffer size, increases to `max_buffer_size` on overflow.
            
            * `client_name`: Client name.
            
            * `compress`: Data compression in the server response, `true` or `false`.
            
            * `compress_algorithm`: Data compression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
            
            * `compress_level`: Data compression level.
            
            * `connect_timeout`: Maximum server connection timeout, in milliseconds.
            
            * `decompress`: Decompressing data in client request, `true` or `false`.
            
            * `decompress_algorithm`: Data decompression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
            
            * `decompress_level`: Data decompression level.
            
            * `failover`: Maximum number of attempts to connect to replicas if the server is unavailable.
            
            * `load_balancing_policy`: Replica selection algorithm for connection.
            
                * `firstAlive`: Request goes to the first available replica.
                * `random`: Request goes to a random replica.
                * `roundRobin`: Applies the [Round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) policy to select a replica.
            
            * `max_buffer_size`: Maximum buffer size.
            
            * `max_threads_per_client`: Maximum number of threads per client.
            
            * `product_name`: Product name in `User-Agent`.
            
            * `read_buffer_size`: Read buffer size, in bytes. The default value is `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
            
            * `request_buffering`: Request buffering mode.
            
                * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
                * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
                * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
            
            * `request_chunk_size`: Request chunk size, in bytes.
            
            * `response_buffering`: Response buffering mode.
            
                * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
                * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
                * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
            
            * `server_time_zone`: Serve time zone.
            
            * `use_server_time_zone`: Use of the server time zone, `true` or `false`.
            
            * `use_server_time_zone_for_dates`: Use of the server time zone when processing the `Date` values, `true` or `false`.
            
            * `use_time_zone`: What time zone to use, i.e., `Europe/Amsterdam`. Applies if `use_server_time_zone` is `false`.
            
            * `write_buffer_size`: Write buffer size, in bytes. By default, equals `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
            
            {% endcut %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "clickhouse": {
                        "connection": {
                          "connectionManager": {
                            "connectionId": "<connection_ID>",
                            "database": "<DB_name>",
                            "connectionProperties": {
                              <list_of_ClickHouse®_client_settings>
                            }
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `connectionManager`: Connection Manager settings:

        * `connectionId`: Connection ID in Connection Manager for connecting to the ClickHouse® cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;ClickHouse**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `database`: DB name in the ClickHouse® cluster.
        * `connectionProperties`: List of ClickHouse® client settings in `"key": "value"` format.

            {% cut "Available parameters" %}
            
            * `async`: Use of asynchronous mode, `true` or `false`.
            
            * `buffer_queue_variation`: How many times the buffer can be filled up before its size is increased.
            
            * `buffer_size`: Buffer size, increases to `max_buffer_size` on overflow.
            
            * `client_name`: Client name.
            
            * `compress`: Data compression in the server response, `true` or `false`.
            
            * `compress_algorithm`: Data compression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
            
            * `compress_level`: Data compression level.
            
            * `connect_timeout`: Maximum server connection timeout, in milliseconds.
            
            * `decompress`: Decompressing data in client request, `true` or `false`.
            
            * `decompress_algorithm`: Data decompression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
            
            * `decompress_level`: Data decompression level.
            
            * `failover`: Maximum number of attempts to connect to replicas if the server is unavailable.
            
            * `load_balancing_policy`: Replica selection algorithm for connection.
            
                * `firstAlive`: Request goes to the first available replica.
                * `random`: Request goes to a random replica.
                * `roundRobin`: Applies the [Round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) policy to select a replica.
            
            * `max_buffer_size`: Maximum buffer size.
            
            * `max_threads_per_client`: Maximum number of threads per client.
            
            * `product_name`: Product name in `User-Agent`.
            
            * `read_buffer_size`: Read buffer size, in bytes. The default value is `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
            
            * `request_buffering`: Request buffering mode.
            
                * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
                * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
                * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
            
            * `request_chunk_size`: Request chunk size, in bytes.
            
            * `response_buffering`: Response buffering mode.
            
                * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
                * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
                * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
            
            * `server_time_zone`: Serve time zone.
            
            * `use_server_time_zone`: Use of the server time zone, `true` or `false`.
            
            * `use_server_time_zone_for_dates`: Use of the server time zone when processing the `Date` values, `true` or `false`.
            
            * `use_time_zone`: What time zone to use, i.e., `Europe/Amsterdam`. Applies if `use_server_time_zone` is `false`.
            
            * `write_buffer_size`: Write buffer size, in bytes. By default, equals `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
            
            {% endcut %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "clickhouse": {
                    "connection": {
                      "connection_manager": {
                        "connection_id": "<connection_ID>",
                        "database": "<DB_name>",
                        "connection_properties": {
                          <list_of_ClickHouse®_client_settings>
                        }
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Connection ID in Connection Manager for connecting to the ClickHouse® cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;ClickHouse**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `database`: DB name in the ClickHouse® cluster.
        * `connection_properties`: List of ClickHouse® client settings in `"key": "value"` format.

            {% cut "Available parameters" %}
            
            * `async`: Use of asynchronous mode, `true` or `false`.
            
            * `buffer_queue_variation`: How many times the buffer can be filled up before its size is increased.
            
            * `buffer_size`: Buffer size, increases to `max_buffer_size` on overflow.
            
            * `client_name`: Client name.
            
            * `compress`: Data compression in the server response, `true` or `false`.
            
            * `compress_algorithm`: Data compression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
            
            * `compress_level`: Data compression level.
            
            * `connect_timeout`: Maximum server connection timeout, in milliseconds.
            
            * `decompress`: Decompressing data in client request, `true` or `false`.
            
            * `decompress_algorithm`: Data decompression algorithm. The possible values are: [BROTLI](https://en.wikipedia.org/wiki/Brotli), [BZ2](https://en.wikipedia.org/wiki/Bzip2), [DEFLATE](https://en.wikipedia.org/wiki/Deflate), [GZIP](https://en.wikipedia.org/wiki/Gzip), [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)), [SNAPPY](https://en.wikipedia.org/wiki/Snappy_(compression)), [XZ](https://en.wikipedia.org/wiki/XZ_Utils), [ZSTD](https://en.wikipedia.org/wiki/Zstd), or `NONE`.
            
            * `decompress_level`: Data decompression level.
            
            * `failover`: Maximum number of attempts to connect to replicas if the server is unavailable.
            
            * `load_balancing_policy`: Replica selection algorithm for connection.
            
                * `firstAlive`: Request goes to the first available replica.
                * `random`: Request goes to a random replica.
                * `roundRobin`: Applies the [Round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) policy to select a replica.
            
            * `max_buffer_size`: Maximum buffer size.
            
            * `max_threads_per_client`: Maximum number of threads per client.
            
            * `product_name`: Product name in `User-Agent`.
            
            * `read_buffer_size`: Read buffer size, in bytes. The default value is `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
            
            * `request_buffering`: Request buffering mode.
            
                * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
                * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
                * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
            
            * `request_chunk_size`: Request chunk size, in bytes.
            
            * `response_buffering`: Response buffering mode.
            
                * `RESOURCE_EFFICIENT`: Provides moderate performance with minimum use of CPU and RAM. This mode relies only on the buffer size, no queue is used.
                * `PERFORMANCE`: Maximizes performance by actively utilizing CPU and RAM.
                * `CUSTOM`: Allows manual buffering settings to balance out resource utilization and desired performance.
            
            * `server_time_zone`: Serve time zone.
            
            * `use_server_time_zone`: Use of the server time zone, `true` or `false`.
            
            * `use_server_time_zone_for_dates`: Use of the server time zone when processing the `Date` values, `true` or `false`.
            
            * `use_time_zone`: What time zone to use, i.e., `Europe/Amsterdam`. Applies if `use_server_time_zone` is `false`.
            
            * `write_buffer_size`: Write buffer size, in bytes. By default, equals `buffer_size`. When the buffer is full, the size gets increased to `max_buffer_size`.
            
            {% endcut %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

#### Manual setup {#ch-on-premise}

{% list tabs group=instructions %}

- Management console {#console}

    * **URL**: URL for connecting to the ClickHouse® DB, in `jdbc:clickhouse://<host_address>:<port>/<DB_name>` format.
    * **Username**: Username for connecting to the ClickHouse® DB.
    * **Password**: User password for connection to the ClickHouse® DB.
    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create clickhouse <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --on-premise-connection-url <URL_for_connection> \
      --on-premise-user-name <username> \
      --on-premise-password <user_password> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--on-premise-connection-url`: URL for connecting to the ClickHouse® DB, in the following format: `jdbc:clickhouse://<host_address>:<port>/<DB_name>`.
    * `--on-premise-user-name`: Username for connection to the ClickHouse® DB.
    * `--on-premise-password`: User password for connection to the ClickHouse® DB.
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      clickhouse = {
        on_premise = {
          connection_url = "<URL_for_connection>"
          user_name      = "<username>"
          password       = "<user_password>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connection to the ClickHouse® DB, in `jdbc:clickhouse://<host_address>:<port>/<DB_name>` format.
        * `user_name`: Username for connection to the ClickHouse® DB.
        * `password`: User password for connection to the ClickHouse® DB.

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "clickhouse": {
                        "connection": {
                          "onPremise": {
                            "connectionUrl": "<URL_for_connection>",
                            "userName": "<username>",
                            "password": "<user_password>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `onPremise`: Settings for connecting to the custom installation:

        * `connectionUrl`: URL for connection to the ClickHouse® DB, in `jdbc:clickhouse://<host_address>:<port>/<DB_name>` format.
        * `userName`: Username for connection to the ClickHouse® DB.
        * `password`: User password for connection to the ClickHouse® DB.

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "clickhouse": {
                    "connection": {
                      "on_premise": {
                        "connection_url": "<URL_for_connection>",
                        "user_name": "<username>",
                        "password": "<user_password>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connection to the ClickHouse® DB, in `jdbc:clickhouse://<host_address>:<port>/<DB_name>` format.
        * `user_name`: Username for connection to the ClickHouse® DB.
        * `password`: User password for connection to the ClickHouse® DB.

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/clickhouse.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### Delta Lake connector {#delta-lake}

{% list tabs group=instructions %}

- Management console {#console}

    * **URI**: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the IP address of your Apache Hive™ Metastore cluster:
          1. Go to the [resource folder](https://console.yandex.cloud) page.
          1. Navigate to **Yandex MetaData Hub**.
          1. In the left-hand panel, select ![image](../../_assets/console-icons/database.svg) **Metastore**.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}
    
    * **File storage**: File storage type. The available options are [Yandex Object Storage](../../storage/quickstart/overview.md) and external storage.
    
        For external storage, specify:
    
          * **Access key ID**: ID of an AWS-compatible static access key.
          * **Secret key**: Secret key of an AWS-compatible static access key.
          * **Endpoint**: File storage endpoint, e.g., `storage.yandexcloud.net`.
          * **Region**: File storage region, e.g., `ru-central1`.

    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/delta-lake.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create delta-lake <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --metastore-hive-uri <URI_for_connection> \
      --filesystem-native-s3 \
      --filesystem-external-s3-aws-access-key <access_key_ID> \
      --filesystem-external-s3-aws-secret-key <secret_key> \
      --filesystem-external-s3-aws-endpoint <endpoint> \
      --filesystem-external-s3-aws-region <region> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster where you are creating your Trino catalog. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--metastore-hive-uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
      To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
      {% note warning %}
      
      For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
      
      {% endnote %}
    
    * `--filesystem-native-s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
    * `--filesystem-external-s3-aws-access-key`: ID of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-secret-key`: Secret key of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
    * `--filesystem-external-s3-aws-region`: File storage region, e.g., `ru-central1`.
    
      {% note info %}
    
      Specify either the `--filesystem-native-s3` flag to use an Object Storage, or flags of the `--filesystem-external-s3-aws` group to use an external storage.
    
      {% endnote %}

    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/delta-lake.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      delta_lake = {
        file_system = {
          s3 = {}
        }
        metastore = {
          uri = "<URI_for_connection>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `file_system`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/delta-lake.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "deltaLake": {
                        "filesystem": {
                          "s3": {}
                        },
                        "metastore": {
                          "hive": {
                            "uri": "<URI_for_connection>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `externalS3`: External storage. You need to specify additional parameters for this one:
    
            * `awsAccessKey`: ID of AWS-compatible static access key.
            * `awsSecretKey`: Secret key of AWS-compatible static access key.
            * `awsEndpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `awsRegion`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/delta-lake.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "delta_lake": {
                    "filesystem": {
                      "s3": {}
                    },
                    "metastore": {
                      "hive": {
                        "uri": "<URI_for_connection>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/delta-lake.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### Greenplum®/Cloudberry <code><b><small>Preview</small></b></code> connector {#gp-clouberry}

Select the connection type: [Connection Manager](../../metadata-hub/concepts/connection-manager.md) or **Manual setup** (custom installation), and configure it as needed.

With Connection Manager, you can create connections to a cluster with a managed database or to a custom database installation.

When connecting via Connection Manager, Trino automatically detects and applies any changes to the connection parameters. For connections of the **Manual setup** type, Trino does not track connection parameter changes. You need to track and apply them manually.

To enable [parallel data reading](../concepts/greenplum-connector.md#parallel-reading), assign read privileges for the `pg_catalog.gp_segment_configuration` table to the Greenplum® user intended to run the connection:

```sql
GRANT SELECT ON pg_catalog.gp_segment_configuration TO <Greenplum®_username>;
```

To enable [reading data directly from segments](../concepts/greenplum-connector.md#gpfdist-reading) over GPFDIST, assign the Greenplum® user permissions to create external tables:

```sql
ALTER ROLE <Greenplum®_username> CREATEEXTTABLE (type='writable');
```

{% note warning %}

Data transmitted between the Managed Service for Trino and Yandex MPP Analytics for PostgreSQL clusters over the GPFDIST protocol is unencrypted. To secure your connection, [configure cluster security groups](connect.md#security-groups-for-greenplum).

{% endnote %}

For more information on the connectors, see [Greenplum®/Cloudberry connector](../concepts/greenplum-connector.md).

#### Connection Manager {#gp-clouberry-connection-manager}

{% list tabs group=instructions %}

- Management console {#console}

    * **Connection ID**: Greenplum® cluster connection ID in Connection Manager.

        To find out the connection ID:
        
        1. Navigate to the [resource folder](https://console.yandex.cloud) page.
        1. [Navigate](../../console/operations/select-service.md#select-service) to **Yandex MetaData Hub**.
        1. Navigate to the **Connection manager** tab.

    * **Database**: DB name in the Greenplum® cluster.
    * **Additional settings**: Provide them in `key:value` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create greenplum <Trino_catalog_name> \
      --cluster-id <Trino_cluster_ID> \
      --connection-manager-connection-id <connection_ID> \
      --connection-manager-database <DB_name> \
      --connection-manager-connection-properties <list_of_Greenplum®_client_settings> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the ID along with the [list of clusters](cluster-list.md#list-clusters).
    * `--connection-manager-connection-id`: Greenplum® cluster connection ID in Connection Manager.

        To find out the connection ID:
        
        1. Navigate to the [resource folder](https://console.yandex.cloud) page.
        1. [Navigate](../../console/operations/select-service.md#select-service) to **Yandex MetaData Hub**.
        1. Navigate to the **Connection manager** tab.

    * `--connection-manager-database`: DB name in the Greenplum® cluster.
    * `--connection-manager-connection-properties`: List of Greenplum® client settings in `key=value` format.

        {% cut "Available parameters" %}
        
        * `ApplicationName`: Name of the application using the connection.
        * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
        * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
        * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
        
            * `false` (default): Connect hosts in the specified order.
            * `true`: Randomly select hosts from a pool of suitable candidates.
        
        * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
        
            * In bytes, e.g., `100`, `200M`, or `2G`.
            * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
        
            By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
        
        * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
        * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
        * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
        
            * `ignore`: Ignores the `readOnly` parameter.
            * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
        
        * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
        * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
        * `targetServerType`: Defines which server type to connect to. The possible values are:
        
            * `any` (default)
            * `primary`
            * `secondary`
            * `preferPrimary`
            * `preferSecondary`
        
        {% endcut %}

    * `--additional-properties`: Additional settings in `key=value` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      greenplum = {
        connection_manager = {
          connection_id = "<connection_ID>"
          database      = "<DB_name>"
          connection_properties = {
            <list_of_Greenplum®_client_settings>
          }
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Greenplum® cluster connection ID in Connection Manager.

            To find out the connection ID:
            
            1. Navigate to the [resource folder](https://console.yandex.cloud) page.
            1. [Navigate](../../console/operations/select-service.md#select-service) to **Yandex MetaData Hub**.
            1. Navigate to the **Connection manager** tab.

        * `database`: DB name in the Greenplum® cluster.
        * `connection_properties`: List of Greenplum® client settings in `"key" = "value"` format.

            {% cut "Available parameters" %}
            
            * `ApplicationName`: Name of the application using the connection.
            * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
            * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
            * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
            
                * `false` (default): Connect hosts in the specified order.
                * `true`: Randomly select hosts from a pool of suitable candidates.
            
            * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
            
                * In bytes, e.g., `100`, `200M`, or `2G`.
                * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
            
                By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
            
            * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
            * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
            * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
            
                * `ignore`: Ignores the `readOnly` parameter.
                * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
                * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            
            * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
            * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
            * `targetServerType`: Defines which server type to connect to. The possible values are:
            
                * `any` (default)
                * `primary`
                * `secondary`
                * `preferPrimary`
                * `preferSecondary`
            
            {% endcut %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<Trino>_cluster_ID/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "greenplum": {
                        "connection": {
                          "connectionManager": {
                            "connectionId": "<connection_ID>",
                            "database": "<DB_name>",
                            "connectionProperties": {
                              <list_of_Greenplum®_client_settings>
                            }
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `connectionManager`: Connection Manager settings:

        * `connectionId`: Greenplum® cluster connection ID in Connection Manager.

            To find out the connection ID:
            
            1. Navigate to the [resource folder](https://console.yandex.cloud) page.
            1. [Navigate](../../console/operations/select-service.md#select-service) to **Yandex MetaData Hub**.
            1. Navigate to the **Connection manager** tab.

        * `database`: DB name in the Greenplum® cluster.
        * `connectionProperties`: List of Greenplum® client settings in `"key": "value"` format.

            {% cut "Available parameters" %}
            
            * `ApplicationName`: Name of the application using the connection.
            * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
            * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
            * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
            
                * `false` (default): Connect hosts in the specified order.
                * `true`: Randomly select hosts from a pool of suitable candidates.
            
            * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
            
                * In bytes, e.g., `100`, `200M`, or `2G`.
                * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
            
                By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
            
            * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
            * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
            * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
            
                * `ignore`: Ignores the `readOnly` parameter.
                * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
                * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            
            * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
            * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
            * `targetServerType`: Defines which server type to connect to. The possible values are:
            
                * `any` (default)
                * `primary`
                * `secondary`
                * `preferPrimary`
                * `preferSecondary`
            
            {% endcut %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

    You can get the Trino cluster ID with the [list of clusters in the catalog](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<Trino_cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "greenplum": {
                    "connection": {
                      "connection_manager": {
                        "connection_id": "<connection_ID>",
                        "database": "<DB_name>",
                        "connection_properties": {
                          <list_of_Greenplum®_client_settings>
                        }
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Greenplum® cluster connection ID in Connection Manager.

            To find out the connection ID:
            
            1. Navigate to the [resource folder](https://console.yandex.cloud) page.
            1. [Navigate](../../console/operations/select-service.md#select-service) to **Yandex MetaData Hub**.
            1. Navigate to the **Connection manager** tab.

        * `database`: DB name in the Greenplum® cluster.
        * `connection_properties`: List of Greenplum® client settings in `"key": "value"` format.

            {% cut "Available parameters" %}
            
            * `ApplicationName`: Name of the application using the connection.
            * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
            * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
            * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
            
                * `false` (default): Connect hosts in the specified order.
                * `true`: Randomly select hosts from a pool of suitable candidates.
            
            * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
            
                * In bytes, e.g., `100`, `200M`, or `2G`.
                * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
            
                By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
            
            * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
            * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
            * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
            
                * `ignore`: Ignores the `readOnly` parameter.
                * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
                * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            
            * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
            * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
            * `targetServerType`: Defines which server type to connect to. The possible values are:
            
                * `any` (default)
                * `primary`
                * `secondary`
                * `preferPrimary`
                * `preferSecondary`
            
            {% endcut %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

    You can get the Trino cluster ID with the [list of clusters in the catalog](cluster-list.md#list-clusters).

{% endlist %}

#### Manual setup {#gp-cloudberry-on-premise}

{% list tabs group=instructions %}

- Management console {#console}

    * **URL**: URL for connecting to the Greenplum® DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
    * **Username**: Username for connecting to the Greenplum® DB.
    * **Password**: User password for connection to the Greenplum® DB.
    * **Additional settings**: Provide them in `key:value` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create greenplum <Trino_catalog_name> \
      --cluster-id <Trino_cluster_ID> \
      --on-premise-connection-url <URL_for_connection> \
      --on-premise-user-name <username> \
      --on-premise-password <user_password> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--on-premise-connection-url`: URL for connecting to the Greenplum® DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
    * `--on-premise-user-name`: Username for connection to the Greenplum® DB.
    * `--on-premise-password`: User password for connection to the Greenplum® DB.
    * `--additional-properties`: Additional settings in `key=value` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      greenplum = {
        on_premise = {
          connection_url = "<URL_for_connection>"
          user_name      = "<username>"
          password       = "<user_password>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the Greenplum® DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
        * `user_name`: Username for connection to the Greenplum® DB.
        * `password`: User password for connection to the Greenplum® DB.

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<Trino_cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "greenplum": {
                        "connection": {
                          "onPremise": {
                            "connectionUrl": "<URL_for_connection>",
                            "userName": "<username>",
                            "password": "<user_password>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `onPremise`: Settings for connecting to the custom installation:

        * `connectionUrl`: URL for connecting to the Greenplum® DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
        * `userName`: Username for connection to the Greenplum® DB.
        * `password`: User password for connection to the Greenplum® DB.

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

    You can get the Trino cluster ID with the [list of clusters in the catalog](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<Trino_cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "greenplum": {
                    "connection": {
                      "on_premise": {
                        "connection_url": "<URL_for_connection>",
                        "user_name": "<username>",
                        "password": "<user_password>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the Greenplum® DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
        * `user_name`: Username for connection to the Greenplum® DB.
        * `password`: User password for connection to the Greenplum® DB.

    * `additional_properties`: List of additional settings in `"key": "value"` format. For the list of available settings, see [Greenplum® connector](../concepts/greenplum-connector.md#settings).

    You can get the Trino cluster ID with the [list of clusters in the catalog](cluster-list.md#list-clusters).

{% endlist %}

### Hive connector {#hive}

{% list tabs group=instructions %}

- Management console {#console}

    * **URI**: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the IP address of your Apache Hive™ Metastore cluster:
          1. Go to the [resource folder](https://console.yandex.cloud) page.
          1. Navigate to **Yandex MetaData Hub**.
          1. In the left-hand panel, select ![image](../../_assets/console-icons/database.svg) **Metastore**.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}
    
    * **File storage**: File storage type. The available options are [Yandex Object Storage](../../storage/quickstart/overview.md) and external storage.
    
        For external storage, specify:
    
          * **Access key ID**: ID of an AWS-compatible static access key.
          * **Secret key**: Secret key of an AWS-compatible static access key.
          * **Endpoint**: File storage endpoint, e.g., `storage.yandexcloud.net`.
          * **Region**: File storage region, e.g., `ru-central1`.

    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hive.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create hive <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --metastore-hive-uri <URI_for_connection> \
      --filesystem-native-s3 \
      --filesystem-external-s3-aws-access-key <access_key_ID> \
      --filesystem-external-s3-aws-secret-key <secret_key> \
      --filesystem-external-s3-aws-endpoint <endpoint> \
      --filesystem-external-s3-aws-region <region> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster where you are creating your Trino catalog. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--metastore-hive-uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
      To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
      {% note warning %}
      
      For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
      
      {% endnote %}
    
    * `--filesystem-native-s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
    * `--filesystem-external-s3-aws-access-key`: ID of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-secret-key`: Secret key of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
    * `--filesystem-external-s3-aws-region`: File storage region, e.g., `ru-central1`.
    
      {% note info %}
    
      Specify either the `--filesystem-native-s3` flag to use an Object Storage, or flags of the `--filesystem-external-s3-aws` group to use an external storage.
    
      {% endnote %}

    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hive.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      hive = {
        file_system = {
          s3 = {}
        }
        metastore = {
          uri = "<URI_for_connection>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `file_system`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hive.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "hive": {
                        "filesystem": {
                          "s3": {}
                        },
                        "metastore": {
                          "hive": {
                            "uri": "<URI_for_connection>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `externalS3`: External storage. You need to specify additional parameters for this one:
    
            * `awsAccessKey`: ID of AWS-compatible static access key.
            * `awsSecretKey`: Secret key of AWS-compatible static access key.
            * `awsEndpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `awsRegion`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hive.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "hive": {
                    "filesystem": {
                      "s3": {}
                    },
                    "metastore": {
                      "hive": {
                        "uri": "<URI_for_connection>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hive.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### Hudi connector <code><b><small>Preview</small></b></code> {#hudi}

{% list tabs group=instructions %}

- Management console {#console}

    * **URI**: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the IP address of your Apache Hive™ Metastore cluster:
          1. Go to the [resource folder](https://console.yandex.cloud) page.
          1. Navigate to **Yandex MetaData Hub**.
          1. In the left-hand panel, select ![image](../../_assets/console-icons/database.svg) **Metastore**.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}
    
    * **File storage**: File storage type. The available options are [Yandex Object Storage](../../storage/quickstart/overview.md) and external storage.
    
        For external storage, specify:
    
          * **Access key ID**: ID of an AWS-compatible static access key.
          * **Secret key**: Secret key of an AWS-compatible static access key.
          * **Endpoint**: File storage endpoint, e.g., `storage.yandexcloud.net`.
          * **Region**: File storage region, e.g., `ru-central1`.

    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hudi.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create hudi <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --metastore-hive-uri <URI_for_connection> \
      --filesystem-native-s3 \
      --filesystem-external-s3-aws-access-key <access_key_ID> \
      --filesystem-external-s3-aws-secret-key <secret_key> \
      --filesystem-external-s3-aws-endpoint <endpoint> \
      --filesystem-external-s3-aws-region <region> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster where you are creating your Trino catalog. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--metastore-hive-uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
      To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
      {% note warning %}
      
      For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
      
      {% endnote %}
    
    * `--filesystem-native-s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
    * `--filesystem-external-s3-aws-access-key`: ID of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-secret-key`: Secret key of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
    * `--filesystem-external-s3-aws-region`: File storage region, e.g., `ru-central1`.
    
      {% note info %}
    
      Specify either the `--filesystem-native-s3` flag to use an Object Storage, or flags of the `--filesystem-external-s3-aws` group to use an external storage.
    
      {% endnote %}

    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hudi.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      hudi = {
        file_system = {
          s3 = {}
        }
        metastore = {
          uri = "<URI_for_connection>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `file_system`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hive.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "hudi": {
                        "filesystem": {
                          "s3": {}
                        },
                        "metastore": {
                          "hive": {
                            "uri": "<URI_for_connection>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `externalS3`: External storage. You need to specify additional parameters for this one:
    
            * `awsAccessKey`: ID of AWS-compatible static access key.
            * `awsSecretKey`: Secret key of AWS-compatible static access key.
            * `awsEndpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `awsRegion`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hudi.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "hudi": {
                    "filesystem": {
                      "s3": {}
                    },
                    "metastore": {
                      "hive": {
                        "uri": "<URI_for_connection>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/hudi.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### Iceberg connector {#iceberg}

{% list tabs group=instructions %}

- Management console {#console}

    * **URI**: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the IP address of your Apache Hive™ Metastore cluster:
          1. Go to the [resource folder](https://console.yandex.cloud) page.
          1. Navigate to **Yandex MetaData Hub**.
          1. In the left-hand panel, select ![image](../../_assets/console-icons/database.svg) **Metastore**.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}
    
    * **File storage**: File storage type. The available options are [Yandex Object Storage](../../storage/quickstart/overview.md) and external storage.
    
        For external storage, specify:
    
          * **Access key ID**: ID of an AWS-compatible static access key.
          * **Secret key**: Secret key of an AWS-compatible static access key.
          * **Endpoint**: File storage endpoint, e.g., `storage.yandexcloud.net`.
          * **Region**: File storage region, e.g., `ru-central1`.

    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/iceberg.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create iceberg <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --metastore-hive-uri <URI_for_connection> \
      --filesystem-native-s3 \
      --filesystem-external-s3-aws-access-key <access_key_ID> \
      --filesystem-external-s3-aws-secret-key <secret_key> \
      --filesystem-external-s3-aws-endpoint <endpoint> \
      --filesystem-external-s3-aws-region <region> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster where you are creating your Trino catalog. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--metastore-hive-uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
      To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
      {% note warning %}
      
      For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
      
      {% endnote %}
    
    * `--filesystem-native-s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
    * `--filesystem-external-s3-aws-access-key`: ID of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-secret-key`: Secret key of AWS-compatible static access key.
    * `--filesystem-external-s3-aws-endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
    * `--filesystem-external-s3-aws-region`: File storage region, e.g., `ru-central1`.
    
      {% note info %}
    
      Specify either the `--filesystem-native-s3` flag to use an Object Storage, or flags of the `--filesystem-external-s3-aws` group to use an external storage.
    
      {% endnote %}

    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/iceberg.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      iceberg = {
        file_system = {
          s3 = {}
        }
        metastore = {
          uri = "<URI_for_connection>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `file_system`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/iceberg.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "iceberg": {
                        "filesystem": {
                          "s3": {}
                        },
                        "metastore": {
                          "hive": {
                            "uri": "<URI_for_connection>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `externalS3`: External storage. You need to specify additional parameters for this one:
    
            * `awsAccessKey`: ID of AWS-compatible static access key.
            * `awsSecretKey`: Secret key of AWS-compatible static access key.
            * `awsEndpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `awsRegion`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/iceberg.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "iceberg": {
                    "filesystem": {
                      "s3": {}
                    },
                    "metastore": {
                      "hive": {
                        "uri": "<URI_for_connection>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `filesystem`: File storage type. Available options:
    
        * `s3`: [Yandex Object Storage](../../storage/quickstart/overview.md).
        * `external_s3`: External storage. You need to specify additional parameters for this one:
    
            * `aws_access_key`: ID of AWS-compatible static access key.
            * `aws_secret_key`: Secret key of AWS-compatible static access key.
            * `aws_endpoint`: File storage endpoint, e.g., `storage.yandexcloud.net`.
            * `aws_region`: File storage region, e.g., `ru-central1`.
    
    * `metastore.hive.uri`: URI for connection to the Apache Hive™ Metastore cluster in `thrift://<cluster_IP_address>:9083` format.
    
        To find out the Apache Hive™ Metastore cluster IP address, select **Yandex MetaData Hub** in the [management console](https://console.yandex.cloud) and then select ![image](../../_assets/console-icons/database.svg) **Metastore** in the left-hand panel.
    
        {% note warning %}
        
        For integration with Managed Service for Trino, you need a Apache Hive™ Metastore cluster of version 3.1.
        
        {% endnote %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/iceberg.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### Oracle connector <code><b><small>Preview</small></b></code> {#oracle}

{% list tabs group=instructions %}

- Management console {#console}

    * **Connection type**: Manual setup.
    * **URL**: URL for connecting to the Oracle DB, in `jdbc:oracle:thin:@<host_address>:<port>:<SID>` format, where `SID` is the Oracle system ID.
    * **Username**: Username for connecting to the Oracle DB.
    * **Password**: User password for connection to the Oracle DB.
    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/oracle.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create oracle <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --on-premise-connection-url <URL_for_connection> \
      --on-premise-user-name <username> \
      --on-premise-password <user_password> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--on-premise-connection-url`: URL for connecting to the Oracle DB, in `jdbc:oracle:thin:@<host_address>:<port>:<SID>`, where `SID` is the Oracle system ID.
    * `--on-premise-user-name`: Username for connection to the Oracle DB.
    * `--on-premise-password`: User password for connection to the Oracle DB.
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/oracle.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      oracle = {
        on_premise = {
          connection_url = "<URL_for_connection>"
          user_name      = "<username>"
          password       = "<user_password>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the Oracle DB, in `jdbc:oracle:thin:@<host_address>:<port>:<SID>` format, where `SID` is the Oracle system ID.
        * `user_name`: Username for connection to the Oracle DB.
        * `password`: User password for connection to the Oracle DB.

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/oracle.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "oracle": {
                        "connection": {
                          "onPremise": {
                            "connectionUrl": "<URL_for_connection>",
                            "userName": "<username>",
                            "password": "<user_password>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `onPremise`: Settings for connecting to the custom installation:

        * `connectionUrl`: URL for connecting to the Oracle DB, in `jdbc:oracle:thin:@<host_address>:<port>:<SID>` format, where `SID` is the Oracle system ID.
        * `userName`: Username for connection to the Oracle DB.
        * `password`: User password for connection to the Oracle DB.

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/oracle.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "oracle": {
                    "connection": {
                      "on_premise": {
                        "connection_url": "<URL_for_connection>",
                        "user_name": "<username>",
                        "password": "<user_password>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the Oracle DB, in `jdbc:oracle:thin:@<host_address>:<port>:<SID>` format, where `SID` is the Oracle system ID.
        * `user_name`: Username for connection to the Oracle DB.
        * `password`: User password for connection to the Oracle DB.

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/oracle.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### PostgreSQL connector {#pg}

Select the connection type: [Connection Manager](../../metadata-hub/concepts/connection-manager.md) or **Manual setup** (custom installation), and configure it as needed.

With Connection Manager, you can create connections to a cluster with a managed database or to a custom database installation.

When connecting via Connection Manager, Trino automatically detects and applies any changes to the connection parameters. For connections of the **Manual setup** type, Trino does not track connection parameter changes. You need to track and apply them manually.

#### Connection Manager {#pg-connection-manager}

{% list tabs group=instructions %}

- Management console {#console}

    * **Connection ID**: Connection ID in Connection Manager for connection to the PostgreSQL cluster.

        To find out the connection ID:
        1. Go to the [resource folder](https://console.yandex.cloud) page.
        1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
        1. Click the cluster name and navigate to the **Connections** tab.

    * **Database**: DB name in the PostgreSQL cluster.
    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create postgresql <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --connection-manager-connection-id <connection_ID> \
      --connection-manager-database <DB_name> \
      --connection-manager-connection-properties <list_of_PostgreSQL_client_parameters> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--connection-manager-connection-id`: Connection ID in Connection Manager for connecting to the PostgreSQL cluster.

        To find out the connection ID:
        1. Go to the [resource folder](https://console.yandex.cloud) page.
        1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
        1. Click the cluster name and navigate to the **Connections** tab.

    * `--connection-manager-database`: DB name in the PostgreSQL cluster.
    * `--connection-manager-connection-properties`: List of PostgreSQL client settings in `key=value` format.

        {% cut "Available parameters" %}
        
        * `ApplicationName`: Name of the application using the connection.
        * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
        * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
        * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
        
            * `false` (default): Connect hosts in the specified order.
            * `true`: Randomly select hosts from a pool of suitable candidates.
        
        * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
        
            * In bytes, e.g., `100`, `200M`, or `2G`.
            * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
        
            By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
        
        * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
        * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
        * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
        
            * `ignore`: Ignores the `readOnly` parameter.
            * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
        
        * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
        * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
        * `targetServerType`: Defines which server type to connect to. The possible values are:
        
            * `any` (default)
            * `primary`
            * `secondary`
            * `preferPrimary`
            * `preferSecondary`
        
        {% endcut %}

    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      postgresql = {
        connection_manager = {
          connection_id = "<connection_ID>"
          database      = "<DB_name>"
          connection_properties = {
            <list_of_PostgreSQL_client_settings>
          }
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Connection ID in Connection Manager for connecting to the PostgreSQL cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `database`: DB name in the PostgreSQL cluster.
        * `connection_properties`: List of PostgreSQL client settings in `"key" = "value"` format.

            {% cut "Available parameters" %}
            
            * `ApplicationName`: Name of the application using the connection.
            * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
            * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
            * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
            
                * `false` (default): Connect hosts in the specified order.
                * `true`: Randomly select hosts from a pool of suitable candidates.
            
            * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
            
                * In bytes, e.g., `100`, `200M`, or `2G`.
                * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
            
                By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
            
            * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
            * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
            * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
            
                * `ignore`: Ignores the `readOnly` parameter.
                * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
                * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            
            * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
            * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
            * `targetServerType`: Defines which server type to connect to. The possible values are:
            
                * `any` (default)
                * `primary`
                * `secondary`
                * `preferPrimary`
                * `preferSecondary`
            
            {% endcut %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "postgresql": {
                        "connection": {
                          "connectionManager": {
                            "connectionId": "<connection_ID>",
                            "database": "<DB_name>",
                            "connectionProperties": {
                              <list_of_PostgreSQL_client_settings>
                            }
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `connectionManager`: Connection Manager settings:

        * `connectionId`: Connection ID in Connection Manager for connecting to the PostgreSQL cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `database`: DB name in the PostgreSQL cluster.
        * `connectionProperties`: List of PostgreSQL client settings in `"key": "value"` format.

            {% cut "Available parameters" %}
            
            * `ApplicationName`: Name of the application using the connection.
            * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
            * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
            * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
            
                * `false` (default): Connect hosts in the specified order.
                * `true`: Randomly select hosts from a pool of suitable candidates.
            
            * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
            
                * In bytes, e.g., `100`, `200M`, or `2G`.
                * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
            
                By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
            
            * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
            * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
            * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
            
                * `ignore`: Ignores the `readOnly` parameter.
                * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
                * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            
            * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
            * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
            * `targetServerType`: Defines which server type to connect to. The possible values are:
            
                * `any` (default)
                * `primary`
                * `secondary`
                * `preferPrimary`
                * `preferSecondary`
            
            {% endcut %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "postgresql": {
                    "connection": {
                      "connection_manager": {
                        "connection_id": "<connection_ID>",
                        "database": "<DB_name>",
                        "connection_properties": {
                          <list_of_PostgreSQL_client_settings>
                        }
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Connection ID in Connection Manager for connecting to the PostgreSQL cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `database`: DB name in the PostgreSQL cluster.
        * `connection_properties`: List of PostgreSQL client settings in `"key": "value"` format.

            {% cut "Available parameters" %}
            
            * `ApplicationName`: Name of the application using the connection.
            * `defaultRowFetchSize`: Number of rows fetched in `ResultSet` per database query. The default value is `0` (all rows are fetched at once). Limit the number of rows to avoid unnecessary memory usage.
            * `hostRecheckSeconds`: Time in seconds before rechecking the host status. The default value is `10`.
            * `loadBalanceHosts`: Defines how the hosts are connected. The possible values are:
            
                * `false` (default): Connect hosts in the specified order.
                * `true`: Randomly select hosts from a pool of suitable candidates.
            
            * `maxResultBuffer`: Result buffer size not to exceed when reading the results. You can set the value in one of the two ways:
            
                * In bytes, e.g., `100`, `200M`, or `2G`.
                * As a percentage of the maximum heap memory, e.g., `10p`, `20pct`, or `50percent`. The value cannot exceed 90% of the maximum heap memory. All larger values will be reduced to this limit.
            
                By default, `maxResultBuffer` is set to `null`, i.e., there are no limits on reading results.
            
            * `maxSendBufferSize`: Maximum number of bytes to buffer before sending to the server side. The `pgjdbc` driver uses the `least(maxSendBufferSize, greatest(8192, SO_SNDBUF))` function to determine the buffer size.
            * `readOnly`: Switches the connection to read-only mode. The default value is `false`.
            * `readOnlyMode`: Manages the connection behavior in read-only mode, i.e., if `readOnly = true`. The possible values are:
            
                * `ignore`: Ignores the `readOnly` parameter.
                * `transaction` (default): If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
                * `always`: If autocommit is `true`, the session will be set to read only. If autocommit is `false`, the driver will set the transaction to read only by sending `BEGIN READ ONLY`.
            
            * `receiveBufferSize`: Socket read buffer size (`SO_RCVBUF`) in bytes. The default value is `-1`, unlimited.
            * `sendBufferSize`: Socket write buffer size (`SO_SNDBUF`) in bytes. The default value is `-1`, unlimited.
            * `targetServerType`: Defines which server type to connect to. The possible values are:
            
                * `any` (default)
                * `primary`
                * `secondary`
                * `preferPrimary`
                * `preferSecondary`
            
            {% endcut %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

#### Manual setup {#pg-on-premise}

{% list tabs group=instructions %}

- Management console {#console}

    * **URL**: URL for connecting to the PostgreSQL DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
    * **Username**: Username for connecting to the PostgreSQL DB.
    * **Password**: User password for connection to the PostgreSQL DB.
    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create postgresql <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --on-premise-connection-url <URL_for_connection> \
      --on-premise-user-name <username> \
      --on-premise-password <user_password> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--on-premise-connection-url`: URL for connecting to the PostgreSQL DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
    * `--on-premise-user-name`: Username for connection to the PostgreSQL DB.
    * `--on-premise-password`: User password for connection to the PostgreSQL DB.
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      postgresql = {
        on_premise = {
          connection_url = "<URL_for_connection>"
          user_name      = "<username>"
          password       = "<user_password>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the PostgreSQL DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
        * `user_name`: Username for connection to the PostgreSQL DB.
        * `password`: User password for connection to the PostgreSQL DB.

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "postgresql": {
                        "connection": {
                          "onPremise": {
                            "connectionUrl": "<URL_for_connection>",
                            "userName": "<username>",
                            "password": "<user_password>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `onPremise`: Settings for connecting to the custom installation:

        * `connectionUrl`: URL for connecting to the PostgreSQL DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
        * `userName`: Username for connection to the PostgreSQL DB.
        * `password`: User password for connection to the PostgreSQL DB.

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "postgresql": {
                    "connection": {
                      "on_premise": {
                        "connection_url": "<URL_for_connection>",
                        "user_name": "<username>",
                        "password": "<user_password>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the PostgreSQL DB, in `jdbc:postgresql://<host_address>:<port>/<DB_name>` format.
        * `user_name`: Username for connection to the PostgreSQL DB.
        * `password`: User password for connection to the PostgreSQL DB.

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/postgresql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### MySQL® connector <code><b><small>Preview</small></b></code> {#mysql}

Select the connection type: [Connection Manager](../../metadata-hub/concepts/connection-manager.md) or **Manual setup** (custom installation), and configure it as needed.

With Connection Manager, you can create connections to a cluster with a managed database or to a custom database installation.

When connecting via Connection Manager, Trino automatically detects and applies any changes to the connection parameters. For connections of the **Manual setup** type, Trino does not track connection parameter changes. You need to track and apply them manually.

#### Connection Manager {#mysql-connection-manager}

{% list tabs group=instructions %}

- Management console {#console}

    * **Connection ID**: Connection ID in Connection Manager for connection to the MySQL® cluster.

        To find out the connection ID:
        1. Go to the [resource folder](https://console.yandex.cloud) page.
        1. Navigate to **Managed Service for&nbsp;MySQL**.
        1. Click the cluster name and navigate to the **Connections** tab.

    * **Connection properties**: MySQL® connection settings in `key: value` format.

        {% cut "Available parameters" %}
        
        * `connectTimeout`: Maximum MySQL® connection timeout, in milliseconds.
        * `socketTimeout`: Maximum socket operation timeout, in milliseconds.
        * `connectionTimeZone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
        * `serverTimezone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
        
           {% note info %}
           
           This parameter is deprecated, use `connectionTimeZone`.
           
           {% endnote %}
        
        * `autoReconnect`: Automatic reconnection, `true` or `false`.
        * `maxReconnects`: Maximum number of connection retry attempts.
        * `useCompression`: Data compression, `true` or `false`.
        * `cachePrepStmts`: Caching of prepared queries, `true` or `false`.
        * `prepStmtCacheSize`: Maximum number of prepared queries stored in cache.
        * `prepStmtCacheSqlLimit`: Maximum number of characters per prepared query that can be cached.
        
        {% endcut %}

    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create mysql <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --connection-manager-connection-id <connection_ID> \
      --connection-manager-connection-properties <MySQL®_connection_settings_list> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--connection-manager-connection-id`: Connection ID in Connection Manager for connecting to the MySQL® cluster.

        To find out the connection ID:
        1. Go to the [resource folder](https://console.yandex.cloud) page.
        1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
        1. Click the cluster name and navigate to the **Connections** tab.

    * `--connection-manager-connection-properties`: List of MySQL® connection settings in `key=value` format.

       {% cut "Available parameters" %}
       
       * `connectTimeout`: Maximum MySQL® connection timeout, in milliseconds.
       * `socketTimeout`: Maximum socket operation timeout, in milliseconds.
       * `connectionTimeZone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
       * `serverTimezone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
       
          {% note info %}
          
          This parameter is deprecated, use `connectionTimeZone`.
          
          {% endnote %}
       
       * `autoReconnect`: Automatic reconnection, `true` or `false`.
       * `maxReconnects`: Maximum number of connection retry attempts.
       * `useCompression`: Data compression, `true` or `false`.
       * `cachePrepStmts`: Caching of prepared queries, `true` or `false`.
       * `prepStmtCacheSize`: Maximum number of prepared queries stored in cache.
       * `prepStmtCacheSqlLimit`: Maximum number of characters per prepared query that can be cached.
       
       {% endcut %}

    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      mysql = {
        connection_manager = {
          connection_id = "<connection_ID>"
          connection_properties = {
            <MySQL®_connection_settings_list>
          }
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Connection ID in Connection Manager for connecting to the MySQL® cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;MySQL**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `connection_properties`: List of MySQL® connection settings in `"key" = "value"` format.

           {% cut "Available parameters" %}
           
           * `connectTimeout`: Maximum MySQL® connection timeout, in milliseconds.
           * `socketTimeout`: Maximum socket operation timeout, in milliseconds.
           * `connectionTimeZone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
           * `serverTimezone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
           
              {% note info %}
              
              This parameter is deprecated, use `connectionTimeZone`.
              
              {% endnote %}
           
           * `autoReconnect`: Automatic reconnection, `true` or `false`.
           * `maxReconnects`: Maximum number of connection retry attempts.
           * `useCompression`: Data compression, `true` or `false`.
           * `cachePrepStmts`: Caching of prepared queries, `true` or `false`.
           * `prepStmtCacheSize`: Maximum number of prepared queries stored in cache.
           * `prepStmtCacheSqlLimit`: Maximum number of characters per prepared query that can be cached.
           
           {% endcut %}

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "mysql": {
                        "connection": {
                          "connectionManager": {
                            "connectionId": "<connection_ID>",
                            "connectionProperties": {
                              <MySQL®_connection_settings_list>
                            }
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `connectionManager`: Connection Manager settings:

        * `connectionId`: Connection ID in Connection Manager for connecting to the MySQL® cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;MySQL**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `connectionProperties`: List of MySQL® connection settings in `"key": "value"` format.

           {% cut "Available parameters" %}
           
           * `connectTimeout`: Maximum MySQL® connection timeout, in milliseconds.
           * `socketTimeout`: Maximum socket operation timeout, in milliseconds.
           * `connectionTimeZone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
           * `serverTimezone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
           
              {% note info %}
              
              This parameter is deprecated, use `connectionTimeZone`.
              
              {% endnote %}
           
           * `autoReconnect`: Automatic reconnection, `true` or `false`.
           * `maxReconnects`: Maximum number of connection retry attempts.
           * `useCompression`: Data compression, `true` or `false`.
           * `cachePrepStmts`: Caching of prepared queries, `true` or `false`.
           * `prepStmtCacheSize`: Maximum number of prepared queries stored in cache.
           * `prepStmtCacheSqlLimit`: Maximum number of characters per prepared query that can be cached.
           
           {% endcut %}

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "mysql": {
                    "connection": {
                      "connection_manager": {
                        "connection_id": "<connection_ID>",
                        "connection_properties": {
                          <MySQL®_connection_settings_list>
                        }
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `connection_manager`: Connection Manager settings:

        * `connection_id`: Connection ID in Connection Manager for connecting to the MySQL® cluster.

            To find out the connection ID:
            1. In the management console, go to the [resource folder](https://console.yandex.cloud) page.
            1. Navigate to **Managed Service for&nbsp;MySQL**.
            1. Click the cluster name and navigate to the **Connections** tab.

        * `connection_properties`: List of MySQL® connection settings in `"key": "value"` format.

           {% cut "Available parameters" %}
           
           * `connectTimeout`: Maximum MySQL® connection timeout, in milliseconds.
           * `socketTimeout`: Maximum socket operation timeout, in milliseconds.
           * `connectionTimeZone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
           * `serverTimezone`: Time zone used by MySQL®, e.g., `UTC` or `Europe/Moscow`.
           
              {% note info %}
              
              This parameter is deprecated, use `connectionTimeZone`.
              
              {% endnote %}
           
           * `autoReconnect`: Automatic reconnection, `true` or `false`.
           * `maxReconnects`: Maximum number of connection retry attempts.
           * `useCompression`: Data compression, `true` or `false`.
           * `cachePrepStmts`: Caching of prepared queries, `true` or `false`.
           * `prepStmtCacheSize`: Maximum number of prepared queries stored in cache.
           * `prepStmtCacheSqlLimit`: Maximum number of characters per prepared query that can be cached.
           
           {% endcut %}

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

#### Manual setup {#mysql-on-premise}

{% list tabs group=instructions %}

- Management console {#console}

    * **URL**: URL for connecting to the MySQL® server, in `jdbc:mysql://<host_address>:<port>/` format. You do not need to specify a database name, Trino will automatically detect all available databases.
    * **Username**: Username for connection to the MySQL® server.
    * **Password**: User password for connection to the MySQL® server.
    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create mysql <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --on-premise-connection-url <URL_for_connection> \
      --on-premise-user-name <username> \
      --on-premise-password <user_password> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--on-premise-connection-url`: URL for connecting to the MySQL® server, in `jdbc:mysql://<host_address>:<port>/` format. You do not need to specify a database name, Trino will automatically detect all available databases.
    * `--on-premise-user-name`: Username for connection to the MySQL® server.
    * `--on-premise-password`: User password for connection to the MySQL® server.
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      mysql = {
        on_premise = {
          connection_url = "<URL_for_connection>"
          user_name      = "<username>"
          password       = "<user_password>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the MySQL® server, in `jdbc:mysql://<host_address>:<port>/` format. You do not need to specify a database name, Trino will automatically detect all available databases.
        * `user_name`: Username for connection to the MySQL® server.
        * `password`: User password for connection to the MySQL® server.

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "mysql": {
                        "connection": {
                          "onPremise": {
                            "connectionUrl": "<URL_for_connection>",
                            "userName": "<username>",
                            "password": "<user_password>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `onPremise`: Settings for connecting to the custom installation:

        * `connectionUrl`: URL for connecting to the MySQL® server, in `jdbc:mysql://<host_address>:<port>/` format. You do not need to specify a database name, Trino will automatically detect all available databases.
        * `userName`: Username for connection to the MySQL® server.
        * `password`: User password for connection to the MySQL® server.

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "mysql": {
                    "connection": {
                      "on_premise": {
                        "connection_url": "<URL_for_connection>",
                        "user_name": "<username>",
                        "password": "<user_password>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the MySQL® server, in `jdbc:mysql://<host_address>:<port>/` format. You do not need to specify a database name, Trino will automatically detect all available databases.
        * `user_name`: Username for connection to the MySQL® server.
        * `password`: User password for connection to the MySQL® server.

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/mysql.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### MS SQL Server connector <code><b><small>Preview</small></b></code> {#ms-sql}

{% list tabs group=instructions %}

- Management console {#console}

    * **Connection type**: Manual setup.
    * **URL**: URL for connecting to the Microsoft SQL Server DB, in `jdbc:sqlserver://<host_address>:<port>;databaseName=<DB_name>` format.
    * **Username**: Username for connecting to the Microsoft SQL Server DB.
    * **Password**: User password for connection to the Microsoft SQL Server DB.
    * **Additional settings**: Provide in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/sqlserver.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create sqlserver <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --on-premise-connection-url <URL_for_connection> \
      --on-premise-user-name <username> \
      --on-premise-password <user_password> \
      --additional-properties <list_of_additional_settings>
    ```

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--on-premise-connection-url`: URL for connecting to the Microsoft SQL Server DB, in `jdbc:sqlserver://<host_address>:<port>;databaseName=<DB_name>` format.
    * `--on-premise-user-name`: Username for connecting to the Microsoft SQL Server DB.
    * `--on-premise-password`: User password for connection to the Microsoft SQL Server DB.
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/sqlserver.html).

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      sqlserver = {
        on_premise = {
          connection_url = "<URL_for_connection>"
          user_name      = "<username>"
          password       = "<user_password>"
        }
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the Microsoft SQL Server DB, in `jdbc:sqlserver://<host_address>:<port>;databaseName=<DB_name>` format.
        * `user_name`: Username for connecting to the Microsoft SQL Server DB.
        * `password`: User password for connection to the Microsoft SQL Server DB.

    * `additional_properties`: List of additional settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/sqlserver.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "sqlserver": {
                        "connection": {
                          "onPremise": {
                            "connectionUrl": "<URL_for_connection>",
                            "userName": "<username>",
                            "password": "<user_password>"
                          }
                        },
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where:

    * `onPremise`: Settings for connecting to the custom installation:

        * `connectionUrl`: URL for connecting to the Microsoft SQL Server DB, in `jdbc:sqlserver://<host_address>:<port>;databaseName=<DB_name>` format.
        * `userName`: Username for connecting to the Microsoft SQL Server DB.
        * `password`: User password for connection to the Microsoft SQL Server DB.

    * `additionalProperties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/sqlserver.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "sqlserver": {
                    "connection": {
                      "on_premise": {
                        "connection_url": "<URL_for_connection>",
                        "user_name": "<username>",
                        "password": "<user_password>"
                      }
                    },
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where:

    * `on_premise`: Settings for connecting to the custom installation:

        * `connection_url`: URL for connecting to the Microsoft SQL Server DB, in `jdbc:sqlserver://<host_address>:<port>;databaseName=<DB_name>` format.
        * `user_name`: Username for connecting to the Microsoft SQL Server DB.
        * `password`: User password for connection to the Microsoft SQL Server DB.

    * `additional_properties`: List of additional settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/sqlserver.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### TPC-DS connector {#tpc-ds}

The TPC-DS connector has no required settings. Optionally, you can configure advanced settings.

{% list tabs group=instructions %}

- Management console {#console}

    You can specify additional settings in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpcds.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create tpcds <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --additional-properties <list_of_additional_settings>
    ```  

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpcds.html).  

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      tpcds = {
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where `additional_properties` is a list of advanced settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpcds.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "tpcds": {
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where `additionalProperties` is a list of advanced settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpcds.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "tpcds": {
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where `additional_properties` is a list of advanced settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpcds.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

### TPC-H connector {#tpc-h}

The TPC-H connector has no required settings. Optionally, you can configure advanced settings.

{% list tabs group=instructions %}

- Management console {#console}

    You can specify additional settings in `key: value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpch.html).

- CLI {#cli}

    Command example:

    ```bash
    yc managed-trino catalog create tpch <Trino_catalog_name> \
      --cluster-id <cluster_ID> \
      --additional-properties <list_of_additional_settings>
    ```  

    Where:

    * `--cluster-id`: ID of the cluster you are creating the Trino catalog in. You can get the cluster ID with the [list of clusters](cluster-list.md#list-clusters).
    * `--additional-properties`: Additional settings in `key=value` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpch.html).      

- Terraform {#tf}

    Configuration example:

    ```hcl
    resource "yandex_trino_catalog" "<Trino_catalog_name>" {
      ...
      tpch = {
        additional_properties = {
          <list_of_additional_settings>
        }
      }
    }
    ```

    Where `additional_properties` is a list of advanced settings in `"key" = "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpch.html).

- REST API {#api}

    Command example:

    ```bash
    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>/catalogs' \
        --data '{
                  "catalog": {
                    "name": "<Trino_catalog_name>",
                    "connector": {
                      "tpch": {
                        "additionalProperties": {
                          <list_of_additional_settings>
                        }
                      }
                    }
                  }
                }'
    ```

    Where `additionalProperties` is a list of advanced settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpch.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- gRPC API {#grpc-api}

    Command example:

    ```bash
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/trino/v1/catalog_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "catalog": {
                "name": "<Trino_catalog_name>",
                "connector": {
                  "tpch": {
                    "additional_properties": {
                      <list_of_additional_settings>
                    }
                  }
                }
              }
            }' \
        trino.api.cloud.yandex.net:443 \
        yandex.cloud.trino.v1.CatalogService.Create
    ```

    Where `additional_properties` is a list of advanced settings in `"key": "value"` format. For a list of available settings, see [this official guide](https://trino.io/docs/current/connector/tpch.html).

    You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

{% endlist %}

_ClickHouse® is a registered trademark of [ClickHouse, Inc](https://clickhouse.com)._