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

# Trino SQL blocks

> Execute SQL commands in Trino.

<img alt="Trino" src="https://dbdb.io/media/logos/trino.png" />

## Credentials

Open the file named `io_config.yaml` at the root of your Mage project and enter the following:

```yaml theme={"system"}
version: 0.1.1
default:
  trino:
    catalog: postgresql                       # Change this to the catalog of your choice
    host: 127.0.0.1
    http_headers:
      X-Something: 'mage=power'
    http_scheme: http
    password: mage1337                        # Optional
    port: 8080
    schema: core_data
    session_properties:                       # Optional
      acc01.optimize_locality_enabled: false
      optimize_hash_generation: true
    source: trino-cli                         # Optional
    user: admin
    verify: /path/to/your/ca.crt              # Optional
    data_type_properties:
      timestamp_precision: 3                              # Optional. Set TIMESTAMP(n) precision
    overwrite_types: path_to_types_json # Optional
```

<Note>Change the values according to your Trino settings.</Note>

## How to use

1. Trino must be running on a remote server or on your local workstation.
   Read these [instructions](https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/trino/README.md#run-trino-locally)
   to run Trino locally.

2. Create a new pipeline or edit an existing pipeline.

3. Add a data loader or transformer SQL block.

4. In the block’s header, click the dropdown menu labeled <b>Connection</b> and select the option
   labeled <b>Trino</b>.

5. In the block’s header, click the dropdown menu labeled <b>Profile</b> and select the option
   labeled <b>default</b>.

   <Note>
     If the name of your profile in the `io_config.yaml` file is different,
     then select the profile name that matches your settings.
   </Note>

6. You can optionally check the box labeled <b>Use raw SQL</b>.
   If you do, read more about [how to use SQL blocks with raw SQL](/guides/blocks/sql-blocks#using-raw-sql).

7. You can optionally overwrite your table columns types by adding a JSON to `overwrite_types` config, the format needs to be `{"column_name":"VARCHAR"}`

8. Write your SQL statements in the SQL block.

9. Once you’re finished writing your SQL statements,
   click the play button in the top right corner of the block to execute the SQL block and preview
   the results.
