Key Benefits
- Enforce code quality (SQLFluff, dbt™ project checks) on every pull request, not just on developer machines
- Lint only the files changed in the pull request, keeping runs fast
- Build and test only modified models and their downstream dependencies
- Run validation in a temporary schema to avoid impacting production
- Get immediate feedback on pull request status through Paradime integration
Prerequisites
- A pre-commit configuration (
.pre-commit-config.yaml) at the root of your dbt™ repository, for example with SQLFluff hooks - A dedicated CI environment exists in Settings > Environments, with its own warehouse connection using a target named
ci, and the schedule’s Environment is set to it - A CI pipeline in your Git provider triggers the Turbo CI schedule when a pull request opens. See the setup guide for GitHub, GitLab, Azure DevOps, or BitBucket.
Default Configuration
Schedule Settings
Command Settings
The template runs two commands in order:-
A Run pre-commit command that lints only the files changed in the pull request:
The
--from-ref/--to-refflags tell pre-commit to check only the files that differ between your base branch and the pull request commit, mirroring how pre-commit behaves locally on staged files. -
The standard Turbo CI dbt™ command that builds and tests only the modified models and their downstream dependencies:
By default, if the pre-commit command fails, the dbt™ command is skipped and the run is marked as failed. To still build and test models when linting fails, set
continue_on_error on the pre-commit command.Trigger Type
- Type: Scheduled Run (Cron)
- Cron Schedule:
OFF(This schedule will be triggered by a new pull request event, not a cron schedule)
For custom Trigger configurations, see Trigger Types documentation.
Notification Settings
- Email Alerts:
- Success: Confirms hooks passed and models built and tested successfully
- Failure: Alerts when a hook fails, models fail to build, or tests fail
- SLA Breach: Alerts if the run takes longer than 120 minutes
For custom notification configurations, see Notification Settings documentation.
Full Example
pre-commit configuration
Add a.pre-commit-config.yaml at the root of your dbt™ repository. This example combines SQLFluff linting with dbt-checkpoint model and script checks:
.pre-commit-config.yaml
--dialect to your warehouse (for example bigquery, snowflake, or redshift). The dbt-parse hook runs first so that checks needing target/manifest.json, like check-script-ref-and-source, have a fresh manifest to validate against.
This schedule is the enforcement point for these hooks, so no local setup is needed. Developers can also run the same checks on demand from the Code IDE terminal with
paradime pre-commit. See Paradime Setup and Configuration.Schedule configuration
The equivalent Schedules as Code definition for the Turbo CI schedule:paradime_schedules.yml
When to Customize
Tailor this template to your specific needs:- Choose your hooks in
.pre-commit-config.yaml: SQLFluff for SQL linting, Prettier for YAML and Markdown formatting, or any other pre-commit hook your team uses. - Run a single hook instead of the full suite by using
pre-commit run <hook-id> --from-ref origin/main --to-ref HEAD, or check the whole project withpre-commit run --all-files. - Adjust the base branch in
--from-refif your pull requests target a branch other thanmain. - Adjust Deferred Schedule to the production schedule you want Turbo CI to compare against for state changes.
- Modify command settings with the dbt™ commands to suit your testing requirements, such as running specific model selectors or additional tests.
- Add more notification destinations (Slack, MS Teams) to match your team’s workflows.
- Customize Temporary Schema Naming via the dbt™
generate_schema_name.sqlmacro to handle the temporary schema prefix.