Introduction
Cube is an open-source semantic layer that decouples metric definitions from the tools that consume them. It lets data teams define measures, dimensions, and joins once, then expose them as consistent APIs to any BI tool, AI agent, or application. This eliminates metric drift across dashboards and reports.
What Cube Does
- Provides a universal semantic layer over any SQL database
- Pre-aggregates and caches query results for sub-second response times
- Exposes REST, GraphQL, and SQL APIs for downstream consumption
- Supports multi-tenant access control with row-level security
- Integrates with BI tools, notebooks, and AI applications
Architecture Overview
Cube consists of a modeling layer where you define data schemas in YAML or JavaScript, a query orchestration engine written in Rust that compiles semantic queries into optimized SQL, and a caching layer backed by Cube Store (a columnar pre-aggregation engine). The API gateway serves REST and GraphQL endpoints. Cube Store handles materialized pre-aggregations for fast analytical queries.
Self-Hosting & Configuration
- Deploy via Docker, npm, or Kubernetes Helm charts
- Connect to PostgreSQL, MySQL, BigQuery, Snowflake, Databricks, and 20+ sources
- Define data models in the /model directory using YAML schema files
- Configure caching and pre-aggregation strategies per cube
- Set up authentication via JWT tokens and define access policies in security contexts
Key Features
- Write metric definitions once, consume from any tool or API
- Rust-powered query engine with automatic query optimization
- Built-in pre-aggregation engine for sub-second dashboard performance
- Multi-tenant architecture with configurable data access policies
- Native support for conversational analytics with AI agents
Comparison with Similar Tools
- dbt — Transforms data in the warehouse; Cube adds a serving and caching layer on top
- Looker (LookML) — Proprietary semantic layer tied to Google Cloud; Cube is open source
- Metabase — BI tool with its own modeling; Cube is headless and tool-agnostic
- Apache Superset — Visualization platform; Cube provides the metric API underneath
- Lightdash — dbt-native BI; Cube offers broader API surface and caching
FAQ
Q: How does Cube differ from a BI tool? A: Cube is headless. It provides APIs for metrics and dimensions but does not include visualization. You connect your preferred BI tool or build custom UIs on top.
Q: Can I use Cube with AI agents? A: Yes. Cube exposes a SQL API that AI agents can query using natural language translated to SQL, ensuring consistent metric definitions.
Q: What databases does Cube support? A: Cube supports PostgreSQL, MySQL, BigQuery, Snowflake, Databricks, ClickHouse, Athena, Trino, and many more via its driver ecosystem.
Q: Is Cube free to use? A: Cube Core is open source under a permissive license. Cube Cloud offers a managed version with additional features.