Skip to content

v0.3.1

Latest

Choose a tag to compare

@github-actions github-actions released this 29 Oct 12:23

NTP Energy Market WASM FDW v0.3.1

Binary: 328 KB | SHA256: 5dbad078536e0e202dc10a750790cbefde12b4a81b86fb07b6c61e4386ba1d1b

Tables

4 production-ready foreign tables for German energy market data:

  1. renewable_energy_timeseries - Solar and wind generation (9 endpoints, 10 columns)
  2. electricity_market_prices - Spot market, premiums, negative price indicators (4 endpoints, 5 columns)
  3. redispatch_events - Grid intervention events (1 endpoint, 9 columns)
  4. grid_status_timeseries - Minute-by-minute grid stability monitoring (1 endpoint, 3 columns)

Total: 15 API endpoints consolidated into 4 queryable tables


Quick Start

-- Create foreign server with OAuth2 credentials
CREATE SERVER ntp_server
  FOREIGN DATA WRAPPER wasm_wrapper
  OPTIONS (
    fdw_package_url 'https://github.com/powabase/supabase-fdw-ntp/releases/download/v0.3.1/supabase_fdw_ntp.wasm',
    fdw_package_name 'powabase:supabase-fdw-ntp',
    fdw_package_version 'v0.3.1',
    fdw_package_checksum '5dbad078536e0e202dc10a750790cbefde12b4a81b86fb07b6c61e4386ba1d1b',
    api_base_url 'https://ds.netztransparenz.de',
    oauth2_token_url 'https://identity.netztransparenz.de/users/connect/token',
    oauth2_client_id 'YOUR_CLIENT_ID',
    oauth2_client_secret 'YOUR_CLIENT_SECRET',
    oauth2_scope 'ntpStatistic.read_all_public'
  );

-- Create schema
CREATE SCHEMA ntp;

-- Example: Renewable Energy table
CREATE FOREIGN TABLE ntp.renewable_energy_timeseries (
  timestamp_utc TIMESTAMPTZ NOT NULL,
  product_type TEXT NOT NULL,
  data_category TEXT NOT NULL,
  interval_minutes SMALLINT,
  tso_50hertz_mw DOUBLE PRECISION,
  tso_amprion_mw DOUBLE PRECISION,
  tso_tennet_mw DOUBLE PRECISION,
  tso_transnetbw_mw DOUBLE PRECISION,
  total_germany_mw DOUBLE PRECISION GENERATED ALWAYS AS (
    COALESCE(tso_50hertz_mw, 0) + COALESCE(tso_amprion_mw, 0) +
    COALESCE(tso_tennet_mw, 0) + COALESCE(tso_transnetbw_mw, 0)
  ) STORED,
  has_missing_data BOOLEAN GENERATED ALWAYS AS (
    tso_50hertz_mw IS NULL OR tso_amprion_mw IS NULL OR
    tso_tennet_mw IS NULL OR tso_transnetbw_mw IS NULL
  ) STORED
)
SERVER ntp_server
OPTIONS (
  object 'renewable_energy_timeseries',
  product_type 'solar',
  data_category 'forecast'
);

-- Query example: Solar forecast for today
SELECT
  timestamp_utc,
  total_germany_mw,
  tso_50hertz_mw,
  tso_amprion_mw
FROM ntp.renewable_energy_timeseries
WHERE product_type = 'solar'
  AND data_category = 'forecast'
  AND timestamp_utc >= CURRENT_DATE
ORDER BY timestamp_utc
LIMIT 24;

📖 Full Setup: See QUICKSTART.md for complete installation instructions and all 4 table schemas.


Features

  • 15 API Endpoints consolidated into 4 tables
  • OAuth2 Authentication with token caching (1-hour lifetime)
  • German Locale Support (CSV parsing, DD.MM.YYYY dates, comma decimals)
  • Query Routing - WHERE clause filters determine API endpoint selection
  • 11 ETL Transformations for data normalization
  • JOIN Support - Full PostgreSQL JOIN capabilities validated
  • Security Hardened - 6 critical fixes (bounds checking, safe conversions, explicit errors)
  • 119 Unit Tests - Comprehensive test coverage

Documentation


Built with: Rust 1.70+, cargo-component 0.21.1, wasm32-unknown-unknown | Validated: Zero WASI CLI imports ✅

Full Changelog: v0.3.0...v0.3.1