Hooks are used to modify queries before they are submitted to Snowflake, and can be fired before the query is submitted (Pre-hooks) or after the query runs (Post-hooks).
Hooks are defined in Flows.
When a query arrives at Sundeck, it is sent through the flow. A flow contains one or more hooks. The query moves through the flow, moving past each hook. At each hook, the hook condition is evaluated. If the hook condition evaluation returns
true, the hook is executed.
This continues sequentially through all hooks until either all hooks/conditions are evaluated or a terminal hook is executed (such as reject).
Each hook inspects and manipulates the output of the previously evaluated hook.
Sundeck has two types of hooks: built-in system-defined hooks and custom hooks.
Built-in system-defined hooks are pre-defined operations that perform specific actions. These hooks are provided by Sundeck. Their properties, conditions, or configuration can be altered based on specific customer needs.
Custom hooks just like system-defined hooks can fire before the query is submitted or after the query runs.
Sundeck provides two ways to customize hook properties: Sundeck SaaS User interface and SQL.
To modify the properties, conditions, or configuration of existing hook in the flow use ALTER SUNDECK FLOW
- Navigate to Flows page.
- Chose the desired flow.
- Modify hook’s properties: enable/disable, modifiy condition, etc.
- Click ‘Save’ for changes to take effect.
Custom hooks allow you to extend the Sundeck platform to perform operations that are not available through the built-in system-defined hooks provided by Sundeck.
Custom hooks created with Sundeck DDL will be shown in the UI, however, there is currently no way to create/modify/drop custom hooks in Sundeck UI. Please refer to SQL below to make modificications to custom hooks.
To use custom hook in the Sundeck UI:
- Create custom hook with Sundeck DDL.
- Go to the desired flow page.
- Click on plus sign near text “Prior to Snowflake Submission” for custom Pre-hooks or “After Query Succeeds” for custom Post-hook.
- Find custom hook that was created in step #1 on the list of available hooks.
- Add it to the flow and customize based on your needs.
Sundeck provides predefined variables that can be used in hooks. See Hook Variables for more details.