> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindsdb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Trino

This is the implementation of the Trino data handler for MindsDB.

[Trino](https://trino.io/) is an open-source distributed SQL query engine designed to query large data sets distributed over one or more heterogeneous data sources.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB locally via [Docker](/setup/self-hosted/docker) or [Docker Desktop](/setup/self-hosted/docker-desktop).
2. To connect Trino to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to Trino.

## Implementation

This handler is implemented using `pyhive`, a collection of Python DB-API and SQLAlchemy interfaces for Presto and Hive.

The required arguments to establish a connection are as follows:

* `user` is the database user.
* `password` is the database password.
* `host` is the host name, IP address, or URL.
* `port` is the port used to make TCP/IP connection.

There are some optional arguments as follows:

* `auth` is the authentication method. Currently, only `basic` is supported.
* `http_scheme` takes the value of `http`by default. It can be set to `https` as well.
* `catalog` is the catalog.
* `schema` is the schema name.
* `with` defines default WITH-clause (properties) for ALL tables. This parameter is experimental and might be changed or removed in future release.

## Usage

In order to make use of this handler and connect to the Trino database in MindsDB, the following syntax can be used:

```sql theme={null}
CREATE DATABASE trino_datasource
WITH
  ENGINE = 'trino',
  PARAMETERS = {
    "host": "127.0.0.1",
    "port": 443,
    "auth": "basic",
    "http_scheme": "https",
    "user": "trino",
    "password": "password",
    "catalog": "default",
    "schema": "test",
    "with": "with (transactional = true)"
  };
```

You can use this established connection to query your table as follows:

```sql theme={null}
SELECT *
FROM trino_datasource.demo_table;
```
