Skip to content

Conversation

ammarchalifah-bolt
Copy link

@ammarchalifah-bolt ammarchalifah-bolt commented Jul 31, 2025

Resolves #10592

Managing execution order of hooks by passing a priority number.

Problem

Currently hook excution order is not configurable. The only order of execution applied is:

  • Execute hook based on element ordering within the same project
  • Execute hook of active project as the latest
  • Execute hooks of upstream packages in alphabetical order

This creates a massive limitation to expand dbt's capabilities by defining custom hooks or packages that rely on hook execution.

Solution

Implement a priority number for each hook node. This priority is used to order execution of hooks.
To ensure backwards compatibility, dbt would still accept the existing hook definition, but also supports a more verbose definition

on-run-start:
     - sql: "SELECT 1"
        priority: 20

Default priority is 50, default priority of active project is 100. Lower number means higher priority.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@ammarchalifah-bolt ammarchalifah-bolt requested a review from a team as a code owner July 31, 2025 13:17
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@github-actions github-actions bot added the community This PR is from a community member label Jul 31, 2025
Copy link

cla-bot bot commented Jul 31, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @ammarchalifah-bolt

@ammarchalifah-bolt
Copy link
Author

CLA signed

@ammarchalifah-bolt ammarchalifah-bolt marked this pull request as draft July 31, 2025 14:07
@cla-bot cla-bot bot added the cla:yes label Jul 31, 2025
Copy link
Contributor

Additional Artifact Review Required

Changes to artifact directory files requires at least 2 approvals from core team members.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:yes community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Disable on-run-start and on-run-end hooks from installed packages

1 participant