SQL Task
Task Components in Ascend let you execute arbitrary SQL code as a Component. Unlike Transforms, SQL Tasks aren't directly tied to the Data Plane, giving you more flexibility.
Structuring Your SQL Component
In SQL Task Components, the config
function defines the task type and its dependencies. This function specifies the input data and any Components that your task relies on.
Example
Here's a SQL Task Component example:
This example identifies routes with active closures today:
-
Config function: Defines the task type and dependencies. The task depends on the
route_closures
Component for its data source. -
Common table expression (CTE): The
WITH
clause creates a temporary result setclosures_today
that filters theroute_closures
data for routes where closures are active on the current date. -
Final selection: The query selects
route_id
from the filtered data, which can be used for warnings or further processing.
Next Steps
- Learn more about Tasks in our Concept Guide
- Explore Task options in our Reference Guide