Skip to content

Commit

Permalink
Update example to include extend
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatas committed Oct 8, 2024
1 parent 202659d commit 5701427
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/toolkit-demo/lttb-zoom/lttb_zoomable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,21 @@ def download_weather_dataset size: :small

def setup size: :small
file = "weather_#{size}.tar.gz"
download_weather_dataset(size: size)# unless File.exists? file
download_weather_dataset(size: size) unless File.exists? file
puts "extracting #{file}"
system "tar -xvzf #{file} "
puts "creating data structures"
system "psql #{PG_URI} < weather.sql"
system %|psql #{PG_URI} -c "\\COPY locations FROM weather_#{size}_locations.csv CSV"|
system %|psql #{PG_URI} -c "\\COPY conditions FROM weather_#{size}_conditions.csv CSV"|
system %|psql #{PG_URI} -c "\\COPY locations FROM weather_#{size}_locations.csv CSV"|
end

ActiveRecord::Base.establish_connection(PG_URI)

class Condition < ActiveRecord::Base
extend Timescaledb::ActsAsHypertable
extend Timescaledb::ActsAsTimeVector

acts_as_hypertable time_column: "time"
acts_as_time_vector value_column: "temperature", segment_by: "device_id"
end
Expand Down

0 comments on commit 5701427

Please sign in to comment.