Stock Lakehouse

Explore decades of daily US stock-market history through a modern lakehouse stack. Ask questions in plain English and watch a local AI model write live SQL.

Interactive demo with simulated data

1. Architecture 2. Data Pipeline 3. Text-to-SQL

Stack Architecture

Platform Mapping

Component Role
PostgresOperational source database
TrinoFederated SQL engine
MinIOS3-compatible object storage
Apache IcebergOpen table format with time travel
Iceberg REST CatalogTable versioning and governance
Ollama + Llama 3.2Local AI text-to-SQL layer
FastAPIWeb UI and API

Data Flow

Daily Prices (3.3M rows, 614 tickers)

|

v

Postgres (COPY from CSV)

|

Trino federates via CTAS

|

+--> Bronze (raw Parquet on MinIO)

+--> Silver (cleaned, partitioned by year, daily returns)

+--> Gold (annual returns, volatility, drawdowns, streaks)

|

Ollama writes SQL from questions, Trino executes, model summarizes

Medallion Data Pipeline

stock-lakehouse — pipeline

$ ./run.sh data/full_prices.csv data/full_tickers.csv

Press "Run Pipeline" to start...

AI Text-to-SQL

Type a question in plain English. The local Ollama model writes Trino SQL, the query runs live against Iceberg tables on MinIO, and the model summarizes the result.

How It Works

1. Question + schema prompt
2. Ollama writes SQL
3. Trino executes on Iceberg
4. Model summarizes result