> ## Documentation Index
> Fetch the complete documentation index at: https://dune-automated-update-duneapi-openapi-files.mintlify.site/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-automated-update-duneapi-openapi-files/CwnjxCYudWrd-KuX/images/trino-presto-connector/hex-1.png?fit=max&auto=format&n=CwnjxCYudWrd-KuX&q=85&s=2417d36ad76015d3c1fe620cca24ba45" 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-automated-update-duneapi-openapi-files/CwnjxCYudWrd-KuX/images/trino-presto-connector/hex-2.png?fit=max&auto=format&n=CwnjxCYudWrd-KuX&q=85&s=6d808955dd8106ffba85da733241d074" 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-automated-update-duneapi-openapi-files/CwnjxCYudWrd-KuX/images/trino-presto-connector/hex-3.png?fit=max&auto=format&n=CwnjxCYudWrd-KuX&q=85&s=83046b8aee71beb8a4c45c1353f3a835" 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-automated-update-duneapi-openapi-files/CwnjxCYudWrd-KuX/images/trino-presto-connector/hex-4.png?fit=max&auto=format&n=CwnjxCYudWrd-KuX&q=85&s=3defa363e1a9268c0de7fdb6cf747f75" 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
```
