Databricks Weather-to-Power — Architecture Cheatsheet

← Learning Hub Quick reference for architectural decisions, table schemas, and pipeline patterns.

Medallion Architecture

LayerDataPartitionKey Property
BronzeRaw GRIB2 → Parquet, SCADA telemetry, asset registryinit_timeImmutable, append-only
SilverWeather TS per asset, power TS per turbine, dim_assetsasset_id + ZORDER(timestamp)Dual access (pipeline + analyst)
GoldForecast per turbine + park, confidence intervals, accuracyasset_idDownstream contract

Core Table Schemas

silver.dim_assets

asset_id        STRING PK
asset_type      STRING (wind_park|turbine)
parent_asset_id STRING FK (NULL for parks)
latitude        DOUBLE
longitude       DOUBLE
hub_height_m    DOUBLE
capacity_kw     DOUBLE
metadata        MAP<STRING,STRING>

silver.weather_ts

asset_id          STRING PK (partition)
timestamp         TIMESTAMP PK
forecast_ref_time TIMESTAMP
wind_speed_ms     DOUBLE
wind_speed_hub_ms DOUBLE
wind_direction_deg DOUBLE
temperature_c     DOUBLE
irradiance_wm2    DOUBLE
pressure_hpa      DOUBLE
source_model      STRING

silver.power_ts

asset_id        STRING PK (partition)
timestamp       TIMESTAMP PK
power_kw        DOUBLE
rotor_speed_rpm DOUBLE
nacelle_temp_c  DOUBLE
availability    DOUBLE
status_code     STRING

gold.forecast_ts

asset_id          STRING (partition)
asset_type        STRING
timestamp         TIMESTAMP
forecast_power_kw DOUBLE
confidence_low_kw DOUBLE
confidence_high_kw DOUBLE
capacity_factor   DOUBLE
forecast_ref_time TIMESTAMP
model_version     STRING
produced_at       TIMESTAMP
source_model      STRING

Pipeline Flow

Weather API (ECMWF/GFS/ICON)
  → [Download GRIB2] → bronze.weather_raw (PARTITION BY init_time)
  → [Geo-join + derive] → silver.weather_ts (PARTITION BY asset_id, ZORDER timestamp)
  → [Compute features] → features.wind_power_features (PK: asset_id, timestamp)
  → [ML inference @champion] → gold.forecast_ts
  → [Serve] → Trading (JDBC) / Grid (Delta Sharing) / Dashboards (SQL Warehouse)

Key Formulas

VariableFormula
Wind speed$\sqrt{u^2 + v^2}$
Wind direction$\text{atan2}(-u, -v) \times \frac{180}{\pi} \mod 360$
Hub-height wind$v_{10} \times (h_{hub} / 10)^{\alpha}$   (α ≈ 0.14 open, 0.10 offshore)
Temperature$T_C = T_K - 273.15$
Irradiance (inst.)$(ssrd[t] - ssrd[t{-}1]) / \Delta t_{sec}$

Unity Catalog Structure

Metastore
├── prod          (machine-written only)
│   ├── bronze    → weather_raw
│   ├── silver    → weather_ts, power_ts, dim_assets
│   ├── gold      → forecast_ts, forecast_accuracy
│   └── features  → wind_power_features
├── dev           (engineers develop here)
│   ├── bronze / silver / gold (mirrors prod)
└── sandbox       (analysts + scientists explore)
    └── <user_schema>

Permissions Quick Reference

Principalproddevsandbox
Pipeline SPALL (bronze/silver/gold)——
Data engineersSELECT (all)ALLALL
Data scientistsSELECT (silver/gold)ALLALL
AnalystsSELECT (silver/gold)—ALL
Downstream systemsSELECT (gold only)——

Cluster Sizing

TaskTypeWorkersVM
GRIB ingestionJob cluster0 (single-node)Memory-opt (E4s)
Silver transformsJob cluster2–4General (D4s)
ML inferenceJob cluster1Memory-opt (E8s), ML runtime
Analyst queriesSQL WarehouseServerlessAuto (scales to zero)

Maintenance Schedule

TaskFrequencyCommand
OPTIMIZE + ZORDERWeeklyOPTIMIZE table ZORDER BY (timestamp)
VACUUMWeeklyVACUUM table RETAIN N DAYS
Bronze retentionMonthlyDrop partitions > 90 days
Model retrainingMonthly (or on drift)Retrain → validate → promote

Key Architectural Decisions

DecisionRecommendationLesson
DLT vs custom Spark for BronzeCustom (GRIB2 needs cfgrib)1
Asset hierarchy modelFlat table + parent pointer2
Partition strategy for TSBY asset_id, ZORDER timestamp2
Geo-join approachNearest-neighbour (snap to grid)4
Forecast versioningStore all, serve latest (view)4
Catalog structureEnvironment-based (prod/dev/sandbox)5
Global vs per-asset modelGlobal + asset features (start)7
Confidence intervalsQuantile regression (LightGBM)8
IaC toolingDatabricks Asset Bundles9

Rechtliches: Impressum