Class: Timescaledb::Chunk

Inherits:
ApplicationRecord show all
Defined in:
lib/timescaledb/chunk.rb

Instance Method Summary collapse

Instance Method Details

#chunk_relationObject



27
28
29
# File 'lib/timescaledb/chunk.rb', line 27

def chunk_relation
  "('#{chunk_schema}.#{chunk_name}')::regclass"
end

#compress!Object



19
20
21
# File 'lib/timescaledb/chunk.rb', line 19

def compress!
  execute("SELECT compress_chunk(#{chunk_relation})")
end

#decompress!Object



23
24
25
# File 'lib/timescaledb/chunk.rb', line 23

def decompress!
  execute("SELECT decompress_chunk(#{chunk_relation})")
end

#execute(sql) ⇒ Object



31
32
33
# File 'lib/timescaledb/chunk.rb', line 31

def execute(sql)
  self.class.connection.execute(sql)
end