Most companies have scheduled jobs. A job scheduler would kickstart at 2 AM irrespective of whether new data has arrived or not, and sometimes there is a human who verifies the output quality before it goes into production or sent over to clients. This article talks about a completely modernized architecture built on Kafka, Snowflake, Iceberg, dbt and Dagster that is event driven, real time and has in-built data quality checks thus avoiding the human in the loop element.
Three ideas do most of the work:
- A stream-based trigger: A Dagster sensor watches a Snowflake CDC stream continuously and triggers dbt pipeline only when new data arrives instead of triggering even if there is no new data.
- A split-gate quarantine. Every row is validated against business rules. Failures go to an audit table with the reasons attached, and the rest of the batch keeps moving.
- Open storage. We leverage Iceberg table format to store Bronze, Silver and Gold layer tables on S3 bucket, so that even engines like Spark or DuckDB can read them without a copy.
1. The Production Reality: Why Legacy Orchestration Breaks at Scale
Legacy schedulers such as Control-M, ActiveBatch, and SQL Server Integration Services (SSIS) are built based on ordered set of tasks ("run package X at 2:00 AM, then package Y") rather than declarative data assets ("keep table Z fresh and valid"). This model works fine as long as the volume is small. But as the volume keeps climbing, it struggles to scale up creating bottlenecks in the entire pipeline.
Consider two real-world enterprise patterns from my previous companies that illustrate why legacy orchestration fails, even when companies attempt a partial cloud migration.
Company A: The Inefficiency Problem (Oracle → SSIS → SQL Server → SSRS)
In a traditional enterprise architecture, Oracle serves as the transactional OLTP core while SQL Server acts as the analytical data warehouse:
- Thousands of SSIS packages run on SQL Server Agent schedules, copying data from Oracle into SQL Server.
- SSIS packages do the transformations and have complex business logic. So one heavy package can starve the server and block hundreds of other jobs that don't depend on it at all.
- The Problem: SSRS reports miss their morning scheduled deliveries occasionally, and at month-end the delays cascade. At a previous company, our on-call engineers spend two to three hours each morning looking into alerts and restarting packages. This caused other project deadlines to be pushed out and created resource constraints.
Pattern B: The Manual QA Problem (SFTP → SSIS → Manual QA → ADF → Snowflake)
Many teams adopt Snowflake and Azure Data Factory (ADF) but keep their old ingestion habits:
- Client files arrive over SFTP, and SSIS packages load them into a staging database.
- From staging to production, a QA team certifies and signs off on the data after running client specific scripts to identify issues. At one of my previous companies, that one step alone adds three to five business days for some of the high tier clients.
- After sign-off, another team's ADF pipeline copies the tables into Snowflake.
- The Problem: A cloud warehouse with the old process just moves the bottleneck to the cloud. Handoffs between teams fail, lack of a CI/CD process, no Git integration and onboarding one large client takes weeks.
The Alternative: An Event-Driven Lakehouse with Automated QA
Legacy ETL vs. the Event-Driven Lakehouse
Figure 1 shows what changes for a single client feed. The manual QA step does not disappear. It turns into a set of rules that runs on every row inside the pipeline, and only the rows that fail need a person.
2. Core Architectural Pillars of the Modern Stack
The design rests on four pillars:
-
Declarative assets in Dagster
-
a Stream-based trigger
-
Iceberg storage format.
-
dbt pipelines for transformations, incremental strategy and Kimball data modelling. Snowflake is the engine under all four. Figure 2 shows how the pieces connect.

Pillar 1: Shifting from Tasks to Assets with Dagster
Legacy orchestrators have an issue: they know whether a task succeeded or failed, but they have no awareness of the underlying data asset's lineage, health, or freshness.
Dagster resolves this through Software-Defined Assets (SDAs). Instead of wiring together fragile pipelines ("run script A, on success, run script B"), you declare the data asset that should exist (such as a transformed trade execution table) alongside the Python or dbt code required to materialize it. Dagster automatically constructs the end-to-end Directed Acyclic Graph (DAG) lineage across dbt models and data quality checks.
Pillar 2: Event-Driven Triggers Without Warehouse Polling
A common trend when pairing an orchestrator with a cloud data warehouse is configuring a sensor to poll a landing table every 30 seconds (SELECT COUNT(*) FROM raw_table WHERE ingested_at > ...). Each poll is a query, so the virtual warehouse never sits idle long enough to auto-suspend. You end up paying to compute around the clock just to learn whether data arrived (Figure 4, top row).
The easy alternative is to poll the Kafka consumer lag offsets. This would be set to 0 only when all the data is committed to the Snowflake landing table. But what if Dagster sensor watches a transformed table or view derived out of the kafka landing table that is created out of a scheduled task or job on Snowflake? So in that case, Kafka consumer lag would not work.
The fix: a metadata-only stream sensor. We attach an append-only Snowflake stream to the Bronze Kafka landing table, and a Dagster sensor checks the stream every 60 seconds [1][2]. The stream is set up on the table that dbt models would read and it shows only data that is not yet consumed, which means the warehouse starts only when there is new data to process. **
\ 
Pillar 3: Open Storage with Apache Iceberg
Standard Snowflake tables are easy to run, but the data sits in Snowflake's own format and storage, and every read needs Snowflake compute, including reads by data science and machine learning teams.
Storing the data as Apache Iceberg tables on an S3 external volume, cataloged by Snowflake Horizon, changes three things [4]:
-
Ingestion without a warehouse: The Snowflake Kafka connector writes events through Snowpipe Streaming straight into a Bronze Iceberg table on S3. No virtual warehouse runs during ingestion; Snowpipe Streaming is billed separately as serverless compute.
-
Storage you own: The files sit in our own S3 bucket and are billed by AWS. We set the lifecycle and retention policies ourselves, which matters for regulatory archival.
-
Multi-engine reads: BI dashboards query Gold layer tables through Snowflake, while data science and ML engineers read the raw Bronze layer Iceberg tables with Apache Spark, Ray, or DuckDB through Horizon Iceberg REST catalog. Nobody copies data, and those reads use no Snowflake compute.

Pillar 4: Modular Lineage & Idempotent Merges with dbt
dbt (data build tool) serves as our SQL logic transformation pipeline. By combining modular SQL templates, surrogate keys, and incremental merges, dbt compiles select statements into MERGE INTO transactions on our Iceberg tables, and builds the end to end lineage for every model along the way.
3. The 4-Tier Enterprise Blueprint: Bronze, Silver, Gold, and Platinum
A frequent source of confusion in modern data engineering is how Medallion Architecture (Bronze, Silver, Gold) aligns with Kimball Dimensional Modeling (Star Schemas) and dbt's folder structure.
In our architecture, Medallion tiers define data refinement and trust, while Kimball defines structural modeling in the Gold tier, topped by a zero-copy Platinum Semantic Tier:
| Medallion Tier | dbt Directory Path | Core Engineering Responsibility | Physical Materialization |
|---|---|---|---|
| 1. Bronze Layer | models/staging/*.yml (source definitions) | Land immutable Kafka events as Parquet files on S3; track new commits via append-only Snowflake Stream. | Apache Iceberg Tables on AWS S3 |
| 2. Silver Layer | models/staging/ & models/intermediate/ | Consume the Bronze stream, deduplicate Kafka retries, cast data types, generate surrogate keys and execute the Split-Gate Quarantine rules. | Views + Iceberg Quarantine Table |
| 3. Gold Layer | models/marts/core/ & models/marts/agg/ | Tier 1 (Atomic Star Schema): Validated dimension and fact tables Tier 2 (Pre-Aggregated Rollups): Aggregate tables for BI tools | Incremental Iceberg Tables on AWS S3 |
| 4. Platinum Layer | models/semantic/ | Lock in metric formulas, verified join paths, and business synonyms for BI tools and Text-to-SQL AI agents. | Snowflake Semantic Views |
The full project layout, one folder per tier, is in the companion dbt repository linked at the end.
**End-to-End Implementation: High-Velocity Equity Trading Pipeline
\ 
Let's walk through a reference implementation for a retail stock trading platform streaming equity order execution events (BUY and SELL fills) over Apache Kafka.
In equity markets, downstream liquidity dashboards require near-real-time updates. At the same time, clearinghouse settlement adjustments (T+1 or T+2 busted trade reversals) arrive up to 72 hours after execution, and upstream microservice bugs occasionally emit malformed events (such as negative execution prices or unverified trader IDs) that must be quarantined in real time without halting the pipeline.
The code below is trimmed to the parts that carry the design. Full models, the Dagster definitions, and a Kafka producer that injects five deliberately bad events are in the two companion repositories.
Step 1: Bronze Layer - Iceberg Tables and an Append-Only Stream
The Snowflake Kafka connector reads the trading.executions.v1 topic and writes each event into a landing Iceberg table through Snowpipe Streaming. The files sit in our S3 bucket (s3://trading-events-lakehouse/bronze/trade_events/), registered in Snowflake as an external volume. A small transform step types and flattens the landing rows into TRADE_EVENTS, the Bronze table everything downstream reads.
Next, we attach an append-only stream to TRADE_EVENTS. This is the object the Dagster sensor watches:
-- Append-only stream watched by the Dagster sensor CREATE OR REPLACE STREAM BRONZE.TRADING.TRADE_EVENTS_STREAM ON TABLE BRONZE.TRADING.TRADE_EVENTS APPEND_ONLY = TRUE; Step 2: Silver Layer - Deduplication, Surrogate Keys & The Split-Gate Quarantine
Silver does four jobs before any data reaches business users: it consumes the stream, removes duplicates, builds keys, and separates good rows from bad ones.
1. Consuming the Stream and Deduplicating (models/staging/)
Consume the stream (stg_trade_events_cdc.sql): This incremental model is the only thing that reads TRADE_EVENTS_STREAM. When dbt commits it, Snowflake advances the stream offset and SYSTEM$STREAM_HAS_DATA goes back to false. Without it, the sensor would fire every minute forever, because nothing would ever consume the stream.
{{ config( materialized='incremental', incremental_strategy='append', tags=['trading_pipeline'] ) }} -- Reading the stream inside a committed dbt run advances its offset, -- so SYSTEM$STREAM_HAS_DATA returns false after every successful build. select trade_id, trader_id, ticker_symbol, order_side, order_status, quantity, execution_price, commission_fee, executed_at, _kafka_partition, _kafka_offset, _kafka_ingested_at, current_timestamp()::timestamp_ntz(6) as _stream_consumed_at from BRONZE.TRADING.TRADE_EVENTS_STREAM where metadata$action = 'INSERT' Deduplicate (stg_trade_events.sql): Kafka delivers at least once, so a retry can produce the same event twice. We keep the latest record per trade_id by _kafka_offset. Offsets are only comparable within a partition, which is why the producer keys every message by trade_id: all versions of a trade land in the same partition.
{{ config( materialized='view', tags=['trading_pipeline'] ) }} with raw_events as ( select * from {{ ref('stg_trade_events_cdc') }} ), deduplicated as ( select * from raw_events -- Deduplicate Kafka at-least-once retries using the latest offset per trade_id qualify row_number() over ( partition by trade_id order by _kafka_offset desc, _kafka_ingested_at desc ) = 1 ) select * from deduplicated 2. Dimension Key & Hash Diff Calculation (models/intermediate/int_traders_hashed.sql)
Generate Surrogate Keys & Row Hash Diffs (int_traders_hashed.sql): We generate a deterministic primary key (trader_sk) from the natural key and a change-tracking hash (row_hash_diff) across all dimension attributes. Gold uses both: trader_sk as the merge key and row_hash_diff to spot traders whose attributes actually changed.
{{ config( materialized='view', tags=['trading_pipeline'] ) }} with raw_traders as ( select * from {{ ref('stg_traders') }} ), hashed as ( select -- 1. SURROGATE KEY: Deterministic MD5 hash of the natural business key {{ dbt_utils.generate_surrogate_key(['trader_id']) }} as trader_sk, trader_id as trader_natural_key, first_name, last_name, email, kyc_status, trader_tier, account_country, -- 2. ROW HASH DIFF: Tracks changes across mutable attributes for incremental merge {{ dbt_utils.generate_surrogate_key([ 'first_name', 'last_name', 'email', 'kyc_status', 'trader_tier', 'account_country' ]) }} as row_hash_diff, updated_at as source_updated_at from raw_traders ) select * from hashed 3. Data Validation (models/intermediate/int_trades_validated.sql)
Score every row (int_trades_validated.sql): A failing dbt test would stop the whole build over a single bad row. Instead, we check every trade against five rules and record which ones it broke. Failed rows go to the quarantine table for triage and alerting, and passing rows continue to Gold.
{{ config( materialized='view', tags=['trading_pipeline'] ) }} with raw_traders as ( select * from {{ ref('stg_traders') }} ), hashed as ( select -- 1. SURROGATE KEY: Deterministic MD5 hash of the natural business key {{ dbt_utils.generate_surrogate_key(['trader_id']) }} as trader_sk, trader_id as trader_natural_key, first_name, last_name, email, kyc_status, trader_tier, account_country, -- 2. ROW HASH DIFF: Tracks changes across mutable attributes for incremental merge {{ dbt_utils.generate_surrogate_key([ 'first_name', 'last_name', 'email', 'kyc_status', 'trader_tier', 'account_country' ]) }} as row_hash_diff, updated_at as source_updated_at from raw_traders ) select * from hashed Adding a rule is one more case line, which is what makes onboarding really fast. 

This does not replace dbt tests. Tests still belong on conditions that should stop the build, such as a missing source or a duplicate key in Gold. Row-level business rules belong in the gate, where one bad record costs one row instead of the whole run.
4. Quarantine Table (models/intermediate/quarantine_trade_events.sql)
Defective records (WHERE is_valid_trade = FALSE) land in an Iceberg quarantine table for triage, while clean records continue to Gold.
{{ config( materialized='incremental', unique_key='trade_id', table_format='iceberg', external_volume='ext_trading_s3', base_location_root='silver/quarantine', tags=['trading_pipeline'] ) }} select *, current_date() as quarantined_date, current_timestamp() as quarantined_at from {{ ref('int_trades_validated') }} where is_valid_trade = false {% if is_incremental() %} and _stream_consumed_at > (select coalesce(max(_kafka_ingested_at), '1900-01-01'::timestamp_ntz) from {{ this }}) {% endif %} Step 3: Gold Layer (Tier 1) - Kimball Star Schema on Apache Iceberg
In Gold Tier 1 (models/marts/core/), validated silver entities are shaped into a classic Kimball Star Schema materialized as Apache Iceberg tables.
1. Conformed Trader Dimension (models/marts/core/dim_traders.sql)
On incremental runs, the model looks the the hashkey and the row hashdiff to find rows which have changed and merges into the table. New rows are inserted as it comes.
{{ config( materialized='incremental', unique_key='trader_sk', table_format='iceberg', external_volume='ext_trading_s3', base_location_root='gold/core/dim_traders', tags=['trading_pipeline'] ) }} with incoming_traders as ( select * from {{ ref('int_traders_hashed') }} ) {% if is_incremental() %} , current_dimension as ( select trader_sk, row_hash_diff from {{ this }} ), delta_detection as ( select i.*, current_timestamp() as dbt_updated_at from incoming_traders i left join current_dimension c on i.trader_sk = c.trader_sk where -- Condition 1: Brand new trader account c.trader_sk is null -- Condition 2: Existing trader whose mutable attributes changed or i.row_hash_diff != c.row_hash_diff ) select * from delta_detection {% else %} select *, current_timestamp() as dbt_updated_at from incoming_traders {% endif %} 2. Validated Trade Executions Fact Table (models/marts/core/fct_trade_executions.sql)
The fact table filters strictly for is_valid_trade = true and computes settlement measures such as gross_notional_value. The excerpt below shows the parts that matter; the full model is in the repo:
with valid_trades as ( select * from {{ ref('int_trades_validated') }} where is_valid_trade = true {% if is_incremental() %} -- 3-day lookback to pick up T+1/T+2 settlement updates and executed_at >= (select dateadd('day', -3, coalesce(max(executed_at), '1900-01-01'::timestamp_ntz)) from {{ this }}) {% endif %} ) select {{ dbt_utils.generate_surrogate_key(['t.trade_id']) }} as trade_execution_sk, t.trade_id, coalesce(d.trader_sk, md5('-1')) as trader_sk, coalesce(d.trader_tier, 'UNCLASSIFIED') as trader_tier, t.ticker_symbol, t.order_side, cast(t.executed_at as date) as trade_date, -- remaining measures and the settlement flag are in the repo round(t.quantity * t.execution_price, 2) as gross_notional_value from valid_trades t left join {{ ref('dim_traders') }} d on t.trader_id = d.trader_natural_key 
Step 4: Gold Layer (Tier 2) - Pre-Aggregated Rollup
The atomic star schema serves analytics queries, but a BI dashboard should not scan every trade to draw one chart. In Gold Tier 2 (models/marts/agg/agg_daily_tier_liquidity.sql), we pre-aggregate trade metrics at the (trade_date, trader_tier, order_side) grain using a 3-day incremental lookback window to automatically recalculate totals when T+1 or T+2 clearinghouse settlement adjustments arrive:
with trades as ( select * from {{ ref('fct_trade_executions') }} {% if is_incremental() %} where trade_date >= (select dateadd('day', -3, coalesce(max(trade_date), '1900-01-01'::date)) from {{ this }}) {% endif %} ) select {{ dbt_utils.generate_surrogate_key(['trade_date', 'trader_tier', 'order_side']) }} as liquidity_metric_sk, trade_date, trader_tier, order_side, count(distinct trade_id) as total_trades_submitted, sum(case when is_verified_settled_trade then gross_notional_value else 0 end) as total_notional_volume from trades group by trade_date, trader_tier, order_side Step 5: Platinum Layer - Snowflake Semantic Views
As enterprises deploy Text-to-SQL AI agents alongside traditional BI tools, exposing raw fact and dimension tables directly to LLMs leads to inconsistent join paths and hallucinated metric formulas.
We solve this by introducing the Platinum Layer (models/semantic/sem_trading_liquidity.sql), a zero-copy governance layer using Snowflake Semantic Views. The Platinum layer binds fct_trade_executions and dim_traders together with canonical metric definitions and natural-language synonyms so BI tools and AI agents always compute the exact same numbers. A Cortex agent can then use the semantic view as one of its tools, so its answers are grounded in the same metric definitions, join paths, and synonyms that the dashboards use.
The open-source dbt_semantic_view package from Snowflake Labs adds a semantic_view materialization, Here is a trimmed version:
{{ config(materialized='semantic_view', copy_grants=true) }} TABLES ( traders AS {{ ref('dim_traders') }} PRIMARY KEY (trader_sk) WITH SYNONYMS = ('clients', 'investors', 'accounts'), trades AS {{ ref('fct_trade_executions') }} PRIMARY KEY (trade_execution_sk) WITH SYNONYMS = ('executions', 'orders', 'fills') ) RELATIONSHIPS ( trades_to_traders AS trades (trader_sk) REFERENCES traders (trader_sk) ) DIMENSIONS ( traders.trader_tier AS trader_tier WITH SYNONYMS = ('client segment', 'margin tier', 'investor tier') COMMENT = 'Customer segment of the executing trader.' -- plus account_country, order_side, ticker_symbol, trade_date ) METRICS ( trades.settled_notional_volume AS SUM(CASE WHEN trades.is_verified_settled_trade THEN trades.gross_notional_value ELSE 0 END) WITH SYNONYMS = ('total trading volume', 'gross liquidity', 'settled volume') COMMENT = 'Gross notional value of verified, settled trades.', trades.execution_fill_rate AS DIV0(COUNT_IF(trades.is_verified_settled_trade), COUNT(trades.trade_id)) WITH SYNONYMS = ('settlement rate', 'order fill percentage') COMMENT = 'Share of executed trades that reach verified-settled status.' -- plus average_trade_size and net_commission_revenue ) When someone asks the Cortex agent for "gross liquidity by client segment", the synonyms map the question to settled_notional_volume and trader_tier, and the relationship tells Snowflake how to join the two tables. The agent never has to guess a formula or a join path.
Step 6: Orchestrating the Pipeline with Dagster
Instead of a cron schedule, a Dagster sensor calls SYSTEM$STREAM_HAS_DATA every 60 seconds [5]. When committed rows are waiting in the stream, it launches trading_pipeline_job. It also skips a tick while a previous run is still going, so slow builds do not pile up.
@sensor(job=trading_pipeline_job, minimum_interval_seconds=60) def bronze_iceberg_stream_sensor(context: SensorEvaluationContext): # Don't stack runs: skip while the previous one is still going active = [ run for run in context.instance.get_runs(limit=5) if run.job_name == "trading_pipeline_job" and run.status in (DagsterRunStatus.QUEUED, DagsterRunStatus.STARTING, DagsterRunStatus.STARTED) ] if active: return SkipReason("Previous run still in progress") conn = get_snowflake_connection() try: with conn.cursor() as cur: # Answered from metadata, so no running warehouse is needed cur.execute("SELECT SYSTEM$STREAM_HAS_DATA('BRONZE.TRADING.TRADE_EVENTS_STREAM')") has_data = cur.fetchone()[0] finally: conn.close() if not has_data: return SkipReason("No committed rows waiting in the stream") return RunRequest(run_key=f"stream-{int(time.time())}") The job has two parts:
-
trading_dbt_assets: a @dbt_assets definition that runs dbt build on every model tagged trading_pipeline. Each dbt model appears as its own asset in Dagster, with lineage and run history.
-
check_trade_quarantine_threshold: after the fact table materializes, a non-blocking @asset_check calculates the batch data quality pass rate and alerts on-call engineers if the quarantine rate falls below 98% threshold.


5. Trade-offs and Limitations
This design has a few sharp edges worth knowing before you adopt it:
- Steady streams keep the warehouse awake. The stream check saves money when data arrives in bursts. Under a constant flow, the sensor fires every minute and the warehouse rarely suspends. If a few extra minutes of latency are acceptable, set a minimum interval between runs.
- Quarantine is not repair. After bad records are quarantined, some action needs to be taken and reported back to the events producer to know whether to discard or fix the records at the source.
- Some pieces are Snowflake-specific. Streams and semantic views have no direct equivalent on other engines. The storage is open; the trigger and the semantic layer would need to be rebuilt elsewhere.
- Open source infrastructure. Dbt core and Dagster are all available open source and can be hosted on our own servers. But self hosting has its own infrastructure management, version upgrades and other administrative overhead. The commercial offerings would solve these issues but with it comes the financial and budget constraints. A decision needs to be made weighing its pros and cons.
6. Conclusion
Replacing SSIS and Control-M is more than a tool swap. It changes what the pipeline reacts to and where quality gets enforced:
- Declarative Assets: An event driven DAG architecture and making the assets declarative means easier troubleshooting, restarting failures from where it failed instead of triggering the whole job, better visibility, observability and alerting.
- Open Storage format: Building the medallion architecture on Apache Iceberg keeps the data in your own bucket and lets Spark, DuckDB, and Ray read it using their own computer, thus giving more flexibility and better interoperability.
- Automated Quality Gates over Manual QA: Implementing the Split-Gate Quarantine pattern ensures that upstream bad records are isolated and alerted automatically. The pipeline keeps moving without being stalled due to bad records and gold layer can be ensured to have only validated and clean data.
If you want to try it, the companion repositories include a Kafka producer that publishes 500 valid trades plus the five bad ones from Figure 5.
Code
- dbt project:
https://github.com/rsandy94/trading-lakehouse-dbt - Kafka producer, connector config, and Dagster definitions:
https://github.com/rsandy94/trading-lakehouse
References
[1] Snowflake, Introduction to Streams, Snowflake Documentation,
[2] Snowflake, SYSTEM$STREAM_HAS_DATA, Snowflake Documentation,
[3] Snowflake, Understanding compute cost, Snowflake Documentation,
[4] Snowflake, Apache Iceberg tables, Snowflake Documentation,
[5] Dagster, Sensors, Dagster Documentation,
