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

Add the Data Connection

1

Open Data sources

Under Workspace settings, select Data sources.
Hex step 1: Open Data sources
2

Add connection and choose Trino

Click the green + Connection button, then select Trino from the list of available connections.
Hex step 2: Add connection and choose Trino
3

Enter connection details

Fill in the form fields using the values from the Connection Parameters section.
Hex step 3: Enter connection details

Run a Test Query

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

Open or create a project

Open an existing project or create a new one.
2

Add a SQL cell

Add a new SQL cell to your notebook.
3

Select data source

In the data source dropdown at the top of the cell, select your newly created Dune SQL connection.
4

Paste and run SQL

Paste the example query below into the cell and run it.
Hex step: Paste and run SQL
You can use this query to test your connection. It fetches the daily transaction count from the last year on Base.
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