dbt_project.yml, Packages, and Grants
dbt Analytics Engineering · Lesson 5 of 17 · 35:47
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the dbt Analytics Engineering Certification exam. In this lesson: the project file and its main keys, folder configurations and the plus sign, variables, packages and package-lock.yml with dbt deps, and grants. Includes three original practice questions, with Orchardline Meal Kits, a fictional meal-kit company, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Two hundred models, configured by hand
Orchardline's project has grown to two hundred models, and each one repeats the same configuration lines. The team also wrote its own surrogate key logic, and the finance analysts still cannot query the marts they need. This lesson covers the project file, folder configurations, dbt packages, and the grants config.
The project file
Every dbt project has a file named dbt project dot yml at its root, and that file is how dbt recognizes a project. It sets the project name, the profile that holds the warehouse connection, and the paths where dbt finds models, seeds, macros, tests, and snapshots. It can also define project variables, which models read with the var function, and which you can override on the command line. And its models section sets configurations for many models at once, folder by folder. A configuration set there applies to every model below that folder, unless a more specific setting overrides it.
Folder configurations and the plus sign
Under the models key, the first level is the project name, and each next level is a folder. A plus sign in front of a key marks it as a configuration, like plus materialized or plus schema, so that dbt never mistakes it for a folder name. For a few configurations, like grants at the top level, the plus sign is even required for the project to parse. A subfolder's setting beats its parent's, and the root project's settings beat those of installed packages. So staging can be views, marts tables, and the finance marts incremental, with a few lines of YAML.
Packages
A package is a standalone dbt project, with models, macros, and tests, that you add to your own project like a library. You list packages in a packages file at the project root: from the dbt package hub with a required version or range, from a Git repository with a revision, or from a local folder. The dbt deps command installs them into the dbt packages folder, and pins each one in a package lock file, so that every run uses the same versions. Installing from the hub also lets dbt handle duplicate dependencies, like two packages that both need dbt utils. Then you call a package macro with the package name first, and your root project can override the package's configurations.
Grants
The grants config sets who can read what dbt builds, on models, seeds, and snapshots. For example, grants with select and a list of roles gives those roles the select privilege. After each build, dbt runs the grant and revoke statements needed, so that the privileges match the config exactly. When grants are set in several places, the most specific set of grantees replaces the less specific one, unless you put a plus sign before the privilege name, which adds grantees instead. And since grants are configs, the project file can set defaults for a whole folder.
Recap
Let's recap. The project file names the project and its profile, sets paths and variables, and configures models folder by folder. A plus sign marks a configuration, and the most specific folder wins. Packages are dbt projects that dbt deps installs, and pins in a lock file. Grants set privileges after each build, and the most specific set replaces the others. And a plus sign before a privilege adds grantees, instead of replacing them.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Models use the start date of the current pricing period in twenty places, typed as a literal date. Where should that date be defined, so that it changes in one place?
- A comment at the top of each of the twenty models
- A project variable, read with the var function
- A column added to every staging model
- A new profile in the profiles file
Show the answer
A project variable, read with the var function
A project variable, defined once in the project file and read with the var function, changes everywhere at once. “A comment at the top of each of the twenty models” would only document the twenty copies. “A column added to every staging model” is wrong, since a column repeated in every staging model is another copy, not one place. And “A new profile in the profiles file” is wrong, since a profile holds warehouse connections, not business values.
A colleague adds dbt_utils to packages.yml and pushes the change. On your machine, a model that calls a dbt_utils macro fails: macro not found. What did you forget?
- To run dbt deps, which installs the packages
- To copy the macro into the macros folder
- To add dbt_utils to the models section of the project file
- To run dbt seed before building the models
Show the answer
To run dbt deps, which installs the packages
Listing a package is not enough, since dbt deps must download it before any model can call its macros. “To copy the macro into the macros folder” would only duplicate the package's code by hand. “To add dbt_utils to the models section of the project file” is wrong, since the models section configures models, and installs nothing. And “To run dbt seed before building the models” is wrong, since dbt seed loads CSV files, not packages.
The project file grants select on every mart to bi_reader. The revenue model sets grants select for finance_reader, and after the next run, bi_reader can no longer read it. What keeps both roles?
- Set the same finance grants in the project file as well
- Run the grant statement by hand after every run
- Prefix the privilege with a plus sign: '+select'
- Remove the grants config from the project file
Show the answer
Prefix the privilege with a plus sign: '+select'
A plus sign before the privilege adds the finance role to the inherited list, instead of replacing it. “Set the same finance grants in the project file as well” is wrong, since the model's own setting would still replace the folder's list. “Run the grant statement by hand after every run” is wrong, since dbt revokes any privilege that is not in the config, on the next run. And “Remove the grants config from the project file” is wrong, since the BI role would then lose access to every mart.