Dune AI
Wand is a beta suite of tools for writing SQL queries with the help of large language models.
Dune is launching a beta suite of tools for writing SQL queries with the help of large language models.
Wand Create
The Wand Create feature allows you to automatically generate SQL queries from natural language questions. It utilizes a suite of Dune-specific few-shot examples and automatically fetches table schemas to include in the prompt. (You must to explicitly include the relevant tables in your natural language question to include table schemas.)
This feature simplifies the process of writing getting started writing a SQL query, especially for users who may not be familiar with the database structure. Your mileage may vary depending on the complexity of your question and how well the underlying tables are suited to answering it. We recommend using this feature as a starting point and then refining the query using the Wand Edit feature.
You can find this feature in the query editor and click the wand logo in the top right corner to open the Wand bar. An empty query page should open in Create mode and you can toggle between Create and Edit modes using the buttons in the top right corner of the query editor.
Wand Edit
The Wand Edit feature allows you to edit an existing SQL query based on a natural language question. Similar to query generation, any additional tables required should be explicitly included in the natural language edit request to make use of schemas. This feature simplifies the process of refining and fine-tuning SQL queries generated by the system or existing queries in your application.
You can find this feature in the query editor and click the wand logo in the top right corner to open the Wand bar. A non-empty query page should open in Edit mode and you can toggle between Create and Edit modes using the buttons in the top right corner of the query editor.
Below are some examples of use cases for the Wand Edit feature:
Adding statistics to a query
Add the remaining components of a five point summary.
Original query:
Edited query:
Adding a join to a query
Join nft.wash_trades to nft.trades to get the percentage of sellers who have been involved in wash trading.
Original query:
Edited query:
Reformat Output
Return monthly volume with each year from 2023 to 2019 as a separate column
Original query:
Edited query:
Adding a CTE
Add a CTE to calculate the number of mints with nft.mints by day and then return the average number of mints per day and join it to the existing query
Original query:
Updated query:
Wand Debug
The Wand Debug feature helps fix SQL queries that have syntax errors. When an executed query encounters a syntax error, the Fix Query button should appear in the results/visualization panel. Clicking this button collect your query and the error message and send it to the Wand Debug feature. The Wand Debug feature will then attempt to fix the query and return the fixed query to you. If the Wand Debug feature is unable to fix the query, it will return the updated query with message indicating it is not fully debugged. The query submitted for debugging will be saved in your query history, so you can also recover it.
You can find this feature in the results/visualization panel if you’ve executed a query that failed on a syntax error.
Was this page helpful?