Route
The ROUTE
Pre-hook can route a query to a different warehouse than the user initially intended. This allows workloads to be shifted between warehouses based on the nature of the workload or other properties.
{
'toWarehouse': <warehouse>
}
<toWarehouse>
- The name of the warehouse to be re-routed to.
- The user submitting the query must have access to the alternative warehouse. Sundeck will not escalate a user’s privlieges.
- Sundeck will execute a separate
USE WAREHOUSE
query before executing the actual submitted query. This ensures that the initially provided warehouse is not accidentally resumed when Sundeck users are trying to minimize uptime of a warehouse via the route hook. - The user session is rerouted to the alternative warehouse. This means subsequent queries will also be routed to this warehouse (excepting any additional operations).
- If several hooks manipulate the warehouse value, only the final value will be submitted to Snowflake (where it differs from the current warehouse).
CREATE SUNDECK FLOW DO_ROUTE
PRE HOOK ROUTE_TO_BATCH
ALWAYS
ROUTE {'toWarehouse': 'BATCH_WAREHOUSE'}
;