Team Ai
Datasetpublic

Chulinz/Text2SQL-Decisions

Text2SQL-Decisions v0.3 28,081 English-only examples across two separate configurations. Both are template-generated, execution-validated drafts, not human-reviewed benchmarks. No model has been fine-tuned as part of this release. Configuration Rows Task License default 25,000 Four-candidate SQL plan selection on public sensor and e-commerce data CC BY 4.0 meter 3,081 Bounded meter planning decisions, including conversational context CC0-1.0 The configurations… See the full description on the dataset page: https://huggingface.co/datasets/Chulinz/Text2SQL-Decisions.

sourceHugging Facecc-by-4.0updated 23h agoView on Hugging Face
0likes27downloads
data.sql37 linesDownload Raw Back to meter_fixture
1CREATE SCHEMA IF NOT EXISTS metering;2REVOKE ALL ON SCHEMA metering FROM PUBLIC;3CREATE TABLE IF NOT EXISTS metering.fixture_manifest (4  singleton boolean PRIMARY KEY DEFAULT true CHECK(singleton), fingerprint text NOT NULL,5  as_of timestamptz NOT NULL, provenance jsonb NOT NULL6);7CREATE TABLE IF NOT EXISTS metering.meters (8  id text PRIMARY KEY, name text NOT NULL, resource text NOT NULL, unit text NOT NULL,9  building text NOT NULL, floor integer NOT NULL, expected_interval_minutes integer NOT NULL CHECK(expected_interval_minutes > 0)10);11CREATE TABLE IF NOT EXISTS metering.readings (12  meter_id text NOT NULL REFERENCES metering.meters(id), recorded_at timestamptz NOT NULL,13  cumulative_value double precision NOT NULL CHECK(cumulative_value >= 0 AND cumulative_value < 'Infinity'::float8),14  quality text NOT NULL CHECK(quality IN ('valid','invalid')), reset boolean NOT NULL,15  PRIMARY KEY(meter_id, recorded_at)16);17CREATE OR REPLACE VIEW metering.interval_usage AS18WITH lagged AS (19  SELECT r.*, lag(recorded_at) OVER w AS interval_start,20    lag(cumulative_value) OVER w AS previous_value, lag(quality) OVER w AS previous_quality21  FROM metering.readings r WINDOW w AS(PARTITION BY meter_id ORDER BY recorded_at)22), checked AS (23  SELECT l.*, CASE24    WHEN interval_start IS NULL THEN 'no_previous_reading'25    WHEN quality <> 'valid' OR previous_quality <> 'valid' THEN 'invalid_reading'26    WHEN reset THEN 'meter_reset'27    WHEN cumulative_value < previous_value THEN 'negative_delta'28    WHEN recorded_at - interval_start > make_interval(mins => m.expected_interval_minutes) THEN 'missing_readings'29  END AS warning_reason30  FROM lagged l JOIN metering.meters m ON m.id = l.meter_id31)32SELECT meter_id, interval_start, recorded_at AS interval_end,33  CASE WHEN warning_reason IS NULL THEN cumulative_value - previous_value END AS usage, warning_reason34FROM checked;35GRANT USAGE ON SCHEMA metering TO analyst;36GRANT SELECT ON ALL TABLES IN SCHEMA metering TO analyst;37