aza
is a fictional business model. This dbt project transforms raw
data from an app database into a customers and transactions model ready for analytics.
This dbt project has a split personality:
- Tutorial: The tutorial branch is a useful minimum viable dbt project to get new dbt users up and running with their first dbt project. It includes seed files with generated data so a user can run this project on their own warehouse.
- Demo: The demo branch is used to illustrate how we (Fishtown Analytics) would structure a dbt project. The project assumes that your raw data is already in your warehouse, so therefore the repo cannot be run as a standalone project. The demo is more complex than the tutorial as it is structured in a way that can be extended for larger projects.
To get up and running with this project:
-
Install dbt using these instructions.
-
Clone this repository. If you need extra help, see these instructions.
-
Change into the
jaffle_shop
directory from the command line:
$ cd jaffle_shop
-
Set up a profile called
jaffle_shop
to connect to a data warehouse by following these instructions. If you have access to a data warehouse, you can use those credentials – we recommend setting your target schema to be a new schema (dbt will create the schema for you, as long as you have the right priviliges). If you don't have access to an existing data warehouse, you can also setup a local postgres database and connect to it in your profile. -
Ensure your profile is setup correctly from the command line:
$ dbt debug
- Load the CSVs with the demo data set. This materializes the CSVs as tables in your target schema. Note that a typical dbt project does not require this step since dbt assumes your raw data is already in your warehouse.
$ dbt seed
- Run the models:
$ dbt run
NOTE: If this steps fails, it might be that you need to make small changes to the SQL in the models folder to adjust for the flavor of SQL of your target database. Definitely consider this if you are using a community-contributed adapter.
- Test the output of the models:
$ dbt test
- Generate documentation for the project:
$ dbt docs generate
- View the documentation for the project:
$ dbt docs serve
For more information on dbt:
- Read the introduction to dbt.
- Read the dbt viewpoint.
- Join the chat on Slack for live questions and support.