In this quickstart guide, you’ll learn how to create a codespace and be able to execute the
dbt build command from it in less than 5 minutes.
dbt Labs provides a GitHub Codespace template that you (and anyone else) can reuse to create a complete dbt environment with a working and runnable project. When you create the codespace, the dev container creates a fully functioning dbt environment, connects to a DuckDB database, and loads a year of data from our fictional Jaffle Shop café, which sells food and beverages in several US cities. The README for the Jaffle Shop template also provides instructions on how to do this, along with animated GIFs.
- To use the dbt command-line interface (CLI), it's important that you know some basics of the terminal. In particular, you should understand
pwdto navigate through the directory structure of your computer easily.
- You have a GitHub account.
- Create a GitHub repository
- Build your first models
- Test and document your project
- Schedule a job
- Learn more with dbt Courses
Create a codespace
Go to the
jaffle-shop-templaterepository after you log in to your GitHub account.
Click Use this template at the top of the page and choose Create new repository.
Click Create repository from template when you’re done setting the options for your new repository.
Click Code (at the top of the new repository’s page). Under the Codespaces tab, choose Create codespace on main. Depending on how you've configured your computer's settings, this either opens a new browser tab with the Codespace development environment with VSCode running in it or opens a new VSCode window with the codespace in it.
Wait for the codespace to finish building by waiting for theWait for postCreateCommand to complete
postCreateCommandcommand to complete; this can take several minutes:
When this command completes, you can start using the codespace development environment. The terminal the command ran in will close and you will get a prompt in a brand new terminal.
At the terminal's prompt, you can execute any dbt command you want. For example:
/workspaces/test (main) $ dbt build
For complete information, refer to the dbt command reference. Common commands are:
Generate a larger data set
If you'd like to work with a larger selection of Jaffle Shop data, you can generate an arbitrary number of years of fictitious data from within your codespace.
Install the Python package called jafgen. At the terminal's prompt, run:
/workspaces/test (main) $ python -m pip install jafgen
When installation is done, run:
/workspaces/test (main) $ jafgen --years NUMBER_OF_YEARS
NUMBER_OF_YEARSwith the number of years you want to simulate. This command builds the CSV files and stores them in the
jaffle-datafolder, and is automatically sourced based on the
sources.ymlfile and the dbt-duckdb adapter.
As you increase the number of years, it takes exponentially more time to generate the data because the Jaffle Shop stores grow in size and number. For a good balance of data size and time to build, dbt Labs suggests a maximum of 6 years.