This guide walks you through setting up a DBT project in conjunction with Dagster on a Windows machine. Follow the steps below to ensure a smooth setup and execution process.
- Python version less than 3.12 (e.g., 3.11.5)
- Windows operating system
- Command-line interface (PowerShell or VSCode Terminal)
-
Install
virtualenv:pip install virtualenv
-
Create a virtual environment:
virtualenv venv
-
Activate the virtual environment:
venv\Scripts\activate
-
Install the required dependencies: Make sure you have a
requirements.txtfile with the necessary packages listed. Then run:pip install -r requirements.txt
-
Initialize the DBT profiles folder: Open a command prompt or PowerShell and run:
mkdir %userprofile%\.dbt -
Create a DBT project: Run the following command to initialize a new DBT project:
dbt init dbtlearn
-
Configure the DBT settings: Navigate to the
dbtlearnfolder and configure theprofiles.ymlfile according to your database connection settings. -
Check the connection: To ensure that your DBT setup is correctly configured, run:
dbt debug
-
Run DBT models: To run all models, use:
dbt run
-
Full-refresh run: To perform a full-refresh, use:
dbt run --full-refresh
-
Navigate to the project directory:
cd dbt_dagster_project -
Set the environment variable: In PowerShell, set the environment variable required for Dagster to parse the DBT project on load:
$env:DAGSTER_DBT_PARSE_PROJECT_ON_LOAD = 1 -
Start Dagster: To start the Dagster development server, run:
dagster dev
This guide covered the following steps:
- Setting up a virtual environment for your Python project.
- Installing the necessary dependencies.
- Initializing and configuring a DBT project.
- Running DBT models and performing a full-refresh.
- Setting up Dagster to work with your DBT project and starting the Dagster development server.
By following these steps, you should be able to set up and run a DBT project integrated with Dagster on a Windows machine.