-- Analytical fact table: model_performance -- Tracks extraction model performance for Trino/Superset dashboards. -- Partitioned by dt and model_name on MinIO. -- Path: s3://stonks-lakehouse/warehouse/model_performance/dt={yyyy-mm-dd}/model_name={name}/part-*.parquet -- Requirements: 12.1, 12.2 CREATE TABLE IF NOT EXISTS lakehouse.stonks.model_performance ( document_id VARCHAR, ticker VARCHAR, model_name VARCHAR, prompt_version VARCHAR, schema_version VARCHAR, success BOOLEAN, attempt_count INTEGER, total_duration_ms INTEGER, first_attempt_duration_ms INTEGER, final_attempt_duration_ms INTEGER, confidence DOUBLE, validation_status VARCHAR, validation_error_count INTEGER, validation_warning_count INTEGER, retry_count INTEGER, input_token_estimate INTEGER, output_token_estimate INTEGER, company_count INTEGER, recorded_at TIMESTAMP(6) WITH TIME ZONE, dt DATE, model_version VARCHAR ) WITH ( format = 'PARQUET', partitioned_by = ARRAY['dt', 'model_version'], external_location = 's3a://stonks-lakehouse/warehouse/model_performance/' );