Skip to content

Commit 19c5ca3

Browse files
committed
add sql console section
1 parent f675826 commit 19c5ca3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/hub/datasets-viewer.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@ Similarly, if you select one class from a categorical column, it will show only
2020

2121
You can search for a word in the dataset by typing it in the search bar at the top of the table. The search is case-insensitive and will match any row containing the word. The text is searched in the columns of `string`, even if the values are nested in a dictionary or a list.
2222

23+
## Using the SQL Console to query the dataset
24+
25+
You can run SQL queries on the dataset in the browser using the SQL Console. The SQL Console is powered by [DuckDB](https://duckdb.org/) and runs entirely in the browser. You can access the SQL Console from the dataset page by clicking on the `SQL Console` tab.
26+
27+
Through the SQL Console, you can:
28+
29+
- Run [DuckDB SQL queries](https://duckdb.org/docs/sql/query_syntax/select) on the dataset (_checkout [SQL Snippets](https://huggingface.co/spaces/cfahlgren1/sql-snippets) for useful queries_)
30+
- Share results of the query with others via a link (_check out [this example](https://huggingface.co/datasets/gretelai/synthetic-gsm8k-reflection-405b?sql_console=true&sql=FROM+histogram%28%0A++train%2C%0A++topic%2C%0A++bin_count+%3A%3D+10%0A%29)_)
31+
- Download the results of the query to a parquet file
32+
- Embed the results of the query in your own webpage using an iframe
33+
34+
35+
<div class="flex justify-center">
36+
<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sql_console/sql-console-histogram.png"/>
37+
<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/sql_console/sql-console-histogram-dark.png"/>
38+
</div>
39+
40+
<p class="text-sm text-center italic">
41+
To learn more about the SQL Console, see the <a href="https://huggingface.co/blog/sql-console" target="_blank" rel="noopener noreferrer">SQL Console blog post</a>.
42+
</p>
43+
44+
<Tip>
45+
You can also use the DuckDB CLI to query the dataset via the `hf://` protocol. See the <a href="https://huggingface.co/docs/hub/en/datasets-duckdb" target="_blank" rel="noopener noreferrer">DuckDB CLI documentation</a> for more information.
46+
</Tip>
47+
2348
## Share a specific row
2449

2550
You can share a specific row by clicking on it, and then copying the URL in the address bar of your browser. For example https://huggingface.co/datasets/nyu-mll/glue/viewer/mrpc/test?p=2&row=241 will open the dataset viewer on the MRPC dataset, on the test split, and on the 241st row.

0 commit comments

Comments
 (0)