Constructing the dbt project
Independent of Dagster, running most dbt commands creates a set of files in a new directory called target. The most important file is the manifest.json. More commonly referred to as “the manifest file,” this file is a complete representation of your dbt project in a predictable format.
When Dagster builds your code location, it reads the manifest file to discover the dbt models and turn them into Dagster assets. There are a variety of ways to build the manifest.json file. However, we recommend using the dbt parse CLI command.
Change your current working directory to the dagster_university/dagster_and_dbt/src/dagster_and_dbt/analytics folder and run the following command:
cd dagster_university/dagster_and_dbt/src/dagster_and_dbt/analytics # if you haven't set the directory yet
dbt parse
To confirm that a manifest file was generated, you should see two changes in your project:
- A new directory at
dagster_university/dagster_and_dbt/src/dagster_and_dbt/analytics/target, and - In the
targetdirectory, themanifest.jsonfile
💡 We recommend
dbt parsesince it doesn’t require a connection to your data warehouse to generate a manifest file, as opposed to commands likedbt compile. This means thatdbt parseis fast and consistent across any environments you run it in, such as locally or during deployment.If your dbt models use any introspective queries, you may need to run
dbt compileinstead.
In Lesson 4, we’ll explore some options for deploying the manifest file more programmatically, along with some tips and tricks on having it regularly build your dbt manifest file during development.