LakehouseFlow: Dataset to Medallion Parquet, CDC & dbt Engine avatar

LakehouseFlow: Dataset to Medallion Parquet, CDC & dbt Engine

Pricing

Pay per usage

Go to Apify Store
LakehouseFlow: Dataset to Medallion Parquet, CDC & dbt Engine

LakehouseFlow: Dataset to Medallion Parquet, CDC & dbt Engine

Transform web pages, APIs, or Apify Datasets into Zstd Medallion Parquet (Bronze/Silver/Gold), stateful SCD Type 2 CDC, MinHash deduplication, Schema Drift & Null-Spike Firewall with Dead-Letter Queue, PII masking, incremental RAG chunks, and Snowflake, Databricks DLT, DuckDB & dbt models.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Sai Ashutosh Chellarapu

Sai Ashutosh Chellarapu

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

8 days ago

Last modified

Categories

Features

Limited permissions

Share

LakehouseFlow: Web, API & Dataset to Medallion Parquet, CDC & dbt Engine

Transform any Web URLs, XML Sitemaps, REST APIs, or upstream Apify Datasets into a production-grade Bronze / Silver / Gold Medallion Lakehouse in a single run—complete with Zstd Apache Parquet files, Stateful SCD Type 2 Change Data Capture (CDC), 64-Permutation MinHash Near-Duplicate Detection, Luhn-Validated PII Firewall, Schema Drift & Null-Spike Anomaly Firewall with Dead-Letter Queue (DLQ), Incremental RAG Semantic Chunks, and ready-to-run Snowflake, Databricks DLT, DuckDB, and dbt code.


Why Data & AI Engineers Use LakehouseFlow

Standard web scrapers and API connectors dump raw, unvalidated JSON that breaks downstream pipelines whenever a website changes its DOM or repeats identical records every day. LakehouseFlow acts as a serverless Medallion Data Engineering Engine on Apify:

Data Engineering ChallengeHow LakehouseFlow Solves It
Re-ingesting unchanged records wastes 90%+ warehouse & embedding costsStateful SHA-256 Change Data Capture (CDC) compares incoming records against persistent state in Apify Named Key-Value Store (INSERT, UPDATE, DELETE, UNCHANGED) and tracks exact _changed_columns.
Tracking historical price/attribute changesFull SCD Type 2 History Table (silver_scd2_history.parquet) with _version_num, _valid_from, _valid_to, and _is_current.
Different URLs with identical content pollute analytics & RAG64-Permutation Shingle MinHash estimates Jaccard similarity to flag near-duplicate records (_is_near_duplicate, _similarity_score).
Website DOM changes silently break downstream tablesSchema Drift & Null-Spike Firewall detects added/removed columns, breaking type drift (FLOAT64 $\rightarrow$ VARCHAR), and sudden null-rate spikes, routing invalid records to a Dead-Letter Queue (quarantine_dlq.parquet).
PII & API secrets leak into Silver/Gold storageHeuristic + Regex + Luhn Checksum PII Firewall masks EMAIL, PHONE, SSN, CREDIT_CARD, IPV4, and API_SECRET using deterministic salted SHA-256 tokens (pii_sha256:...) so SQL joins still work.
JSON is slow and expensive to querySerializes columnar Apache Parquet (ZSTD, SNAPPY, GZIP) via PyArrow + an embedded lakehouse.sqlite catalog and DuckDB zero-copy views.
Writing boilerplate warehouse & dbt codeAuto-generates Snowflake (COPY INTO + DYNAMIC TABLE), Databricks Delta Live Tables (cloudFiles Autoloader + dlt.apply_changes), DuckDB SQL, and a full dbt package (sources.yml, incremental stg_*.sql, SCD2 snp_*.sql, schema.yml).

Medallion Architecture & Generated Artifacts

Every run writes the following artifacts to the Default Key-Value Store (and pushes Silver/CDC records to the Default Dataset):

  1. Columnar Apache Parquet Files (ZSTD compressed by default)
    • bronze_raw.parquet — Lossless raw JSON payload, lineage metadata, and canonical SHA-256 hash.
    • silver_current.parquet — Latest active flattened, typed, and PII-sanitized entities.
    • silver_scd2_history.parquet — Full SCD Type 2 version history across runs (_valid_from, _valid_to, _is_current, _version_num).
    • silver_cdc_delta.parquet — Incremental stream containing only INSERT, UPDATE, and DELETE records.
    • gold_rag_chunks.parquet — Token-bounded semantic Markdown chunks generated exclusively for INSERT and UPDATE records (eliminating redundant vector re-embedding).
    • quarantine_dlq.parquet — Dead-Letter Queue records that violated required column or contract rules, annotated with _violation_reasons.
  2. Embedded Relational Catalog & Visual Dashboard
    • lakehouse.sqlite — Ready-to-query SQLite database containing all Medallion tables.
    • observability_report.html — Interactive dark-mode Data Engineering Observability Dashboard (viewable with 1 click in the Apify Console).
    • run_summary.json & schema_profile.json — Complete telemetry, column statistics, and drift report.
  3. Multi-Warehouse Production Code
    • snowflake_pipeline.sql — Parquet Stage, COPY INTO, SCD2 UPDATE/INSERT, and CREATE DYNAMIC TABLE.
    • databricks_dlt_pipeline.py — PySpark Delta Live Tables with cloudFiles Autoloader and dlt.apply_changes() SCD Type 2.
    • duckdb_analytics.sql — Zero-copy read_parquet() views and SCD2 time-travel queries.
    • dbt_sources.yml, dbt_stg_<table>.sql, dbt_snp_<table>.sql, dbt_schema.yml — Complete dbt Core models and data quality tests.

4 Ways to Use LakehouseFlow

Mode 1: Post-Process Any Apify Scraper (sourceMode = "dataset")

Connect LakehouseFlow as an Integration / Webhook on any Apify scraper (e.g., Website Content Crawler, E-Commerce Scraper, Google Maps Scraper, Job Scraper):

{
"sourceMode": "dataset",
"datasetId": "{{resource.defaultDatasetId}}",
"tableName": "competitor_products",
"primaryKey": ["url"],
"cdcMode": "scd2_history",
"detectDeletes": true,
"parquetCompression": "zstd",
"piiPolicy": "mask_sha256",
"requiredColumns": ["url", "title"]
}

Mode 2: Autonomous Web & Sitemap Crawler (sourceMode = "webUrls")

Crawl web pages or XML sitemaps directly to extract HTML tables, JSON-LD, OpenGraph metadata, tech-stack fingerprints, and incremental RAG chunks:

{
"sourceMode": "webUrls",
"urls": [
"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
"https://books.toscrape.com/catalogue/tipping-the-velvet_999/index.html"
],
"tableName": "web_knowledge_base",
"primaryKey": ["canonical_url"],
"enableRagChunking": true,
"ragChunkSizeTokens": 256
}

Mode 3: REST API / JSON Feed ELT Connector (sourceMode = "restApi")

Ingest any JSON REST endpoint into SCD Type 2 Parquet tables:

{
"sourceMode": "restApi",
"apiEndpoint": "https://dummyjson.com/products",
"apiRecordsPath": "products",
"tableName": "api_products",
"primaryKey": ["id"]
}

Mode 4: Zero-Config Inline JSON / 1-Click Demo (sourceMode = "rawRecords")

Click Start in the Apify Console with the default pre-filled input to test the entire Medallion pipeline in under 5 seconds at $0 cost.


Local Development & Zero-Cost Testing

# 1. Run the 10-test unit & integration suite
python3 -m pytest -v
# 2. Run the multi-run stateful CDC & SCD Type 2 simulation
python3 scripts/run_local_demo.py