Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage


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.

Currently offered built-in system Pre-hooks and built-in system Post-hooks

Custom hooks just like system-defined hooks can fire before the query is submitted or after the query runs.

Defining hooks

Both Pre-hooks and Post-hooks are defined as part of the flow. See CREATE SUNDECK FLOW and ALTER SUNDECK FLOW.

Customizing built-in system hook properties

Sundeck provides two ways to customize hook properties: Sundeck SaaS User interface and SQL.

DDL for hooks

To modify the properties, conditions, or configuration of existing hook in the flow use ALTER SUNDECK FLOW

Sundeck UI

  1. Navigate to Flows page.
  2. Chose the desired flow.
  3. Modify hook’s properties: enable/disable, modifiy condition, etc.
  4. Click ‘Save’ for changes to take effect.

Creating custom hooks

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.

DDL for creating custom hooks

Sundeck UI

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:

  1. Create custom hook with Sundeck DDL.
  2. Go to the desired flow page.
  3. Click on plus sign near text “Prior to Snowflake Submission” for custom Pre-hooks or “After Query Succeeds” for custom Post-hook.
  4. Find custom hook that was created in step #1 on the list of available hooks.
  5. Add it to the flow and customize based on your needs.

Using pre-defined variables in hooks

Sundeck provides predefined variables that can be used in hooks. See Hook Variables for more details.