Prerequisites and Requirements
Relevant source files
The following files were used as context for generating this wiki page:
This document outlines the software dependencies, environment configurations, and project structures required to deploy and operate the meltano-dbt-ext utility extension. The extension serves as a wrapper for dbt (data build tool) within the Meltano ecosystem, necessitating specific Python environments and environment variables to function correctly.
Sources: pyproject.toml:1-10, dbt_ext/extension.py:34-45
Software Dependencies
The extension is built using the Meltano Extension Developer Kit (EDK) and requires a modern Python environment.
Core Requirements
- Python: Version 3.10 or higher is required.
- Meltano EDK: The extension depends on
meltano.edk(versions 0.5 to <0.7). - CLI Framework: Uses
typer(approximately version 0.26.0) for the command-line interface. - Configuration:
PyYAML(version 6.0.0 or higher) for parsing dbt project and profile files.
Sources: pyproject.toml:10-17
Development Requirements
For contributors or those running the test suite, the following packages are required:
pytest >= 9ruff >= 0.15pre-commit >= 3
Sources: pyproject.toml:23-27
Environment Configuration
The extension's behavior is primarily driven by environment variables. These variables control how the extension locates dbt files and which database adapter it uses.
Mandatory Environment Variables
The dbt extension class will raise a MissingProfileTypeError if the primary configuration variable is not found during initialization.
| Variable | Description | Default / Requirement |
|---|---|---|
DBT_EXT_TYPE | Defines the dbt adapter/profile type (e.g., postgres, snowflake, bigquery). | Mandatory |
DBT_PROJECT_DIR | The filesystem path to the dbt project. | transform |
DBT_PROFILES_DIR | The filesystem path to the dbt profiles.yml file. | $DBT_PROJECT_DIR/profiles |
Sources: dbt_ext/extension.py:38-51, README.md:16-25
Optional Execution Settings
DBT_EXT_SKIP_PRE_INVOKE: A boolean flag (defaulting tofalse). When set totrue, the extension skips the automatic execution ofdbt cleananddbt depsbefore running other commands.
Sources: dbt_ext/extension.py:53-56, README.md:18-22
Architecture and Initialization Flow
The extension relies on a specific sequence to prepare the environment. When meltano invoke dbt-postgres:initialize is called, the extension bundles internal dbt templates into the project directory.
The initialization process ensures the filesystem is prepared with standard dbt configurations before execution.
Sources: dbt_ext/extension.py:118-155
Database-Specific Requirements
Each supported dbt adapter requires specific environment variables to be mapped via profiles.yml. The extension provides templates for various backends.
PostgreSQL Example
For a postgres type, the following variables must be available in the environment to satisfy the template:
DBT_POSTGRES_HOSTDBT_POSTGRES_USERDBT_POSTGRES_PASSWORDDBT_POSTGRES_PORTDBT_POSTGRES_DBNAMEDBT_POSTGRES_SCHEMA
Sources: dbt_ext/dbt_files/profiles/postgres/profiles.yml:6-14
Project Structure Prerequisites
The extension expects a standard dbt project layout, typically located within a transform directory. The bundled dbt_project.yml sets the following expectations for the project structure:
| dbt Component | Default Path |
|---|---|
| Models | models |
| Tests | tests |
| Seeds | data |
| Macros | macros |
| Snapshots | snapshots |
| Packages | dbt_packages |
Sources: dbt_ext/dbt_files/bundle/transform/dbt_project.yml:10-23
Execution Requirements
When a command is invoked, the extension performs a pre-invoke check unless explicitly skipped.
The execution flow demonstrates the automated dependency management (dbt deps) and workspace cleanup (dbt clean) that occurs before the primary command.
Sources: dbt_ext/extension.py:58-95, tests/test_dbt_ext.py:28-44
Summary
To use meltano-dbt-ext, the system must have Python 3.10+ installed and the environment must provide DBT_EXT_TYPE to select the appropriate database profile. Users must run the initialize command to deploy the necessary dbt project files and profile templates. Once initialized, the extension manages dbt dependencies and execution by wrapping the standard dbt CLI and providing passthrough capabilities via dbt_invoker.
Sources: pyproject.toml:9-10, README.md:209-214, dbt_ext/pass_through.py:12-19