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.0a4.tar.gz (15.5 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.0a4-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbt_cube_sync-0.1.0a4.tar.gz
  • Upload date:
  • Size: 15.5 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.0a4.tar.gz
Algorithm Hash digest
SHA256 76a862762fdabfe4d05710ff9f1aab22c358c041f9b716b76e3c7f9441428f15
MD5 d97e9ad3cd9ec7550cfbfcffbac4cd56
BLAKE2b-256 924a53aea4526520a87633b4c323c0dbc67b175a45aeefd6e2a64b569ce53eb5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dbt_cube_sync-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 19.2 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.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 d35a2850584b2430250a501632b70bbe93e943c2965e2d5e1609fde7eb8756de
MD5 20e2f523f6f63f2e3942b7ec971cc626
BLAKE2b-256 d7a108e4b29370508f3d47b3dfa4efaca0fab0bfa02371ce4c9f27189ae90650

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