# Trino

> Trino - ネイティブTrinoコネクターに接続する方法。

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-15T05:55:45.012823+00:00` (UTC).

## Primary page

- [Trino](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [サポートされている認証](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md#supported-authentication): In-page section heading.
- [前提条件](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md#prerequisites): In-page section heading.
- [バッチ予測の要件](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md#batch-predictions-requirements): In-page section heading.
- [必須パラメーター](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md#required-parameters): In-page section heading.
- [トラブルシューティング](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md#troubleshooting): In-page section heading.
- [コードの例](https://docs.datarobot.com/ja/docs/reference/data-ref/data-sources/dc-trino.html.md#code-examples): In-page section heading.

## Documentation content

## サポートされている認証

- Basic（ユーザー名/パスワード）

## 前提条件

DataRobotでTrinoに接続するには、以下が必要です。

- Trinoデータベースに保存されたデータ

## バッチ予測の要件

バッチ予測ジョブにおいて、Trinoを [取込み元](https://docs.datarobot.com/ja/docs/api/reference/batch-prediction-api/intake-options.html.md#trino-scoring) としても [出力先](https://docs.datarobot.com/ja/docs/api/reference/batch-prediction-api/output-options.html.md#trino-write) としても使用できます。

- プロジェクトのトレーニングに使用するデータセットの列名には、小文字のみを使用します。 Trino sanitizes column names automatically (unquoted identifiers are lowercased), so mixed-case or uppercase column names can cause column inconsistency errors when reading from Trino for batch scoring. This applies even when creating tables with quoted column names—Trino still stores them as lowercase.
- Trinoをバッチ予測の出力先として使用する場合は、バイト単位で数値のchunkSizeを明示的に設定します。 名前付きチャンク戦略（auto、dynamic、fixed）はサポートされていません。 値は、Trinoにおけるデフォルトのquery.max-lengthの上限である100万バイト（1MB）を超えることはできません。 この上限を超えたり、名前付き戦略を使用したりすると、ジョブは失敗します。

## 必須パラメーター

以下の表は、Trinoとの接続を確立するために最低限必要なフィールドの一覧です。

| 必須フィールド | 説明 | ドキュメンテーション |
| --- | --- | --- |
| Host | Trinoコーディネーターのホスト名またはIPアドレス。 | Trinoドキュメント |

## トラブルシューティング

| 問題 | 解決方法 | 説明 |
| --- | --- | --- |
| DataRobotで操作を実行しようとすると、ファイアウォールが毎回IPアドレスをクリアするよう要求します。 | DataRobotで許可されたすべてのIPを追加します。 | 許可された送信元IPアドレスを参照してください。 許可されたIPをすでに追加している場合は、既存のIPが完全であることを確認してください。 |

## コードの例

以下のPythonの例では、Trinoに接続してDataRobotにデータを移動する方法を示します。

DataRobotクライアントを初期化し、後で使用するためにデータベースの詳細を定義します。

```
api_token = '<token>'
endpoint = 'https://app.datarobot.com/api/v2'

import datarobot as dr
from datarobot.enums import DataStoreTypes

dr.Client(token=api_token, endpoint=endpoint)

TRINO_HOST = "datarobot.trino.galaxy.starburst.io"
TRINO_PORT = 443
USE_SSL = "true"
CATALOG = "<catalog>"
SCHEMA = "<schema>"
TABLE = "<table>"
QUERY = None
TRINO_USERNAME = "<username>"
TRINO_PASSWORD = "<password>" 
```

TrinoドライバーのIDを特定するには、以下のいずれかの操作を行います。

- TrinoドライバーのIDを作成します。 trino_driver=dr.DataDriver.create(class_name=DataStoreTypes.DR_DATABASE_V1,canonical_name='Trino Driver',database_driver='trino-v1',)
- 既存のTrinoドライバーのIDを参照します。 trino_driver=dr.DataDriver.get('<trino_driver_id>')

Trinoの資格情報を作成（または再利用）し、DataRobotに安全に保存します。

```
trino_credentials = dr.Credential.create_basic(
    name='Trino Credentials',
    user=TRINO_USERNAME,
    password=TRINO_PASSWORD,
) 
```

外部データストアへの接続を定義します。

```
datastore_fields = [
    {"id": "host", "name": "Host Name", "value": TRINO_HOST},
    {"id": "port", "name": "port", "value": str(TRINO_PORT)},
    {"id": "ssl", "name": "ssl", "value": USE_SSL},
]

trino_datastore = dr.DataStore.create(
    data_store_type=DataStoreTypes.DR_DATABASE_V1,
    canonical_name='Trino Datastore',
    driver_id=trino_driver.id,
    fields=datastore_fields,
) 
```

特定のデータソース（テーブルまたはクエリー）を指定します。

```
data_source_params = dr.DataSourceParameters(
    data_store_id=trino_datastore.id,
    catalog=CATALOG,
    schema=SCHEMA,
    table=TABLE,
    query=QUERY,
)

trino_datasource = dr.DataSource.create(
    data_source_type=DataStoreTypes.DR_DATABASE_V1,
    canonical_name='Trino DataSource',
    params=data_source_params,
) 
```

Trinoからデータを取得し、スナップショットバージョンをDataRobotにインポートします。

```
trino_dataset = trino_datasource.create_dataset(
    do_snapshot=True,
    credential_id=trino_credentials.id,
) 
```
