0
0
dbtdata~10 mins

PR review workflows for dbt changes - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - PR review workflows for dbt changes
Developer makes dbt changes
Create Pull Request (PR)
Automated CI runs dbt tests & builds
Tests pass
Reviewers check
Approve PR
Merge PR
Deploy changes
Monitor & validate
This flow shows how dbt changes go from development, through automated tests and reviews, to deployment.
Execution Sample
dbt
git checkout -b feature/dbt-model
# Make changes to models
git add .
git commit -m "Add new dbt model"
git push origin feature/dbt-model
# Create PR in GitHub
# CI runs: dbt run, dbt test
# Reviewers approve
# Merge PR
This code simulates the steps a developer takes to create a PR with dbt changes and how CI and reviews happen.
Execution Table
StepActionResultNext Step
1Developer creates feature branch and edits dbt modelsLocal changes readyPush branch to remote
2Push branch to remote repositoryBranch available on remoteCreate Pull Request (PR)
3Create PR in GitHubPR opened, triggers CICI runs dbt commands
4CI runs 'dbt run' and 'dbt test'Tests passReviewers notified
5Reviewers check code and testsApprove PRMerge PR
6Merge PR into main branchChanges mergedDeploy changes
7Deploy changes to productionNew dbt models liveMonitor and validate
8If tests fail at step 4CI fails, PR blockedDeveloper fixes errors and pushes updates
9If reviewers request changes at step 5PR not approvedDeveloper updates PR
10After fixes, repeat CI and reviewTests pass and approvedMerge PR
💡 Process ends when PR is merged and changes deployed successfully.
Variable Tracker
VariableStartAfter Step 2After Step 4After Step 5Final
branch_statuslocal changespushed to remoteunchangedunchangedmerged
ci_statusnot startedtriggeredtests pass/failtests passcompleted
pr_statusnot createdopenopenapprovedmerged
deployment_statusnot deployednot deployednot deployednot deployeddeployed
Key Moments - 3 Insights
Why does the PR not merge if CI tests fail?
Because the execution_table row 8 shows that if tests fail, the PR is blocked to prevent broken code from merging.
What happens if reviewers request changes after CI passes?
Row 9 explains that the PR is not approved and the developer must update the PR before merging.
Why do we need to push the branch before creating a PR?
Row 2 shows the branch must be on the remote repository so the PR can be created and CI triggered.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the status of the PR after step 3?
APR is merged
BPR is open and CI is triggered
CPR is closed
DPR is approved
💡 Hint
Check row 3 in the execution_table for PR status after creation.
At which step does the deployment happen according to the execution_table?
AStep 7
BStep 4
CStep 6
DStep 5
💡 Hint
Look for the step mentioning 'Deploy changes to production' in the execution_table.
If tests fail during CI, what is the next action?
AMerge PR anyway
BReviewers approve PR
CDeveloper fixes errors and pushes updates
DDeployment starts
💡 Hint
Refer to row 8 in the execution_table describing CI failure.
Concept Snapshot
PR Review Workflow for dbt Changes:
1. Developer creates feature branch and edits dbt models.
2. Push branch and create PR to trigger CI.
3. CI runs dbt commands (run, test).
4. Reviewers approve if tests pass.
5. Merge PR and deploy changes.
6. Fix errors if tests fail or reviewers request changes.
Full Transcript
This visual execution shows the typical PR review workflow for dbt changes. A developer first creates a feature branch and edits dbt models locally. Then they push the branch to the remote repository and create a Pull Request (PR). This PR triggers Continuous Integration (CI) which runs dbt commands like 'dbt run' and 'dbt test'. If the tests pass, reviewers check the code and approve the PR. Once approved, the PR is merged into the main branch and changes are deployed to production. If tests fail or reviewers request changes, the developer must fix the issues and update the PR. This cycle repeats until the PR passes all checks and is merged successfully. The variable tracker shows the state of branch, CI, PR, and deployment statuses at key steps. The key moments clarify common confusions about why PRs might be blocked or require updates. The quiz questions help reinforce understanding by referencing specific steps in the workflow.