dbt Fusion Documentation

repository·main·Indexed 20 days ago

https://github.com/dbt-labs/dbt-fusion

A high-performance, Rust-based rewrite of the dbt execution engine featuring enhanced SQL comprehension and faster data transfers via ADBC drivers. The repository includes the dbt-ci crate for release pipeline management (PyPI and Homebrew), the dbt-cloud-api crate for interacting with dbt Cloud API v3, and a custom tracing infrastructure for performance visualization via Jaeger and OTLP.

Tokens
161.2K
Snippets
451
Records
691
Agent score
72%

What's inside dbt-fusion

  1. Overview of dbt-csv

    main
    The dbt-csv crate is a CSV reader designed to be 100% conformant with dbt Core's CSV parsing behavior. While dbt Core uses Python's agate library to parse CSVs into Python-typed values, dbt-csv replicates this logic in Rust. It produces a stream of Arrow RecordBatch objects with types that match what dbt Core would produce, ensuring consistent behavior across the dbt ecosystem.
  2. Overview of dbt Core v2.0 (Alpha)

    main

    dbt Core v2.0 is a major rewrite powered by the Rust engine (previously known as Fusion). It aims to provide a single, unified foundation for the dbt framework.

    Key features include:

    • Performance: A fast Rust-based engine designed for scale.
    • Strict Specification: A codified language spec that eliminates silent configuration errors.
    • New Artifacts: Parquet metadata artifacts designed for speed and scale, powering a refreshed dbt-docs experience.
    • Unified Foundation: A single engine and adapter layer replacing the previous bifurcated model.
  3. What is MiniJinja-Embed

    main

    MiniJinja-Embed is a utility crate for the MiniJinja template engine. It provides two primary capabilities for developers:

    1. Template Embedding: It provides utility macros to embed templates directly into your compiled binary.
    2. Iterative Development Support: It supports using a loader during development, allowing you to iterate on templates without needing to recompile the binary every time a change is made.
  4. dbt Core 2022 Roadmap Overview

    main

    This document outlines the strategic development goals for dbt Core throughout 2022. The roadmap focuses on three primary pillars:

    1. New Constructs: Moving beyond SQL/Jinja-SQL constraints to make complex tasks easier and introduce new ways to interact with dbt.
    2. Modular Interfaces: Refactoring the codebase to decouple tasks, configurations, and CLI initialization, enabling better long-term development and third-party integrations.
    3. Stability and Compatibility: Maintaining the commitments of dbt Core as major-version-one software, specifically regarding backwards compatibility and ease of upgrades.

    Release Schedule

    New minor versions of dbt Core and its official adapters are released every three months:

    • April
    • July
    • August
    • January (following year)

    For each minor version, a migration guide is provided in the official documentation.

  5. Explore dbt Cloud API models

    main

    The dbt-cloud-api crate provides a comprehensive set of Rust models that map to the dbt Cloud API. These models cover various domains including:

    • Account & Users: AccountUser, AccountResponse, User, AccountScopedPatResponse.
    • Connections & Adapters: BigqueryConnection, SnowflakeConnection, PostgresConnection, DbtAdapter, AdapterMetadata.
    • Projects & Environments: Project, EnvironmentV3, RepositoryV3.
    • Security & Access: ServiceToken, ScimConfig, IpRestrictionRule, GroupPermission.
    • Jobs & Automation: JobDefinitionV2, JobTypeEnum.
    • Webhooks & Audit: WebhookResponseStatus, AuditLogBulkExportStatusResponse.

    Detailed documentation for each specific model is available in the docs/ directory of the crate.

  6. Use dbt-ci release-pipeline commands

    main

    The dbt-ci crate provides commands for managing the release pipeline of dbt-fusion. These commands are exposed via a cargo ci alias in the workspace configuration. They handle version bumping, PyPI packaging/publishing, and Homebrew formula rendering/publishing.

    # Commands are invoked via the cargo ci alias
    cargo ci <subcommand> [options]
  7. Understand the dbt Core roadmap and versioning strategy

    main

    dbt Core follows a release cycle of approximately one minor version per quarter. The roadmap includes planned features with varying confidence levels. Key historical and upcoming milestones include:

    • v1.1: Introduced testing frameworks for dbt-core and adapters.
    • v1.2: Added built-in support for grants and improvements to metrics.
    • v1.3: Introduces support for Python models and improvements to metrics for the dbt Semantic Layer. Also includes an upgrade to Jinja3.
    • v1.4: Focuses on technical interfaces, including a documented Python API/library and improved CLI.
    • v1.5+: Focuses on multi-project deployments and external orchestration.
  8. Use Docker containers for isolated testing

    main
    The dbt-test-containers directory provides Dockerfiles designed to run tests in isolated environments. These images are specifically used by tests such as test_dbt_compile, which utilizes dbt/Dockerfile to execute dbt commands within an isolated Python environment. This ensures that test execution does not interfere with the host system's dependencies.
  9. Use dbt-tui-progress for terminal progress bars

    main

    The dbt-tui-progress crate provides a thread-safe, type-safe terminal progress bar controller for TUI (Terminal User Interface) layers. It wraps indicatif to manage multiple progress bars and spinners using a generic, hashable ID type. This allows you to decouple the identity of a task from its display text.

    Key features include:

    • Generic ID type: Identify progress bars with any type that implements Hash + Eq.
    • Thread-safety: Uses scc::HashMap for concurrent access.
    • Background animations: A dedicated ticker thread handles animations.
    • Suspension support: Provides a mechanism to interleave log output with progress bars without corrupting the terminal display.
    use dbt_tui_progress::ProgressController;
    
    #[derive(Debug, Clone, Hash, Eq, PartialEq)]
    enum Phase {
        Render,
        Run,
    }
    
    let mut ctrl = ProgressController::<Phase>::new();
    ctrl.start_ticker();
    
    // Start a progress bar
    ctrl.start_bar(Phase::Render, 100, "Rendering");
    
    // Track in-progress items
    ctrl.add_bar_context(&Phase::Render, "model_a");
    ctrl.finish_bar_context(&Phase::Render, "model_a", Some("succeeded"));
    
    // Suspend for log output
    ctrl.with_suspended(|| {
        println!("Log message");
    });
    
    // Clean up
    ctrl.remove_bar(&Phase::Render);
  10. How Fusion's tracing infrastructure works

    main

    Fusion uses a custom tracing architecture built on top of the native tracing crate to overcome limitations like lack of thread-safe event storage and restricted access to structured data during filtering.

    The data flows through four main stages:

    1. Application Code: Uses standard tracing macros (e.g., instrument, create_info_span!).
    2. TelemetryDataLayer: A native tracing Layer that converts spans/events into structured records, generates unique IDs, and injects code location/context.
    3. Middleware Pipeline: Uses TelemetryMiddleware to transform, modify, or drop spans/logs. It has mutable access to metrics via DataProviderMut.
    4. Consumer Layers: Uses TelemetryConsumer to process data in a read-only fashion (e.g., writing to JSONL, Parquet, or exporting via OTLP).