# Trino

## Configuration

Prism relies on the [Trino DBAPI](https://github.com/trinodb/trino-python-client) client to connect your project to a Trino cluster. The DBAPI offers several different authentication mechanisms for creating this connection. As of now, Prism only supports [BasicAuthentication](https://github.com/trinodb/trino-python-client#basic-authentication).

The configurations required for BasicAuthentication are:

* `autocommit`: toggle whether the connection commits changes to the database after executing. The default is `True`.
* `host`: the hostname of Amazon Redshift cluster.
* `port`: the port number of the Amazon Redshift cluster.
* `database`: the name of the database to which you want to connect.
* `user`: the user name to use for authentication.
* `password`: the password to use for authentication

{% code title="profile.yml" %}

```yaml
<profile name here>:
  adapters:
    <trino adapter name here>: # change this!
      type: trino
      host:
      http_scheme: https
      port:
      user:
      password:
      catalog:
      schema:

```

{% endcode %}

Under the hood, Prism takes care of parsing the configuration variables and establishing a connection to your Trino cluster.

## `hooks.sql()`

You can run queries against the Redshift cluster using the `hooks.sql` function:

```python
def run(self, tasks, hooks):
    data = hooks.sql(
        adapter_name="<trino adapter name>",
        query="SELECT * FROM table"
    )
```

Note that when `return_type = None`, the result will be a list tuples containing the query data.
