This repository contains the necessary files and configurations for working with dbt (Data Build Tool) projects using Polars, dbt-core, and DuckDB. The following instructions will guide you on how to set up and use this repository locally using uv as the package manager.
Before starting, make sure the following are installed on your machine. Instructions differ slightly between macOS and Windows — follow the section that matches your OS.
- Python 3.10, 3.11, or 3.12 (DuckDB 0.10.2 doesn't ship wheels for 3.13 yet —
uv syncwill enforce this). If you already have a newer Python, don't worry:uvcan install a compatible one automatically. - Git (for cloning the repository)
- A code editor — we recommend VSCode
uvpackage manager
-
Open Terminal (⌘ + Space → type
Terminal). -
Install Homebrew (if you don't have it) — a package manager for macOS:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install Python and Git:
brew install python git
-
Install
uv:curl -LsSf https://astral.sh/uv/install.sh | shRestart your terminal, then verify:
uv --version
We strongly recommend using PowerShell (not Command Prompt) for the commands below. Search for "PowerShell" in the Start menu and open it.
-
Install Python:
- Download from python.org/downloads.
- During installation, check the box "Add Python to PATH". This is critical.
-
Install Git:
- Download from git-scm.com/download/win.
- Accept the default options during installation.
-
Install
uv(in PowerShell):powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Close and reopen PowerShell, then verify:
uv --version
The commands below are identical on Mac and Windows unless otherwise noted. Where commands differ, both versions are shown.
To work on this project and save your changes, you need your own copy of the repository.
-
Fork: go to
https://github.com/dgarhdez/dbt-ieand click Fork (top-right). This creates a copy under your GitHub account:https://github.com/YOUR_USERNAME/dbt-ie. -
Clone your fork locally (replace
YOUR_USERNAME):git clone https://github.com/YOUR_USERNAME/dbt-ie.git cd dbt-ie
Don't clone
dgarhdez/dbt-iedirectly — you won't be able to push your work to it.
All project dependencies are declared in pyproject.toml. A single command sets everything up:
uv syncThis will:
- Create a virtual environment at
.venv/in the project folder. - Resolve every dependency (including transitive ones) from
pyproject.toml. - Write a
uv.lockfile pinning the exact versions — so everyone in the class gets the same environment. - Install everything into
.venv/.
Among the packages installed:
- dbt-core and dbt-duckdb — the dbt library and the DuckDB adapter.
- DuckDB — an in-process SQL OLAP database for analytics.
- Polars — a fast DataFrame library, used for dbt Python models.
- sqlfluff — SQL linter.
If you ever need to add or remove a package later, use
uv add <package>oruv remove <package>. Don't install things with plainpip— it won't updatepyproject.toml.
The activation command differs by OS:
macOS / Linux (Terminal):
source .venv/bin/activateWindows (PowerShell):
.\.venv\Scripts\Activate.ps1Windows note: If you see an error about execution policies, run this once in PowerShell and try again:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Windows (Command Prompt, if you must):
.venv\Scripts\activate.batOnce activated, you should see (dbt-ie) at the beginning of your terminal prompt.
Tip: If you'd rather not activate every time, prefix any command with
uv runand it will execute inside the project's environment automatically — e.g.uv run dbt debug,uv run python create_db.py.
The repo ships with a profiles.yml at the project root — dbt picks it up automatically when you run commands from the project directory (no DBT_PROFILES_DIR needed). It looks like this:
default:
target: dev
outputs:
dev:
type: duckdb
path: my_database.duckdb
schema: mainNote: If you have a global
~/.dbt/profiles.yml, the project'sprofiles.ymltakes precedence as long as you rundbtfrom inside the project folder. Rundbt debugto confirm: it should printUsing profiles.yml file at .../dbt-ie/profiles.yml.
The data folder contains sample Parquet files and a Python script to create and populate the DuckDB database.
Run the script to create the database:
python create_db.pyThis will create my_database.duckdb in the project root and load the data from the Parquet files into tables.
You can now use dbt commands to build and test your project. For example:
dbt run
dbt test
dbt debug # To check connectionTo enhance your dbt development experience, consider installing the VSCode dbt Power User extension. This extension provides features like syntax highlighting, autocompletion, and snippets for dbt projects.
command not found: uv— Restart your terminal after installinguv, or add~/.local/binto yourPATH.xcrun: error: invalid active developer path— Install Xcode command line tools:xcode-select --install.- Permission denied when activating venv — Make sure you ran
uv syncinside the project folder and are usingsource .venv/bin/activate(not just running the script).
uv/python/gitis not recognized — The installer didn't add it toPATH. Reinstall Python making sure to check "Add Python to PATH", then restart PowerShell.cannot be loaded because running scripts is disabled on this system— RunSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserin PowerShell, confirm withY, then retry.- Long path errors when cloning — Enable long paths in Git:
git config --global core.longpaths true. - Commands from the class slides don't work — The slides use macOS/Linux syntax. Replace
source venv/bin/activatewith.\venv\Scripts\Activate.ps1, andpythonwithpyif needed.
- Always ensure your virtual environment is activated before running any commands — you should see
(dbt-ie)at the start of your prompt. (Or skip activation entirely and prefix commands withuv run.) - Dependencies live in
pyproject.toml; the resolved lockfile isuv.lock. Useuv add/uv removeto change them — don't edit either file by hand unless you know what you're doing. - If you encounter issues with
uv, refer to its documentation or runuv --help. - Windows users: consider installing Windows Terminal from the Microsoft Store for a nicer PowerShell experience.
Feel free to submit issues or pull requests to improve this repository.
This project is licensed under the MIT License.