datachain-ai/datachain
The Context Layer for unstructured data: typed, versioned datasets over S3, GCS, Azure
DataChain – A Python library for versioned, queryable datasets on unstructured data
What it is
- A Python package that treats files stored in S3, GCS, Azure, or local disks as typed, version‑controlled datasets.
- It builds a lightweight SQLite‑backed Dataset DB that stores schemas (via Pydantic), file pointers, lineage, and even vector embeddings, enabling sub‑second filtering, joins, aggregations, and similarity search without moving the raw files.
- An optional Knowledge Base layer exports this metadata as markdown for humans and LLM agents, and a Skill can install a data‑aware agent harness for Claude, Cursor, Codex, GitHub Copilot, or Pi.
Key components
| Component | Role |
|---|---|
| Compute Engine | Parallel Python over files (async I/O, checkpointing, incremental updates). |
| Dataset DB | Stores Pydantic schemas, versioned dataset definitions, and vectors; queries run directly against SQLite. |
| Knowledge Base | Auto‑generated markdown describing datasets, useful for agents and documentation. |
| Agent Harness / Skill | Exposes read_storage, map, save, etc., to LLM agents so they can reason about and manipulate data. |
| Studio (cloud service) | Optional hosted UI for shared dataset registry, distributed compute, access control, and lineage visualisation. |
Typical workflow
- Read storage –
dc.read_storage('s3://bucket/**/*.jpg', anon=True, delta=True)creates a lazy collection of files. - Define a schema – Write a Pydantic model; the return type of a mapping function becomes the dataset schema.
- Map / transform – Apply a Python UDF (
.map(info=get_info)) to each file; DataChain handles batching, checkpointing, and only re‑processes new/changed files. - Save –
.save('pets_images')registers the result as a versioned dataset (pets_images@1.0.0). - Query – Use the fluent API (
filter,mutate,order_by,limit) to run fast SQL‑like operations or vector similarity searches directly on the Dataset DB. - Knowledge Base – Run
dc-knowledgegeneration to produce markdown that LLM agents can read. - Agent‑driven pipelines – With the installed skill, an LLM (e.g., Claude Code) can generate the whole pipeline from a natural‑language prompt.
Why it matters
- No data copying – Datasets are just metadata and pointers; raw files stay in your cloud bucket.
- Versioning & reproducibility – Every pipeline step is a named, immutable dataset version, making it easy to roll back or reuse results.
- Scalable queries – SQLite‑based engine can filter and join millions of rows in milliseconds, far beyond what in‑memory pandas can handle.
- Agent‑ready – The skill bridges LLM agents with your data, letting them understand dataset schemas, perform joins, and generate code automatically.
Installation
pip install datachain
# optional agent skill
# datachain skill install --target claude # also cursor, codex, copilot, pi
Example (find dogs similar to a reference image, filtered by breed, mask, and size) – the README shows a full prompt‑to‑result flow where Claude Code decomposes the task, builds intermediate datasets, and returns a ranked list of matches.
Target audience
- Data engineers and ML teams that need reproducible pipelines over large, unstructured media collections.
- AI developers building LLM‑driven agents that must interact with real data without moving it.
- Organizations that store data in cloud object stores and want a lightweight, version‑controlled data catalog.
Links
- PyPI: https://pypi.org/project/datachain/
- Docs: https://www.datachain.ai/docs
- Studio (hosted UI): https://studio.datachain.ai
- GitHub: https://github.com/datachain-ai/datachain
Related
- Project
- Project
- Project
- Project
- Project