Streaming ingestion Delta lakehouse Advanced RAG Data quality & lineage

Product data that answers questions, seconds after it changes.

Change events stream in through Kafka, land in a schema-enforced Delta lakehouse, pass a quality and governance gate, and become a searchable index that answers questions about live inventory.

Lakehouse3 layers + quarantine
Retrieval3 stages exact · vector · rerank
Embeddings384-dim MiniLM-L6
Enginedelta-rs no Spark cluster
The pipeline

From a price change to an answer

01
Kafka stream
topic
product-updates
0
02
Schema gate
jsonschema
+ pyarrow
0
03
Bronze
raw CDC
append
0
04
Silver
MERGE
deduped
0
05
Gold
curated
upsert
0
06
Vector index
chunk
+ embed
0
07
Product Q&A
hybrid
retrieval
0

Quarantine table

raw_payload · error · quarantined_at A malformed event never breaks the run.
0

Event log

Simulated event flow — the stages, the branch and the failure behaviour are the real pipeline's.

Medallion architecture

Watch one record earn its way to gold

The same event, at three points in the pipeline. Nothing is thrown away — each layer adds what the next one needs and removes what it no longer should carry.

Raw landing

added here masked carried forward

A single similarity search answers the easy questions and quietly fails the important ones.

Retrieval

Three stages, in order of confidence

Pick a question and watch it move through the cascade. An exact product code never reaches the model at all — and the reranker does not just rescore the shortlist, it reorders it.

QUERY
01 EXACT

Primary key lookup

source_id == query → score 1.0
02 SEMANTIC

Vector search

all-MiniLM-L6-v2 · cosine · top_k=12
03 RERANK

Cross-encoder

ms-marco-MiniLM-L-6-v2 · top_k=3

Quality & governance

A pipeline is defined by what it refuses

Validation, PII protection and lineage run as first-class stages, ahead of the write — not as reports somebody reads the morning after.

Great Expectations suite

  • product_id  values_to_not_be_null
  • name  values_to_not_be_null
  • price  values_to_be_between(min=0)
  • stock_quantity  values_to_be_between(min=0)
  • record checks  required fields · positive price · non-empty name

PII masked at the boundary

Incoming review textContact me at sara.ali@example.com or 0551234567 about this order.
Written to bronzeContact me at [EMAIL] or [PHONE] about this order.

Redacted once, before storage, logs and the search index — instead of filtered again in every consumer that touches the data.

 openlineage · namespace: ecommerce
emit_lineage("bronze_write", job_name="ingest_bronze")
emit_lineage("silver_write", job_name="clean_silver")
emit_lineage("gold_write",   job_name="curate_gold")

[OpenLineage] emitted RunEvent  job=ingest_bronze  state=COMPLETE
[OpenLineage] emitted RunEvent  job=clean_silver   state=COMPLETE
[OpenLineage] emitted RunEvent  job=curate_gold    state=COMPLETE

Every hop emits a real RunEvent to a Marquez-compatible backend, and falls back to a console log when none is reachable — observability that never becomes the reason a run fails.

Orchestration

Built for a scheduler, not for a demo

The quality gate sits ahead of the lakehouse write, so a failed batch stops before it can reach silver and gold.

ingest_productsKAFKA → RAW BATCH
quality_gateGE SUITE · BLOCKS ON FAIL
run_lakehouseBRONZE → SILVER → GOLD
update_vector_indexCHUNK · EMBED · UPSERT

dag_id: ecommerce_pipeline  ·  schedule: hourly  ·  catchup: false

Continuous integrationGitHub Actions running pytest on Python 3.10
TestsGovernance, quality gates and retrieval covered by unit tests
Local stackdocker compose: Kafka, Zookeeper, PostgreSQL
ReproduciblePinned dependencies, one-command demo, MIT licensed
Stack

What it is built with

Streaming
Apache Kafka · Zookeeper · kafka-python
Validation
JSON Schema · PyArrow schema enforcement
Storage
Delta Lake via delta-rs · Parquet
Processing
pandas · PyArrow
Retrieval
sentence-transformers · cross-encoder reranking
Quality
Great Expectations · custom record checks
Lineage
OpenLineage · Marquez-compatible
Orchestration
Apache Airflow · GitHub Actions