Skip to main content
This tutorial demonstrates how to use data flows to build a multi-step extract, load, and transform (ELT) pipeline entirely within the database. You create staging tables, apply transformations across multiple steps, load results into a final table, and clean up temporary resources using a FINALLY clause. Data flows eliminate the need for external orchestration tools by allowing you to execute multiple SQL statements sequentially as a single unit. This approach simplifies pipeline logic, reduces round-trips between the application and database, and ensures cleanup always occurs, even when errors happen. For details about data flow syntax and supported statements, see Data Flows.

Prerequisites

Before you begin, ensure that you have:
  • A running Ocient deployment with access to execute SQL statements.
  • The CREATE TABLE and INSERT privileges on the target schema.

Prepare the Target Table

For the purposes of this tutorial, assume a source table named raw_orders with these columns. Create the target table that stores the final transformed results. This table holds aggregated order summaries by customer and region.
SQL

Build and Execute the ELT Pipeline

1

Build the Data Flow

Create a void data flow that stages raw data, applies transformations, and loads the results into the target table. The data flow performs these operations:
  1. Creates a temporary staging table #valid_orders to hold filtered records.
  2. Creates a temporary aggregation table #customer_agg to hold computed summaries.
  3. Filters out canceled orders and inserts valid records into the staging table.
  4. Computes aggregated metrics per customer and region.
  5. Loads the aggregated results into the final order_summary table.
SQL
Temporary tables use the # prefix and the database scopes them to the data flow block. The system drops them automatically when the data flow completes.
2

Verify the Results

Query the target table to verify that the data loaded correctly.
SQL
3

Add Error Handling

Optionally, you can wrap the transformation steps in the TRY and EXCEPTION WHEN element to catch and handle errors gracefully. This example logs the error for diagnostics, then re-raises it so the data flow still aborts on failure.
SQL
Data Flows Build Iterative Queries with Data Flows Validate Data Before Loading with Data Flows Data Definition Language (DDL) Statement Reference Data Manipulation Language (DML) Statement Reference
Last modified on September 10, 2026