Stateless, read-only graph query engine for ClickHouse using Cypher
3.6K
CREATE / SET / DELETE / REMOVE). Reads also work in remote and sql_only modes. Exports query results to external destinations. Golang and Python bindings in addition to native Rust. New cg CLI tool supports agentic workflows.Note: ClickGraph dev release is at beta quality for view-based graph analytics applications. Kindly raise an issue if you encounter any problem.
π§ Meet DeltaGraph β ClickGraph's sibling for Databricks. The same engine, the same Cypher, the same Bolt/Neo4j-Browser compatibility β but translating to Spark SQL and executing against a Databricks SQL Warehouse instead of ClickHouse. One codebase, two server binaries (
clickgraphfor ClickHouse,deltagraphfor Databricks); pick the backend at runtime. See the Docker quickstartβ , the build-from-source quickstartβ , or how the two are packagedβ .
ClickGraph provides three modes now:
chDBSee motivation and rationaleβ .
deltagraph server (Cypher β Spark SQL β Databricks SQL Warehouse) ships alongside clickgraph in the same Docker image (genezhang/clickgraph, selected via --entrypoint /usr/local/bin/deltagraph) and as its own deltagraph-<platform> release tarball on every platform. A user chooses the backend at runtime β run clickgraph (ClickHouse), run deltagraph (Databricks), run both side-by-side on different ports, or clickgraph --databricks. The Neo4j Browser demo is verified live end-to-end on both backends at full result parity, including a live Databricks free-tier warehouse. Start here: Docker quickstartβ Β· packaging & binary selectionβ .toString() float fidelity (#1055) β toString(3.0) now returns "3.0" (Neo4j semantics), not "3", on both the ClickHouse and Databricks dialects. See CHANGELOG.mdβ .--features databricks). A second SQL dialect alongside ClickHouse: Cypher is translated to Spark SQL locally and executed against a Databricks SQL Warehouse over the Statement Execution API. Dialect routing through FunctionMapper (groupArrayβcollect_list, toInt64βbigint, Array(Int64)βARRAY<BIGINT>, etc.), including variable-length paths and BFS shortestPath. PAT auth with Debug redaction. Surfaces: Database::new_databricks(schema, DatabricksConfig) in clickgraph-embedded, Database::open_databricks over the FFI for Go/Python, cg --dialect databricks for SQL emission and execution (env-only PAT), cg schema discover --dialect databricks for LLM-assisted YAML drafts off a live warehouse, optional top-level catalog: YAML field for schemas permanently tied to one Unity Catalog (env still wins), and a dedicated deltagraph server binary (HTTP + Bolt, defaults to Databricks). Manual walkthrough: docs/deltagraph/QUICKSTART.mdβ . Docker quickstart: docs/deltagraph/DOCKER_QUICKSTART.mdβ . Packaging & binary selection: docs/deltagraph/PACKAGING.mdβ . Plan: docs/design/DELTAGRAPH_PLAN.mdβ . Still pending: MERGE, OAuth M2M auth, full LDBC validation against a live warehouse, external-link result chunks.CREATE, SET, DELETE / DETACH DELETE, and REMOVE against ClickGraph-managed (non-source:) tables. Translates to ClickHouse's lightweight INSERT / UPDATE / DELETE mutation path; tables created by ClickGraph automatically get enable_block_number_column = 1, enable_block_offset_column = 1. Per-node id_generation schema attribute (uuid default / provided / snowflake). Returns Neo4j-compatible counters (nodes_created, properties_set, nodes_deleted, relationships_deleted). Server / remote / sql_only modes reject writes upstream via the write_guard admission check; source:-backed nodes/edges remain read-only. MERGE, relationship CREATE, CREATE β¦ RETURN, edge-alias DELETE r, SET a += {β¦} map-merge, and REMOVE a:Label are not implemented yet β each is rejected with an explicit error rather than silently mis-rendering. See docs/wiki/Cypher-Language-Reference.mdβ for full syntax + caveats and docs/design/embedded-writes.mdβ for the design.cg CLI tool β Agent/script-oriented CLI (clickgraph-tool crate). Translate and execute Cypher without a running server: cg sql, cg validate, cg query, cg nl (NLβCypher via LLM), cg schema show/validate/discover/diff. Config via ~/.config/cg/config.toml. Designed for agentic callers, CI pipelines, and scripting.embedded feature now opt-in β clickgraph-embedded compiles without chdb by default. New Database::new_remote(schema, RemoteConfig) constructor executes Cypher against external ClickHouse with no chdb dependency β useful for lightweight tooling and the cg CLI./cypher (NLβCypherβexecute), /graph-schema (show schema), /schema-discover (generate schema YAML from ClickHouse via LLM). See skills/README.mdβ .query_remote(), query_remote_graph(), store_subgraph() β ideal for GraphRAG context enrichment. Available in Rust, Python, and Go.create_node(), create_edge(), upsert_node() with batch variants. AI agents can extract entities from documents, store them as an in-process graph, and query with Cypher β all without a server.Value::Date/Timestamp/UUID types, query timing (compiling_time/execution_time), Database::in_memory(), Connection::set_query_timeout(), column type metadata, multi-format file import (CSV/Parquet/JSON).result.get_as_df() (Pandas), result.get_as_arrow() (PyArrow), result.get_as_pl() (Polars) for Python data science workflows.See CHANGELOG.mdβ for complete release history.
--features embedded)Database::new_remote)--features databricks; ships the deltagraph server binary, cg --dialect databricks, Database::new_databricks (embedded Rust), and Database::open_databricks (FFI for Go/Python). See docs/deltagraph/QUICKSTART.mdβ (build from source) or docs/deltagraph/DOCKER_QUICKSTART.mdβ (Docker).cg schema discover or :discover generates YAML schema from ClickHouse table metadata using Anthropic or OpenAI β no server needed*1..3 syntax using ClickHouse WITH RECURSIVE CTEslength(p), nodes(p), relationships(p) for path analysis$param syntax for SQL injection preventionch.function_name() and chagg.aggregate() prefixesformat: "Graph" returns deduplicated nodes, edges, and stats for graph visualization and RAG pipelinescreate_node(), create_edge(), upsert_node() for in-process graph building (embedded mode)CLICKHOUSE_CLUSTER env var auto-discovers and balances queries across cluster nodesCREATE / SET / DELETE / REMOVE) that will unblock them.USE clause, session parameter, or default/cypher, /graph-schema, /schema-discover for Claude Code, LangChain, AutoGen, CrewAI, and OpenAI function calling (see skills/README.mdβ )cg CLI - Subprocess-friendly CLI for agentic callers; outputs clean text/JSON, no interactive promptsapoc.meta.schema() and Neo4j schema procedures for MCP-based AI assistantsget_as_df() (Pandas), get_as_arrow() (PyArrow), get_as_pl() (Polars) for Python data scienceauto_discover_columns: true queries ClickHouse metadata automaticallyPOST /schemas/loadnode_id: [tenant_id, user_id])ClickGraph service runs as a lightweight stateless query translator alongside ClickHouse:
flowchart LR
Clients["Graph Clients<br/><br/>HTTP/REST<br/>Bolt Protocol<br/>(Neo4j tools)"]
ClickGraph["ClickGraph<br/><br/>Cypher -> SQL<br/>Translator<br/><br/>:7475 (HTTP)<br/>:7687 (Bolt)"]
ClickHouse["ClickHouse<br/><br/>Columnar Storage<br/>Query Engine"]
Clients -->|Cypher| ClickGraph
ClickGraph -->|SQL| ClickHouse
ClickHouse -->|Results| ClickGraph
ClickGraph -->|Results| Clients
style ClickGraph fill:#e1f5ff,stroke:#0288d1,stroke-width:3px
style ClickHouse fill:#fff3e0,stroke:#f57c00,stroke-width:3px
style Clients fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
Three-tier architecture: Graph clients -> ClickGraph translator -> ClickHouse database
New to ClickGraph? See the Getting Started Guideβ for a complete walkthrough.
Download the latest release from GitHub Releasesβ . Assets are gzipped tarballs (.tar.gz on Linux/macOS, .zip on Windows) named <binary>-<platform>, where <platform> is one of linux-amd64, macos-amd64, macos-arm64, win-amd64:
# ClickGraph server (ClickHouse backend)
curl -L https://github.com/genezhang/clickgraph/releases/latest/download/clickgraph-linux-amd64.tar.gz \
| tar -xz && chmod +x clickgraph
# DeltaGraph server (Databricks backend) β same Cypher/Bolt, Spark SQL dialect
curl -L https://github.com/genezhang/clickgraph/releases/latest/download/deltagraph-linux-amd64.tar.gz \
| tar -xz && chmod +x deltagraph
# cg CLI tool (agent/scripting use)
curl -L https://github.com/genezhang/clickgraph/releases/latest/download/cg-linux-amd64.tar.gz \
| tar -xz && chmod +x cg
# Pull the latest image
docker pull genezhang/clickgraph:latest
# Start ClickHouse only
docker-compose up -d clickhouse-service
# Run ClickGraph from Docker Hub image
docker run -d \
--name clickgraph \
--network clickgraph_default \
-p 7475:7475 \
-p 7687:7687 \
-e CLICKHOUSE_URL="http://clickhouse-service:8123" \
-e CLICKHOUSE_USER="test_user" \
-e CLICKHOUSE_PASSWORD="test_pass" \
-e GRAPH_CONFIG_PATH="/app/schemas/social_benchmark.yaml" \
-v $(pwd)/benchmarks/social_network/schemas:/app/schemas:ro \
genezhang/clickgraph:latest
Or use docker-compose (uses published image by default):
docker-compose up -d
# Prerequisites: Rust toolchain (1.85+) and Docker for ClickHouse
# 1. Clone and start ClickHouse
git clone https://github.com/genezhang/clickgraph
cd clickgraph
docker-compose up -d clickhouse-service
# 2. Build and run
cargo build --release
export CLICKHOUSE_URL="http://localhost:8123"
export CLICKHOUSE_USER="test_user"
export CLICKHOUSE_PASSWORD="test_pass"
export GRAPH_CONFIG_PATH="./benchmarks/social_network/schemas/social_benchmark.yaml"
cargo run --bin clickgraph
GRAPH_CONFIG_PATHis required. It tells ClickGraph how to map ClickHouse tables to graph nodes and edges.
# HTTP API
curl -X POST http://localhost:7475/query \
-H "Content-Type: application/json" \
-d '{"query": "MATCH (u:User) RETURN u.full_name LIMIT 5"}'
# Bolt protocol (cypher-shell, Neo4j Browser, or any Neo4j driver)
cypher-shell -a bolt://localhost:7687 -u neo4j -p password
Run the included demo for interactive graph visualization:
cd demos/neo4j-browser && bash setup.sh
Then open http://localhost:7474β and connect to bolt://localhost:7687.
See demos/neo4j-browser/README.mdβ for details.
Agent skills β drop-in skills for Claude Code and other agentic frameworks, backed by the cg CLI (no MCP server needed):
# Install for Claude Code
mkdir -p .claude/commands
curl -L https://raw.githubusercontent.com/genezhang/clickgraph/main/skills/cypher.md \
-o .claude/commands/cypher.md
curl -L https://raw.githubusercontent.com/genezhang/clickgraph/main/skills/graph-schema.md \
-o .claude/commands/graph-schema.md
# Then in Claude Code:
# /cypher find users with more than 10 followers
# /graph-schema
See skills/README.mdβ for installation across Claude Code, LangChain, AutoGen, CrewAI, and OpenAI function calling.
MCP server β for frameworks requiring the MCP protocol, ClickGraph implements apoc.meta.schema() and Neo4j-compatible schema procedures, compatible with @anthropic-ai/mcp-server-neo4jβ and @neo4j/mcp-neo4jβ .
See the MCP Setup Guideβ for configuration details.
cg β agent/script CLI (no server needed):
cargo build --release -p clickgraph-tool
# Translate Cypher β SQL
./target/release/cg --schema schema.yaml sql "MATCH (u:User) RETURN u.name LIMIT 5"
# Execute against ClickHouse
./target/release/cg --schema schema.yaml --clickhouse http://localhost:8123 \
query "MATCH (u:User)-[:FOLLOWS]->(f) RETURN f.name LIMIT 5"
# NL β Cypher (requires ANTHROPIC_API_KEY or OPENAI_API_KEY)
./target/release/cg --schema schema.yaml nl "find users with more than 10 followers"
clickgraph-client β interactive REPL (connects to a running server):
cargo build --release -p clickgraph-client
./target/release/clickgraph-client # connects to http://localhost:7475
Map your tables to a graph with YAML:
views:
- name: social_network
nodes:
- label: user
table: users
database: mydb
node_id: user_id
property_mappings:
name: full_name
edges:
- type: follows
table: user_follows
database: mydb
from_node: user
to_node: user
from_id: follower_id
to_id: followed_id
MATCH (u:user)-[:follows]->(friend:user)
WHERE u.name = 'Alice'
RETURN friend.name
Current Version: v0.6.6-dev
CREATE, SET, DELETE, REMOVE work in embedded mode against ClickGraph-managed tables (v0.6.7+). Server / remote / sql_only modes reject writes; source:-backed nodes/edges remain read-only. MERGE is planned for v0.7.x. See Known Issues #2 / #3β for the full list of unsupported write combinations.See STATUS.mdβ and KNOWN_ISSUES.mdβ for details.
| Phase | Version | Status |
|---|---|---|
| Phase 1 | v0.4.0 | Complete - Query cache, parameters, Bolt protocol |
| Phase 2 | v0.5.0 | Complete - Multi-tenancy, RBAC, auto-schema discovery |
| Phase 2.5-2.6 | v0.5.2-v0.5.3 | Complete - Schema variations, Cypher functions |
| Phase 3 | v0.6.3 | Complete - WITH redesign, GraphRAG, LDBC SNB, MCP |
| Phase 4 | v0.6.x | Next - user-requested features, advanced optimizations |
See ROADMAP.mdβ for detailed feature tracking.
Contributions welcome! See DEV_QUICK_START.mdβ to get started and DEVELOPMENT_PROCESS.mdβ for the full workflow.
ClickGraph is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
This project is developed on a forked repo of Brahmandβ with zero-ETL view-based graph querying, Neo4j ecosystem compatibility and enterprise deployment capabilities.
Content type
Image
Digest
sha256:acd20c6f8β¦
Size
47.5 MB
Last updated
about 1 month ago
docker pull genezhang/clickgraph