dbt-cube-sync: Modern Data Stack Pipeline
🚀 Automated pipeline for converting dbt models to Cube.js schemas and syncing to BI tools
A complete data stack solution that transforms dbt models into Cube.js semantic layers and automatically syncs them to Business Intelligence tools like Superset, Tableau, and PowerBI.
🎯 Features
- 🔄 dbt → Cube.js: Convert dbt models to Cube.js schemas with dimensions and measures
- 📊 BI Integration: Sync Cube.js schemas to Superset, Tableau, PowerBI
- 🐳 Docker Orchestration: Complete containerized setup with dependency management
- ⚙️ CLI Tools: Easy-to-use command-line interface for manual and automated workflows
- 🔌 Extensible: Plugin architecture for adding new BI tools
- 📈 Production Ready: Automated metrics creation, column metadata, and error handling
- 🧠 MetricFlow Semantic Layer: Full support for dbt MetricFlow (v1 and v2 Fusion format)
- 🔗 Cube.js Joins: Auto-generated from dbt foreign-key entities
- 🏷️ Labels & Titles:
label: on metrics and dimensions flows to Cube.js title:
- 🎨 Number Formatting:
config.meta.format: "percent" → Cube.js format: 'percent'
- 🔍 Metric Filters:
config.meta.filter: "${CUBE}.col = val" → Cube.js filters: [...]
🏗️ Architecture
dbt Models → manifest.json/catalog.json → Cube.js Schemas → BI Tools (Superset/Tableau/PowerBI)
↓ ↓ ↓ ↓
PostgreSQL → dbt transformations → Semantic Layer → Dashboards & Analytics
📋 Prerequisites
- Docker & Docker Compose
- Git
🚀 Quick Start
1. Clone & Start
git clone <repository-url>
cd dbt-to-cube
docker-compose up --build
2. Access Services
3. Pipeline Execution
The pipeline runs automatically on startup! Watch the logs:
docker-compose logs -f dbt-cube-sync
🛠️ CLI Usage
Commands
| Command | Description |
|---|
dbt-to-cube | Generate Cube.js schemas from dbt models |
cube-to-bi | Sync Cube.js schemas to BI tools |
sync-all | Incremental sync: dbt → Cube.js → Superset → RAG |
validate-cubes | Pre-merge CI validation: generate cubes + test via real Cube.js instance |
compare-state | Compare local manifest checksums against production state |
align-ci-manifest | Align CI manifest with dbt Cloud artifacts |
Main Commands
1. dbt-to-cube: Convert dbt models to Cube.js
dbt-cube-sync dbt-to-cube \
--manifest /path/to/manifest.json \
--catalog /path/to/catalog.json \
--output /path/to/cube/output
Parameters:
--manifest, -m: Path to dbt manifest.json file (required)
--catalog, -c: Path to dbt catalog.json file (required)
--output, -o: Output directory for Cube.js files (required)
--template-dir, -t: Directory containing Cube.js templates (optional)
2. cube-to-bi: Sync Cube.js to BI tools
dbt-cube-sync cube-to-bi superset \
--cube-files /path/to/cube/files \
--url http://localhost:8088 \
--username admin \
--password admin \
--cube-connection-name Cube
Parameters:
bi_tool: BI tool type (superset|tableau|powerbi)
--cube-files, -c: Directory containing Cube.js files (required)
--url, -u: BI tool URL (required)
--username, -n: Username (required)
--password, -p: Password (required)
--cube-connection-name, -d: Database connection name (default: "Cube")
Manual Execution Examples
# Run inside the dbt-cube-sync container
docker-compose exec dbt-cube-sync dbt-cube-sync --help
# Generate Cube.js schemas
docker-compose exec dbt-cube-sync dbt-cube-sync dbt-to-cube \
-m /workspace/DbtEducationalDataProject/target/manifest.json \
-c /workspace/DbtEducationalDataProject/target/catalog.json \
-o /workspace/cube_output
# Sync to Superset
docker-compose exec dbt-cube-sync dbt-cube-sync cube-to-bi superset \
-c /workspace/cube_output \
-u http://superset:8088 \
-n admin \
-p admin \
-d Cube
🧠 MetricFlow Semantic Layer
Use Format 3 (inline). It is the preferred format for all new semantic layer
work at Ponder, works with both dbt 1.x and dbt-fusion 2.x, and is the only format
that supports dbt_simple_metrics macros under dbt-fusion 2.x. For the full format
reference see SEMANTIC_LAYER_FORMATS.md.
Three metric input formats are supported:
Format 1: config.meta.metrics (Ponder custom)
Works with every dbt version. Metrics are plain dicts inside config.meta.metrics on
the model. Used for backward compatibility and when MetricFlow is unavailable.