# Chdb Datastore > Use when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or speed up slow pandas. Provides chDB DataStore — same pandas API, ClickHouse engine underneath. Also handles reading from S3, MySQL, PostgreSQL, MongoDB, ClickHouse Cloud, Iceberg, Delta Lake as DataFrames and joining across sources. TRIGGER when: user mentions DataFrame, parquet, csv, "fast pandas", "speed up pandas", or cross-source DataFrame joins; user imports `chdb.datastore` or `from datastore import DataStore`. SKIP this skill for raw SQL syntax (use chdb-sql instead), ClickHouse server administration, or non-Python DataStore API work. Fuente: https://skillsagentes.com/skills/clickhouse/agent-skills/chdb-datastore Markdown: https://skillsagentes.com/skills/clickhouse/agent-skills/chdb-datastore.md Repositorio: https://github.com/ClickHouse/agent-skills Autor: ClickHouse Licencia: Apache-2.0 Actualizado: hace 3 meses Coste de contexto: 170 tok instalada, 1.4k tok al activarse, 9.2k tok con todos los archivos del bundle Bundle: 7 archivos, 36 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add ClickHouse/agent-skills --skill chdb-datastore --agent claude-code # Cursor npx -y skills add ClickHouse/agent-skills --skill chdb-datastore --agent cursor # Codex npx -y skills add ClickHouse/agent-skills --skill chdb-datastore --agent codex # Gemini CLI npx -y skills add ClickHouse/agent-skills --skill chdb-datastore --agent gemini # Windsurf npx -y skills add ClickHouse/agent-skills --skill chdb-datastore --agent windsurf # Cline npx -y skills add ClickHouse/agent-skills --skill chdb-datastore --agent cline ``` ## Antes de instalar - Necesita en el PATH: pip ## Archivos - README.md — 1 KB - SKILL.md — 5 KB - examples/examples.md — 10 KB - metadata.json — 464 B - references/api-reference.md — 9 KB - references/connectors.md — 7 KB - scripts/verify_install.py — 3 KB ## SKILL.md Reproducido tal cual desde ClickHouse/agent-skills bajo Apache-2.0. Esta sección es el documento original y está en inglés. # chdb DataStore — It's Just Faster Pandas ## The Key Insight ```python # Change this: import pandas as pd # To this: import chdb.datastore as pd # Everything else stays the same. ``` DataStore is a **lazy, ClickHouse-backed pandas replacement**. Your existing pandas code works unchanged — but operations compile to optimized SQL and execute only when results are needed (e.g., `print()`, `len()`, iteration). ```bash pip install chdb ``` ## Decision Tree: Pick the Right Approach ``` 1. "I have a file/database and want to analyze it with pandas" → DataStore.from_file() / from_mysql() / from_s3() etc. → See references/connectors.md 2. "I need to join data from different sources" → Create DataStores from each source, use .join() → See examples/examples.md #3-5 3. "My pandas code is too slow" → import chdb.datastore as pd — change one line, keep the rest 4. "I need raw SQL queries" → Use the chdb-sql skill instead ``` ## Connect to Any Data Source — One Pattern ```python from datastore import DataStore # Local file (auto-detects .parquet, .csv, .json, .arrow, .orc, .avro, .tsv, .xml) ds = DataStore.from_file("sales.parquet") # Database ds = DataStore.from_mysql(host="db:3306", database="shop", table="orders", user="root", password="pass") # Cloud storage ds = DataStore.from_s3("s3://bucket/data.parquet", nosign=True) # URI shorthand — auto-detects source type ds = DataStore.uri("mysql://root:pass@db:3306/shop/orders") ``` All 16+ sources and URI schemes → [connectors.md](references/connectors.md) ## After Connecting — Full Pandas API ```python result = ds[ds["age"] > 25] # filter result = ds[["name", "city"]] # select columns result = ds.sort_values("revenue", ascending=False) # sort result = ds.groupby("dept")["salary"].mean() # groupby result = ds.assign(margin=lambda x: x["profit"] / x["revenue"]) # computed column ds["name"].str.upper() # string accessor ds["date"].dt.year # datetime accessor result = ds1.join(ds2, on="id") # join result = ds.head(10) # preview print(ds.to_sql()) # see generated SQL ``` 209 DataFrame methods supported. Full API → [api-reference.md](references/api-reference.md) ## Cross-Source Join — The Killer Feature ```python from datastore import DataStore customers = DataStore.from_mysql(host="db:3306", database="crm", table="customers", user="root", password="pass") orders = DataStore.from_file("orders.parquet") result = (orders .join(customers, left_on="customer_id", right_on="id") .groupby("country") .agg({"amount": "sum", "rating": "mean"}) .sort_values("sum", ascending=False)) print(result) ``` More join examples → [examples.md](examples/examples.md) ## Writing Data ```python source = DataStore.from_mysql(host="db:3306", database="shop", table="orders", user="root", password="pass") target = DataStore("file", path="summary.parquet", format="Parquet") target.insert_into("category", "total", "count").select_from( source.groupby("category").select("category", "sum(amount) AS total", "count() AS count") ).execute() ``` ## Troubleshooting | Problem | Fix | |---------|-----| | `ImportError: No module named 'chdb'` | `pip install chdb` | | `ImportError: cannot import 'DataStore'` | Use `from datastore import DataStore` or `from chdb.datastore import DataStore` | | Database connection timeout | Include port in host: `host="db:3306"` not `host="db"` | | Join returns empty result | Check key types match (both int or both string); use `.to_sql()` to inspect | | Unexpected results | Call `ds.to_sql()` to see the generated SQL and debug | | Environment check | Run `python scripts/verify_install.py` (from skill directory) | ## References - [API Reference](references/api-reference.md) — Full DataStore method signatures - [Connectors](references/connectors.md) — All 16+ data source connection methods - [Examples](examples/examples.md) — 10+ runnable examples with expected output - [Verify Install](scripts/verify_install.py) — Environment verification script - [Official Docs](https://clickhouse.com/docs/chdb) > Note: This skill teaches how to *use* chdb DataStore. > For raw SQL queries, use the `chdb-sql` skill. > For contributing to chdb source code, see CLAUDE.md in the project root. ## Dónde encaja - Categoría: [Bases de datos](https://skillsagentes.com/categorias/bases-de-datos.md) — Diseño de esquemas, migraciones y optimización de consultas. - Creador: [ClickHouse](https://skillsagentes.com/creators/clickhouse.md) — 11 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Clickhouse Js Node Rowbinary](https://skillsagentes.com/skills/clickhouse/agent-skills/clickhouse-js-node-rowbinary.md): Generate TypeScript/JavaScript code that reads/decodes AND writes/encodes ClickHouse RowBinary streams for the ClickHouse HTTP server. Use this skill whenever a user wants to parse or produce `RowBinary`, `RowBinaryWithNames`, or `RowBinaryWithNamesAndTypes`. Node.js only, doesn't cover browsers. - [Infra Clickhouse](https://skillsagentes.com/skills/clickhouse/agent-skills/infra-clickhouse.md): Sets up and manages ClickHouse using the clickhousectl CLI — installs and runs a local ClickHouse server for development, and creates managed ClickHouse Cloud services for production (authentication, service creation, schema migration, application connection). Use when the user wants to build an application with ClickHouse, set up a local ClickHouse dev environment, create tables and start querying, deploy ClickHouse to production or ClickHouse Cloud, or migrate from a local setup to the cloud. - [Infra Postgres](https://skillsagentes.com/skills/clickhouse/agent-skills/infra-postgres.md): Sets up and manages Postgres using the clickhousectl CLI — runs a local Docker-backed Postgres for development, and creates and operates managed ClickHouse Cloud Postgres services (connections, TLS, runtime config, read replicas, failover, point-in-time restore). Use when the user wants a Postgres or PostgreSQL database for their application, a local Postgres dev environment, psql access, or a managed/production Postgres in ClickHouse Cloud, or mentions moving a local Postgres to production. - [Clickstack Otel Collector](https://skillsagentes.com/skills/clickhouse/agent-skills/clickstack-otel-collector.md): Use when a user wants to wire an OpenTelemetry collector into a Managed ClickStack service on ClickHouse Cloud, either by deploying a new local collector (Docker run or Docker Compose) or by configuring their own existing collector, then send rich synthetic telemetry and verify it is visible in ClickStack. - [Clickhouse Js Node Troubleshooting](https://skillsagentes.com/skills/clickhouse/agent-skills/clickhouse-js-node-troubleshooting.md): Troubleshoot and resolve common issues with the ClickHouse Node.js client (@clickhouse/client). Use this skill whenever a user reports errors, unexpected behavior, or configuration questions involving the Node.js client specifically — including socket hang-up errors, Keep-Alive problems, stream handling issues, data type mismatches, read-only user restrictions, proxy/TLS setup problems, or long-running query timeouts. Trigger even when the user hasn't precisely named the issue; vague symptoms like "my inserts keep failing" or "connection drops randomly" in a Node.js context are strong signals to use this skill. Do NOT use for browser/Web client issues. ## Skills relacionadas - [Chdb Sql](https://skillsagentes.com/skills/clickhouse/agent-skills/chdb-sql.md): Use when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse Cloud, Iceberg, Delta Lake) without setting up a server. Provides chDB — embedded ClickHouse SQL in Python with 1000+ functions, Session for stateful multi-step pipelines, parametrized queries, and cross-source joins via `s3()`, `mysql()`, `postgresql()`, `iceberg()`, `deltaLake()`, `remoteSecure()` table functions. TRIGGER when: user wants SQL on parquet/csv/files or across remote analytical sources; uses ClickHouse SQL features (window functions, windowFunnel, geoToH3, JSON path ops, Session, parametrized queries); imports `chdb` or calls `chdb.query()`. SKIP this skill for pandas-style DataFrame method-chaining (use chdb-datastore instead) or ClickHouse server administration. - [Clickhouse Architecture Advisor](https://skillsagentes.com/skills/clickhouse/agent-skills/clickhouse-architecture-advisor.md): MUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices into workload-specific system designs. Complements clickhouse-best-practices with decision frameworks and explicit provenance labels. - [Clickhouse Best Practices](https://skillsagentes.com/skills/clickhouse/agent-skills/clickhouse-best-practices.md): MUST USE when reviewing ClickHouse schemas, queries, or configurations. Contains 31 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses. - [Clickhouse Js Node Coding](https://skillsagentes.com/skills/clickhouse/agent-skills/clickhouse-js-node-coding.md): Write idiomatic application code with the ClickHouse Node.js client (`@clickhouse/client`). Use this skill whenever a user is *building* against the Node.js client — configuring the client, pinging, inserting rows in JSON or raw formats, selecting and parsing results, binding query parameters, managing sessions and temporary tables, working with data types or customizing JSON parsing. Do NOT use for browser/Web client code. - [Clickhouse Js Node Rowbinary](https://skillsagentes.com/skills/clickhouse/agent-skills/clickhouse-js-node-rowbinary.md): Generate TypeScript/JavaScript code that reads/decodes AND writes/encodes ClickHouse RowBinary streams for the ClickHouse HTTP server. Use this skill whenever a user wants to parse or produce `RowBinary`, `RowBinaryWithNames`, or `RowBinaryWithNamesAndTypes`. Node.js only, doesn't cover browsers. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)