---
title: "ClickPy at 2 Trillion rows: Scaling ingestion and fixing the past"
description: "ClickPy, ClickHouse's free PyPI download analytics service, now holds over 2.2 trillion rows, and its cron-based ingestion script was replaced with ClickPipes without downtime."
url: "https://swe.quest/articles/clickpy-at-2-trillion-rows-scaling-ingestion-and-fixing-the-past-d834572321743679"
canonical: "https://clickhouse.com/blog/clickpy-2-trillion-rows"
source: "ClickHouse"
published: "2026-01-21"
difficulty: "medium"
kind: "Case study"
reading_minutes: 7
tags: ["data-pipelines","analytics","schema-migrations"]
---

# ClickPy at 2 Trillion rows: Scaling ingestion and fixing the past

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-01-21, 7 min read, Case study. Original: [https://clickhouse.com/blog/clickpy-2-trillion-rows](https://clickhouse.com/blog/clickpy-2-trillion-rows)

## Summary

ClickPy, ClickHouse's free PyPI download analytics service, now holds over 2.2 trillion rows, and its cron-based ingestion script was replaced with ClickPipes without downtime. The new pipeline loaded data into a staging database with cloned schemas, a Null-engine raw table and a materialized view that holds all transformation logic. A fresh GCS bucket avoided reprocessing history, and the new pipeline ran in parallel and was validated by comparing daily row counts before cutover. That validation exposed missing historical days, which were fixed with lightweight deletes and per-day re-ingestion. Daily-aggregated materialized views could be deleted and repopulated by date, while non-daily aggregates such as monthly totals had to be dropped, rebuilt and recreated to avoid double counting.

Written by swe.quest, not by the author.

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

## Topics

- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)

## Prerequisites

- ClickHouse materialized views ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- columnar databases ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- ETL pipelines ([easy posts on Data pipelines](https://swe.quest/tags/data-pipelines.md?difficulty=easy))

## Keywords

ClickPy, ClickHouse, ClickPipes, BigQuery, Google Cloud Storage, PyPI, Null engine

## Related posts

- [ClickPy reaches one trillion rows](https://swe.quest/articles/clickpy-reaches-one-trillion-rows-62072046dc562ee8.md): ClickHouse · 2024-08-30 · Medium · 6 min read · Analytics & OLAP, Data pipelines, SQL, Python
  ClickPy, a free open-source real-time analytics service for PyPI download statistics built on ClickHouse, has passed one trillion rows in its main downloads table.
- [How Spyne simplified their CDC pipeline with ClickPipes and ClickHouse Cloud](https://swe.quest/articles/how-spyne-simplified-their-cdc-pipeline-with-clickpipes-and-clickhouse-cloud-44d67da08e6e4dbc.md): ClickHouse · 2026-06-22 · Medium · 6 min read · Event-driven architecture, Data pipelines, Analytics & OLAP, Schema migrations
  Spyne replaced a self-managed Debezium → Kafka → ClickHouse Kafka-engine/materialized-view CDC pipeline with ClickPipes on ClickHouse Cloud.
- [“A generational leap”: How Trio unified payment analytics and cut storage by 88% with ClickHouse Cloud](https://swe.quest/articles/a-generational-leap-how-trio-unified-payment-analytics-and-cut-storage-by-88-b4c6dd92d9387fc0.md): ClickHouse · 2026-04-17 · Medium · 7 min read · Analytics & OLAP, Payments & fintech, Stream processing, Data pipelines
  Trio, a Brazilian payments fintech processing 243M+ payments in H1 2025 and over 1B events a day, consolidated legacy and active systems into ClickHouse Cloud as a single analytical source of truth for reconciliation, compliance and dashboards.
- [Data Hive: The story of beehiiv’s journey from Postgres to ClickHouse](https://swe.quest/articles/data-hive-the-story-of-beehiiv-s-journey-from-postgres-to-clickhouse-467867cb2bebb87b.md): ClickHouse · 2024-08-21 · Easy · 6 min read · Analytics & OLAP, Databases, PostgreSQL, Stream processing, Queues & messaging
  beehiiv replaced its Postgres-and-Ruby-queue analytics system, which struggled with billions of email events and had multi-hour reporting delays, with a Kafka-fed ClickHouse Cloud pipeline.
- [ClickHouse and the MTA Data Challenge](https://swe.quest/articles/clickhouse-and-the-mta-data-challenge-dc13e535ba1ed542.md): ClickHouse · 2024-10-24 · Medium · 16 min read · Analytics & OLAP, Data pipelines, SQL
  Loading and cleaning the ~95 million-row NYC MTA subway turnstile dataset (2014–2022) in ClickHouse, using schema inference over S3, a staging table, and an optimized schema with LowCardinality strings, a combined DateTime column, UInt32 counters, sorted line-name arrays and a (station, date\_time) ordering key.

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)
