Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions nix/tests/expected/timescale.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Create schema v
create schema v;
-- Create a table in the v schema
create table v.sensor_data (
time timestamptz not null,
sensor_id int not null,
temperature double precision not null,
humidity double precision not null
);
-- Convert the table to a hypertable
select create_hypertable('v.sensor_data', 'time');
create_hypertable
---------------------
(1,v,sensor_data,t)
(1 row)

-- Insert some data into the hypertable
insert into v.sensor_data (time, sensor_id, temperature, humidity)
values
('2024-08-09', 1, 22.5, 60.2),
('2024-08-08', 1, 23.0, 59.1),
('2024-08-07', 2, 21.7, 63.3);
-- Select data from the hypertable
select
*
from
v.sensor_data;
time | sensor_id | temperature | humidity
------------------------------+-----------+-------------+----------
Fri Aug 09 00:00:00 2024 PDT | 1 | 22.5 | 60.2
Thu Aug 08 00:00:00 2024 PDT | 1 | 23 | 59.1
Wed Aug 07 00:00:00 2024 PDT | 2 | 21.7 | 63.3
(3 rows)

-- Drop schema v and all its entities
drop schema v cascade;
NOTICE: drop cascades to 3 other objects
DETAIL: drop cascades to table v.sensor_data
drop cascades to table _timescaledb_internal._hyper_1_1_chunk
drop cascades to table _timescaledb_internal._hyper_1_2_chunk
30 changes: 30 additions & 0 deletions nix/tests/sql/timescale.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- Create schema v
create schema v;

-- Create a table in the v schema
create table v.sensor_data (
time timestamptz not null,
sensor_id int not null,
temperature double precision not null,
humidity double precision not null
);

-- Convert the table to a hypertable
select create_hypertable('v.sensor_data', 'time');

-- Insert some data into the hypertable
insert into v.sensor_data (time, sensor_id, temperature, humidity)
values
('2024-08-09', 1, 22.5, 60.2),
('2024-08-08', 1, 23.0, 59.1),
('2024-08-07', 2, 21.7, 63.3);

-- Select data from the hypertable
select
*
from
v.sensor_data;

-- Drop schema v and all its entities
drop schema v cascade;

Loading