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

# Hex

> Connect Dune to Hex's notebook-native analytics platform

Follow these steps to connect Dune as a data source in your Hex workspace.

## Add the Data Connection

<Steps>
  <Step title="Open Data sources">
    Under Workspace settings, select <b>Data sources</b>.

    <Frame>
      <img src="https://mintcdn.com/dune/Sfv_5QdqAPVofYTY/images/trino-presto-connector/hex-1.png?fit=max&auto=format&n=Sfv_5QdqAPVofYTY&q=85&s=18b2f51e2c0c50f8abb1eff9e154b232" alt="Hex step 1: Open Data sources" width="2870" height="1608" data-path="images/trino-presto-connector/hex-1.png" />
    </Frame>
  </Step>

  <Step title="Add connection and choose Trino">
    Click the green <b>+ Connection</b> button, then select <b>Trino</b> from
    the list of available connections.

    <Frame>
      <img src="https://mintcdn.com/dune/Sfv_5QdqAPVofYTY/images/trino-presto-connector/hex-2.png?fit=max&auto=format&n=Sfv_5QdqAPVofYTY&q=85&s=bca16b701683e201422aa2ef60122561" alt="Hex step 2: Add connection and choose Trino" width="2872" height="1614" data-path="images/trino-presto-connector/hex-2.png" />
    </Frame>
  </Step>

  <Step title="Enter connection details">
    Fill in the form fields using the values from the [Connection Parameters](/api-reference/connectors/trino/overview#connection-parameters) section.

    <Frame>
      <img src="https://mintcdn.com/dune/Sfv_5QdqAPVofYTY/images/trino-presto-connector/hex-3.png?fit=max&auto=format&n=Sfv_5QdqAPVofYTY&q=85&s=b572ea6938ca81f272ab3458bf4c25b1" alt="Hex step 3: Enter connection details" width="2876" height="1614" data-path="images/trino-presto-connector/hex-3.png" />
    </Frame>
  </Step>
</Steps>

## Run a Test Query

Once your data source is configured, you can query it directly from any Hex project.

<Steps>
  <Step title="Open or create a project">
    Open an existing project or create a new one.
  </Step>

  <Step title="Add a SQL cell">
    Add a new <b>SQL cell</b> to your notebook.
  </Step>

  <Step title="Select data source">
    In the data source dropdown at the top of the cell, select your newly
    created <b>Dune SQL</b> connection.
  </Step>

  <Step title="Paste and run SQL">
    Paste the example query below into the cell and run it.

    <Frame>
      <img src="https://mintcdn.com/dune/Sfv_5QdqAPVofYTY/images/trino-presto-connector/hex-4.png?fit=max&auto=format&n=Sfv_5QdqAPVofYTY&q=85&s=47760566fc47b89255dba35980668889" alt="Hex step: Paste and run SQL" width="2880" height="1598" data-path="images/trino-presto-connector/hex-4.png" />
    </Frame>
  </Step>
</Steps>

You can use this query to test your connection. It fetches the daily transaction count from the last year on Base.

```sql theme={null}
SELECT
  date_trunc('day', block_time) AS time,
  count(*) AS count
FROM base.transactions
WHERE block_time > now() - interval '12' month
GROUP BY 1
ORDER BY 1 DESC
```
