Data FlowData Flow
DataFlow
  • User Manual
  • Developer Manual
  • Examples
  • API Reference
Overview
Sources
Destinations
Transforms
Builds
ExamplesDestinationsTime SeriesTimescale Db

Timeseries Timescale Dest Overwrite Truncate Cascade

Overwrite with TRUNCATE ... CASCADE so a table holding a foreign key to the hypertable is emptied too.

Needs
timescaledb (2.16+ for foreign keys that reference a hypertable)
Prerequisite
run this spec once to create public.sensor_cascade, then create the referencing table:

CREATE UNIQUE INDEX IF NOT EXISTS sensor_cascade_well_ts ON public.sensor_cascade (well, ts); CREATE TABLE public.sensor_cascade_notes ( well TEXT, ts TIMESTAMPTZ, note TEXT, FOREIGN KEY (well, ts) REFERENCES public.sensor_cascade (well, ts)); INSERT INTO public.sensor_cascade_notes VALUES ('w1', '2026-04-28 10:00:00', 'calibrated'); Run again: public.sensor_cascade_notes is empty afterwards. With cascade_truncate: false the run fails with "cannot truncate a table referenced in a foreign key constraint".

Field reference for Timescale Db