|
| 1 | +# Trino |
| 2 | + |
| 3 | +## Local/Built-in Scheduler |
| 4 | +**Engine Adapter Type**: `trino` |
| 5 | + |
| 6 | +## Installation |
| 7 | +``` |
| 8 | +pip install "sqlmesh[trino]" |
| 9 | +``` |
| 10 | + |
| 11 | +If you are using Oath for Authentication, it is recommended to install keyring cache: |
| 12 | +``` |
| 13 | +pip install "trino[external-authentication-token-cache]" |
| 14 | +``` |
| 15 | + |
| 16 | +### Trino Connector Support |
| 17 | + |
| 18 | +The trino engine adapter has been tested against the [Hive Connector](https://trino.io/docs/current/connector/hive.html). |
| 19 | +Please let us know on [Slack](https://tobikodata.com/slack) if you are wanting to use another connector or have tried another connector. |
| 20 | + |
| 21 | +### Hive Connector Configuration |
| 22 | + |
| 23 | +Recommended hive catalog properties configuration (`<catalog_name>.properties`): |
| 24 | + |
| 25 | +```properties linenums="1" |
| 26 | +hive.metastore-cache-ttl=0s |
| 27 | +hive.metastore-refresh-interval=5s |
| 28 | +hive.metastore-timeout=10s |
| 29 | +hive.allow-drop-table=true |
| 30 | +hive.allow-add-column=true |
| 31 | +hive.allow-drop-column=true |
| 32 | +hive.allow-rename-column=true |
| 33 | +hive.allow-rename-table=true |
| 34 | +``` |
| 35 | + |
| 36 | +### Connection options |
| 37 | + |
| 38 | +| Option | Description | Type | Required | |
| 39 | +|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------:|:--------:| |
| 40 | +| `type` | Engine type name - must be `trino` | string | Y | |
| 41 | +| `user` | The username (of the account) to log in to your cluster. When connecting to Starburst Galaxy clusters, you must include the role of the user as a suffix to the username. | string | Y | |
| 42 | +| `host` | The hostname of your cluster. Don't include the `http://` or `https://` prefix. | string | Y | |
| 43 | +| `catalog` | The name of a catalog in your cluster. | string | Y | |
| 44 | +| `http_scheme` | The HTTP scheme to use when connecting to your cluster. By default, it's `https` and can only be `http` for no-auth or basic auth. | string | N | |
| 45 | +| `port` | The port to connect to your cluster. By default, it's `443` for `https` scheme and `80` for `http` | int | N | |
| 46 | +| `roles` | Mapping of catalog name to a role | dict | N | |
| 47 | +| `http_headers` | Additional HTTP headers to send with each request. | dict | N | |
| 48 | +| `session_properties` | Trino session properties. Run `SHOW SESSION` to see all options. | dict | N | |
| 49 | +| `retries` | Number of retries to attempt when a request fails. Default: `3` | int | N | |
| 50 | +| `timezone` | Timezone to use for the connection. Default: client-side local timezone | string | N | |
| 51 | + |
| 52 | +```yaml linenums="1" |
| 53 | +connector_name: |
| 54 | + type: trino |
| 55 | + user: [user] |
| 56 | + host: [host] |
| 57 | + catalog: [catalog] |
| 58 | +``` |
| 59 | +
|
| 60 | +### Authentication |
| 61 | +
|
| 62 | +=== "No Auth" |
| 63 | + | Option | Description | Type | Required | |
| 64 | + |------------|------------------------------------------|:------:|:--------:| |
| 65 | + | `method` | `no-auth` (Default) | string | N | |
| 66 | + |
| 67 | + ```yaml linenums="1" |
| 68 | + connector_name: |
| 69 | + type: trino |
| 70 | + user: [user] |
| 71 | + host: [host] |
| 72 | + catalog: [catalog] |
| 73 | + # Most likely you will want http for scheme when not using auth |
| 74 | + http_scheme: http |
| 75 | + ``` |
| 76 | + |
| 77 | + |
| 78 | +=== "Basic Auth" |
| 79 | + |
| 80 | + | Option | Description | Type | Required | |
| 81 | + |------------|------------------------------------------|:------:|:--------:| |
| 82 | + | `method` | `basic` | string | Y | |
| 83 | + | `password` | The password to use when authenticating. | string | Y | |
| 84 | + |
| 85 | + |
| 86 | + ```yaml linenums="1" |
| 87 | + connector_name: |
| 88 | + type: trino |
| 89 | + method: basic |
| 90 | + user: [user] |
| 91 | + password: [password] |
| 92 | + host: [host] |
| 93 | + catalog: [catalog] |
| 94 | + ``` |
| 95 | + |
| 96 | + * [Trino Documentation on Basic Authentication](https://trino.io/docs/current/security/password-file.html) |
| 97 | + * [Python Client Basic Authentication](https://github.com/trinodb/trino-python-client#basic-authentication) |
| 98 | + |
| 99 | +=== "LDAP" |
| 100 | + |
| 101 | + | Option | Description | Type | Required | |
| 102 | + |----------------------|-------------------------------------------------------------------------|:------:|:--------:| |
| 103 | + | `method` | `ldap` | string | Y | |
| 104 | + | `password` | The password to use when authenticating. | string | Y | |
| 105 | + | `impersonation_user` | Override the provided username. This lets you impersonate another user. | string | N | |
| 106 | + |
| 107 | + ```yaml linenums="1" |
| 108 | + connector_name: |
| 109 | + type: trino |
| 110 | + method: ldap |
| 111 | + user: [user] |
| 112 | + password: [password] |
| 113 | + host: [host] |
| 114 | + catalog: [catalog] |
| 115 | + ``` |
| 116 | + |
| 117 | + * [Trino Documentation on LDAP Authentication](https://trino.io/docs/current/security/ldap.html) |
| 118 | + * [Python Client LDAP Authentication](https://github.com/trinodb/trino-python-client#basic-authentication) |
| 119 | + |
| 120 | +=== "Kerberos" |
| 121 | + |
| 122 | + | Option | Description | Type | Required | |
| 123 | + |----------------------------------|-----------------------------------------------------------------------------------|:------:|:--------:| |
| 124 | + | `method` | `kerberos` | string | Y | |
| 125 | + | `keytab` | Path to keytab. Ex: `/tmp/trino.keytab` | string | Y | |
| 126 | + | `krb5_config` | Path to config. Ex: `/tmp/krb5.conf` | string | Y | |
| 127 | + | `principal` | Principal. Ex: `user@company.com` | string | Y | |
| 128 | + | `service_name` | Service name (default is `trino`) | string | N | |
| 129 | + | `hostname_override` | Kerberos hostname for a host whose DNS name doesn't match | string | N | |
| 130 | + | `mutual_authentication` | Boolean flag for mutual authentication. Default: `false` | bool | N | |
| 131 | + | `force_preemptive` | Boolean flag to preemptively initiate the Kerberos GSS exchange. Default: `false` | bool | N | |
| 132 | + | `sanitize_mutual_error_response` | Boolean flag to strip content and headers from error responses. Default: `true` | bool | N | |
| 133 | + | `delegate` | Boolean flag for credential delegation (`GSS_C_DELEG_FLAG`). Default: `false` | bool | N | |
| 134 | + |
| 135 | + ```yaml linenums="1" |
| 136 | + connector_name: |
| 137 | + type: trino |
| 138 | + method: kerberos |
| 139 | + user: user |
| 140 | + keytab: /tmp/trino.keytab |
| 141 | + krb5_config: /tmp/krb5.conf |
| 142 | + principal: trino@company.com |
| 143 | + host: trino.company.com |
| 144 | + catalog: datalake |
| 145 | + ``` |
| 146 | + |
| 147 | + * [Trino Documentation on Kerberos Authentication](https://trino.io/docs/current/security/kerberos.html) |
| 148 | + * [Python Client Kerberos Authentication](https://github.com/trinodb/trino-python-client#kerberos-authentication) |
| 149 | + |
| 150 | +=== "JWT" |
| 151 | + |
| 152 | + | Option | Description | Type | Required | |
| 153 | + |-------------|-----------------|:------:|:--------:| |
| 154 | + | `method` | `jwt` | string | Y | |
| 155 | + | `jwt_token` | The JWT string. | string | Y | |
| 156 | + |
| 157 | + ```yaml linenums="1" |
| 158 | + connector_name: |
| 159 | + type: trino |
| 160 | + method: jwt |
| 161 | + user: [user] |
| 162 | + password: [password] |
| 163 | + host: [host] |
| 164 | + catalog: [catalog] |
| 165 | + ``` |
| 166 | + |
| 167 | + * [Trino Documentation on JWT Authentication](https://trino.io/docs/current/security/jwt.html) |
| 168 | + * [Python Client JWT Authentication](https://github.com/trinodb/trino-python-client#jwt-authentication) |
| 169 | + |
| 170 | +=== "Certificate" |
| 171 | + |
| 172 | + | Option | Description | Type | Required | |
| 173 | + |----------------------|---------------------------------------------------|:------:|:--------:| |
| 174 | + | `method` | `certificate` | string | Y | |
| 175 | + | `cert` | The full path to a certificate file | string | Y | |
| 176 | + | `client_certificate` | Path to client certificate. Ex: `/tmp/client.crt` | string | Y | |
| 177 | + | `client_private_key` | Path to client private key. Ex: `/tmp/client.key` | string | Y | |
| 178 | + |
| 179 | + |
| 180 | + ```yaml linenums="1" |
| 181 | + connector_name: |
| 182 | + type: trino |
| 183 | + method: certificate |
| 184 | + user: [user] |
| 185 | + password: [password] |
| 186 | + host: [host] |
| 187 | + catalog: [catalog] |
| 188 | + cert: [path/to/cert_file] |
| 189 | + client_certificate: [path/to/client/cert] |
| 190 | + client_private_key: [path/to/client/key] |
| 191 | + ``` |
| 192 | + |
| 193 | +=== "Oath" |
| 194 | + |
| 195 | + | Option | Description | Type | Required | |
| 196 | + |----------------------|---------------------------------------------------|:------:|:--------:| |
| 197 | + | `method` | `oath` | string | Y | |
| 198 | + |
| 199 | + ```yaml linenums="1" |
| 200 | + connector_name: |
| 201 | + type: trino |
| 202 | + method: oauth |
| 203 | + host: trino.company.com |
| 204 | + catalog: datalake |
| 205 | + ``` |
| 206 | + |
| 207 | + * [Trino Documentation on Oath Authentication](https://trino.io/docs/current/security/oauth2.html) |
| 208 | + * [Python Client Oath Authentication](https://github.com/trinodb/trino-python-client#oauth2-authentication) |
| 209 | + |
0 commit comments