Skip to main content

Synchronization tool for dbt models to Cube.js schemas and BI tools

Project description

dbt-cube-sync

A powerful synchronization tool that creates a seamless pipeline from dbt models to Cube.js schemas and BI tools (Superset, Tableau, PowerBI).

Features

  • ๐Ÿ”„ dbt โ†’ Cube.js: Auto-generate Cube.js schemas from dbt models with metrics
  • ๐Ÿ“Š Cube.js โ†’ BI Tools: Sync schemas to multiple BI platforms
  • ๐Ÿ—๏ธ Extensible Architecture: Plugin-based connector system for easy BI tool integration
  • ๐Ÿณ Docker Support: Containerized execution with orchestration support
  • ๐ŸŽฏ CLI Interface: Simple command-line tools for automation

Supported BI Tools

  • โœ… Apache Superset - Full implementation
  • ๐Ÿšง Tableau - Placeholder (coming soon)
  • ๐Ÿšง PowerBI - Placeholder (coming soon)

Installation

Using Poetry (Development)

cd dbt-cube-sync
poetry install
poetry run dbt-cube-sync --help

Using Docker

docker build -t dbt-cube-sync .
docker run --rm dbt-cube-sync --help

Quick Start

1. Create Configuration File

# Create sample config
dbt-cube-sync create-config sync-config.yaml

# Edit the config file with your BI tool credentials

2. Generate Cube.js Schemas

# Generate from dbt manifest
dbt-cube-sync generate-cubes \\
  --dbt-manifest ./DbtEducationalDataProject/target/manifest.json \\
  --output-dir ./cube/conf/cube_output

3. Sync to BI Tool

# Sync to Superset
dbt-cube-sync sync-bi superset \\
  --cube-dir ./cube/conf/cube_output \\
  --config-file ./sync-config.yaml

4. Full Pipeline

# Complete dbt โ†’ Cube.js โ†’ Superset pipeline
dbt-cube-sync full-sync \\
  --dbt-manifest ./DbtEducationalDataProject/target/manifest.json \\
  --cube-dir ./cube/conf/cube_output \\
  --bi-connector superset \\
  --config-file ./sync-config.yaml

Configuration

Sample Configuration (sync-config.yaml)

connectors:
  superset:
    type: superset
    url: http://localhost:8088
    username: admin
    password: admin
    database_name: Cube
    
  tableau:
    type: tableau
    url: https://your-tableau-server.com
    username: your-username
    password: your-password
    
  powerbi:
    type: powerbi
    # PowerBI specific configuration

CLI Commands

generate-cubes

Generate Cube.js schema files from dbt models.

Options:

  • --dbt-manifest / -m: Path to dbt manifest.json file
  • --output-dir / -o: Output directory for Cube.js files
  • --template-dir / -t: Directory containing Cube.js templates

sync-bi

Sync Cube.js schemas to BI tool datasets.

Arguments:

  • connector: BI tool type (superset, tableau, powerbi)

Options:

  • --cube-dir / -c: Directory containing Cube.js files
  • --config-file / -f: Configuration file for BI tool connection

full-sync

Complete pipeline: dbt models โ†’ Cube.js schemas โ†’ BI tool datasets.

Options:

  • --dbt-manifest / -m: Path to dbt manifest.json file
  • --cube-dir / -c: Directory for Cube.js files
  • --template-dir / -t: Directory containing Cube.js templates
  • --bi-connector / -b: BI tool to sync to
  • --config-file / -f: Configuration file for BI tool connection

Architecture

dbt models (with metrics) 
    โ†“
dbt-cube-sync generate-cubes
    โ†“
Cube.js schemas
    โ†“
dbt-cube-sync sync-bi [connector]
    โ†“
BI Tool Datasets (Superset/Tableau/PowerBI)

Project Structure

dbt-cube-sync/
โ”œโ”€โ”€ dbt_cube_sync/
โ”‚   โ”œโ”€โ”€ cli.py                 # CLI interface
โ”‚   โ”œโ”€โ”€ config.py             # Configuration management
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ dbt_parser.py     # dbt manifest parser
โ”‚   โ”‚   โ”œโ”€โ”€ cube_generator.py # Cube.js generator
โ”‚   โ”‚   โ””โ”€โ”€ models.py         # Pydantic data models
โ”‚   โ””โ”€โ”€ connectors/
โ”‚       โ”œโ”€โ”€ base.py           # Abstract base connector
โ”‚       โ”œโ”€โ”€ superset.py       # Superset implementation
โ”‚       โ”œโ”€โ”€ tableau.py        # Tableau placeholder
โ”‚       โ””โ”€โ”€ powerbi.py        # PowerBI placeholder
โ”œโ”€โ”€ Dockerfile                # Container definition
โ”œโ”€โ”€ pyproject.toml            # Poetry configuration
โ””โ”€โ”€ README.md

Adding New BI Connectors

  1. Create a new connector class inheriting from BaseConnector
  2. Implement the required abstract methods
  3. Register the connector using ConnectorRegistry.register()

Example:

from .base import BaseConnector, ConnectorRegistry

class MyBIConnector(BaseConnector):
    def _validate_config(self):
        # Validation logic
        pass
    
    def connect(self):
        # Connection logic
        pass
    
    def sync_cube_schemas(self, cube_dir):
        # Sync implementation
        pass

# Register the connector
ConnectorRegistry.register('mybi', MyBIConnector)

Docker Integration

The tool is designed to work in containerized environments with proper dependency orchestration:

  1. dbt docs: Runs dbt build then serves documentation
  2. dbt-cube-sync: Runs sync pipeline after dbt and Cube.js are ready
  3. BI Tools: Receive synced datasets after sync completes

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_cube_sync-0.1.0a1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_cube_sync-0.1.0a1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file dbt_cube_sync-0.1.0a1.tar.gz.

File metadata

  • Download URL: dbt_cube_sync-0.1.0a1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.10.19 Linux/6.11.0-1018-azure

File hashes

Hashes for dbt_cube_sync-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 d02132eb77292db15bc1f5fba4e91c8e0e9421470afdde674b59f9e2ceb09f70
MD5 beb80fc32e13616c5069df9d25a29760
BLAKE2b-256 ff88cbabd4f4c29d5235034e0dc25974ca43b79342a458318316cde6a4108479

See more details on using hashes here.

File details

Details for the file dbt_cube_sync-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: dbt_cube_sync-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.10.19 Linux/6.11.0-1018-azure

File hashes

Hashes for dbt_cube_sync-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2817cf6ccd58552dbe1925c7b8c69b3c7b0ab91b50c30e34d5b842209c42211
MD5 a0a82e22e7ab8fd79495eb1b31e3517e
BLAKE2b-256 94d74304b67fae89b86825cfdaaf9ca56e643933bdff134d12c289ca03f88b61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page