---
title: "Analyzing Hugging Face datasets with ClickHouse"
description: "Hugging Face's Datasets Server automatically converts every dataset to Parquet and exposes the file URLs through a REST endpoint, so clickhouse-local can query any dataset with plain SQL via the url function and URL table engine."
url: "https://swe.quest/articles/analyzing-hugging-face-datasets-with-clickhouse-12e5d1b0f22de93c"
canonical: "https://clickhouse.com/blog/query-analyze-hugging-face-datasets-with-clickhouse"
source: "ClickHouse"
published: "2023-08-29"
difficulty: "medium"
kind: "How-to"
reading_minutes: 28
tags: ["analytics","sql","machine-learning"]
---

# Analyzing Hugging Face datasets with ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-08-29, 28 min read, How-to. Original: [https://clickhouse.com/blog/query-analyze-hugging-face-datasets-with-clickhouse](https://clickhouse.com/blog/query-analyze-hugging-face-datasets-with-clickhouse)

## Summary

Hugging Face's Datasets Server automatically converts every dataset to Parquet and exposes the file URLs through a REST endpoint, so clickhouse-local can query any dataset with plain SQL via the url function and URL table engine. The walkthrough uses a Spotify tracks dataset to show aggregations, varPop checks, and bar-function histograms, then moves to ClickHouse's statistical functions and a reusable UDF that queries a dataset by name alone. Practical gotchas include setting max\_http\_get\_redirects = 1 to follow the CDN redirect and enable\_url\_encoding = 0 to preserve escaped paths. Slow reads caused by small Parquet row groups, each triggering a separate HTTP request, were fixed in ClickHouse issue 53069.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- Parquet format

## Keywords

ClickHouse, clickhouse-local, Hugging Face, Parquet, Datasets Server

## Related posts

- [DuckDB: analyze 50,000+ datasets stored on the Hugging Face Hub](https://swe.quest/articles/duckdb-analyze-50-000-datasets-stored-on-the-hugging-face-hub-05ca0d0e06164c0a.md): Hugging Face · 2023-06-07 · Medium · 3 min read · Analytics & OLAP, SQL, Python
  Every public dataset on the Hugging Face Hub is now automatically converted to Parquet by the dataset viewer and can be queried with SQL through DuckDB.
- [Getting Data Into ClickHouse - Part 3 - Using S3](https://swe.quest/articles/getting-data-into-clickhouse-part-3-using-s3-3c57bebcb705e26d.md): ClickHouse · 2022-09-16 · Medium · 21 min read · Analytics & OLAP, SQL, Cloud platforms, Performance engineering, Data pipelines
  ClickHouse can both query data in place on Amazon S3 and ingest it, shown here on an 11.5-billion-row, ~600GB forex tick dataset stored as zstd CSV and Parquet.
- [A Deep Dive into Apache Parquet with ClickHouse - Part 1](https://swe.quest/articles/a-deep-dive-into-apache-parquet-with-clickhouse-part-1-cafa50694ad68bf6.md): ClickHouse · 2023-04-18 · Medium · 11 min read · Analytics & OLAP, Data pipelines, SQL
  ClickHouse can read and write Apache Parquet through its file and s3 table functions, using the same Parquet code in ClickHouse Local and ClickHouse Server.
- [Extracting, Converting, and Querying Data in Local Files using clickhouse-local](https://swe.quest/articles/extracting-converting-and-querying-data-in-local-files-using-clickhouse-local-46ff61f0273cc3b7.md): ClickHouse · 2023-01-04 · Medium · 13 min read · Analytics & OLAP, SQL, Data pipelines, Developer tools
  clickhouse-local runs ClickHouse's SQL engine as a standalone CLI, so you can query, transform and convert local, piped, HTTP, S3, MySQL or Postgres data without deploying a server.
- [ClickHouse Release 23.8](https://swe.quest/articles/clickhouse-release-23-8-8db1ebb65d969c75.md): ClickHouse · 2023-09-15 · Medium · 10 min read · Analytics & OLAP, Query engines, Data pipelines, Performance engineering
  ClickHouse 23.8 makes file reads much faster by using Parquet row-group min/max statistics to skip data, answering count() from file metadata, and pruning files via the \_file virtual column without reading them.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
