timescaledb 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/Gemfile.scenic.lock +2 -2
- data/README.md +23 -16
- data/bin/console +2 -2
- data/bin/tsdb +6 -6
- data/examples/{Gemfile → all_in_one/Gemfile} +0 -0
- data/examples/{Gemfile.lock → all_in_one/Gemfile.lock} +0 -0
- data/examples/{all_in_one.rb → all_in_one/all_in_one.rb} +0 -0
- data/examples/ranking/.gitattributes +7 -0
- data/examples/ranking/.gitignore +29 -0
- data/examples/ranking/.ruby-version +1 -0
- data/examples/ranking/Gemfile +33 -0
- data/examples/ranking/Gemfile.lock +189 -0
- data/examples/ranking/README.md +166 -0
- data/examples/ranking/Rakefile +6 -0
- data/examples/ranking/app/controllers/application_controller.rb +2 -0
- data/examples/ranking/app/controllers/concerns/.keep +0 -0
- data/examples/ranking/app/jobs/application_job.rb +7 -0
- data/examples/ranking/app/models/application_record.rb +3 -0
- data/examples/ranking/app/models/concerns/.keep +0 -0
- data/examples/ranking/app/models/game.rb +2 -0
- data/examples/ranking/app/models/play.rb +7 -0
- data/examples/ranking/bin/bundle +114 -0
- data/examples/ranking/bin/rails +4 -0
- data/examples/ranking/bin/rake +4 -0
- data/examples/ranking/bin/setup +33 -0
- data/examples/ranking/config/application.rb +39 -0
- data/examples/ranking/config/boot.rb +4 -0
- data/examples/ranking/config/credentials.yml.enc +1 -0
- data/examples/ranking/config/database.yml +86 -0
- data/examples/ranking/config/environment.rb +5 -0
- data/examples/ranking/config/environments/development.rb +60 -0
- data/examples/ranking/config/environments/production.rb +75 -0
- data/examples/ranking/config/environments/test.rb +53 -0
- data/examples/ranking/config/initializers/cors.rb +16 -0
- data/examples/ranking/config/initializers/filter_parameter_logging.rb +8 -0
- data/examples/ranking/config/initializers/inflections.rb +16 -0
- data/examples/ranking/config/initializers/timescale.rb +3 -0
- data/examples/ranking/config/locales/en.yml +33 -0
- data/examples/ranking/config/puma.rb +43 -0
- data/examples/ranking/config/routes.rb +6 -0
- data/examples/ranking/config/storage.yml +34 -0
- data/examples/ranking/config.ru +6 -0
- data/examples/ranking/db/migrate/20220209120747_create_games.rb +10 -0
- data/examples/ranking/db/migrate/20220209120910_create_plays.rb +19 -0
- data/examples/ranking/db/migrate/20220209143347_create_score_per_hours.rb +5 -0
- data/examples/ranking/db/schema.rb +47 -0
- data/examples/ranking/db/seeds.rb +7 -0
- data/examples/ranking/db/views/score_per_hours_v01.sql +7 -0
- data/examples/ranking/lib/tasks/.keep +0 -0
- data/examples/ranking/log/.keep +0 -0
- data/examples/ranking/public/robots.txt +1 -0
- data/examples/ranking/storage/.keep +0 -0
- data/examples/ranking/tmp/.keep +0 -0
- data/examples/ranking/tmp/pids/.keep +0 -0
- data/examples/ranking/tmp/storage/.keep +0 -0
- data/examples/ranking/vendor/.keep +0 -0
- data/lib/{timescale → timescaledb}/acts_as_hypertable/core.rb +1 -1
- data/lib/{timescale → timescaledb}/acts_as_hypertable.rb +6 -6
- data/lib/{timescale → timescaledb}/chunk.rb +1 -1
- data/lib/{timescale → timescaledb}/compression_settings.rb +1 -1
- data/lib/{timescale → timescaledb}/continuous_aggregates.rb +3 -3
- data/lib/{timescale → timescaledb}/dimensions.rb +1 -1
- data/lib/{timescale → timescaledb}/hypertable.rb +4 -4
- data/lib/{timescale → timescaledb}/job.rb +1 -1
- data/lib/{timescale → timescaledb}/job_stats.rb +1 -1
- data/lib/{timescale → timescaledb}/migration_helpers.rb +2 -2
- data/lib/{timescale → timescaledb}/scenic/adapter.rb +2 -2
- data/lib/timescaledb/scenic/extension.rb +72 -0
- data/lib/{timescale → timescaledb}/schema_dumper.rb +4 -4
- data/lib/{timescale → timescaledb}/stats_report.rb +2 -2
- data/lib/timescaledb/version.rb +3 -0
- data/lib/timescaledb.rb +64 -0
- data/{timescale.gemspec → timescaledb.gemspec} +3 -3
- metadata +73 -23
- data/lib/timescale/version.rb +0 -3
- data/lib/timescale.rb +0 -62
@@ -0,0 +1,34 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
23
|
+
|
24
|
+
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# storage_account_name: your_account_name
|
28
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
29
|
+
# container: your_container_name-<%= Rails.env %>
|
30
|
+
|
31
|
+
# mirror:
|
32
|
+
# service: Mirror
|
33
|
+
# primary: local
|
34
|
+
# mirrors: [ amazon, google, microsoft ]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreatePlays < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
enable_extension("timescaledb") unless extensions.include? "timescaledb"
|
4
|
+
hypertable_options = {
|
5
|
+
time_column: 'created_at',
|
6
|
+
chunk_time_interval: '1 day',
|
7
|
+
compress_segmentby: 'game_id',
|
8
|
+
compress_orderby: 'created_at',
|
9
|
+
compression_interval: '7 days'
|
10
|
+
}
|
11
|
+
create_table :plays, hypertable: hypertable_options, id: false do |t|
|
12
|
+
t.references :game, null: false, foreign_key: false
|
13
|
+
t.integer :score
|
14
|
+
t.decimal :total_time
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema[7.0].define(version: 2022_02_09_143347) do
|
14
|
+
# These are extensions that must be enabled in order to support this database
|
15
|
+
enable_extension "plpgsql"
|
16
|
+
enable_extension "timescaledb"
|
17
|
+
|
18
|
+
create_table "games", force: :cascade do |t|
|
19
|
+
t.string "name"
|
20
|
+
t.string "description"
|
21
|
+
t.datetime "created_at", null: false
|
22
|
+
t.datetime "updated_at", null: false
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "plays", id: false, force: :cascade do |t|
|
26
|
+
t.bigint "game_id", null: false
|
27
|
+
t.integer "score"
|
28
|
+
t.decimal "total_time"
|
29
|
+
t.datetime "created_at", null: false
|
30
|
+
t.datetime "updated_at", null: false
|
31
|
+
t.index ["created_at"], name: "plays_created_at_idx", order: :desc
|
32
|
+
t.index ["game_id"], name: "index_plays_on_game_id"
|
33
|
+
end
|
34
|
+
|
35
|
+
create_hypertable "plays", time_column: "created_at", chunk_time_interval: "1 minute", compress_segmentby: "game_id", compress_orderby: "created_at ASC", compression_interval: "P7D"
|
36
|
+
|
37
|
+
create_continuous_aggregate("score_per_hours", <<-SQL)
|
38
|
+
SELECT plays.game_id,
|
39
|
+
time_bucket('PT1H'::interval, plays.created_at) AS bucket,
|
40
|
+
avg(plays.score) AS avg,
|
41
|
+
max(plays.score) AS max,
|
42
|
+
min(plays.score) AS min
|
43
|
+
FROM plays
|
44
|
+
GROUP BY plays.game_id, (time_bucket('PT1H'::interval, plays.created_at))
|
45
|
+
SQL
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
|
7
|
+
# Character.create(name: "Luke", movie: movies.first)
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Timescaledb
|
4
4
|
# If you want your model to hook into its underlying hypertable
|
5
5
|
# as well as have access to TimescaleDB specific data, methods, and more,
|
6
6
|
# specify this macro in your model.
|
@@ -10,7 +10,7 @@ module Timescale
|
|
10
10
|
#
|
11
11
|
# @see https://docs.timescale.com/api/latest/hypertable/create_hypertable/ for
|
12
12
|
# how to use the SQL `create_hypertable` function.
|
13
|
-
# @see
|
13
|
+
# @see Timescaledb::MigrationHelpers#create_table for how to create a new hypertable
|
14
14
|
# via a Rails migration utilizing the standard `create_table` method.
|
15
15
|
#
|
16
16
|
# @example Enabling the macro on your model
|
@@ -18,7 +18,7 @@ module Timescale
|
|
18
18
|
# acts_as_hypertable
|
19
19
|
# end
|
20
20
|
#
|
21
|
-
# @see
|
21
|
+
# @see Timescaledb::ActsAsHypertable#acts_as_hypertable
|
22
22
|
# for configuration options
|
23
23
|
module ActsAsHypertable
|
24
24
|
DEFAULT_OPTIONS = {
|
@@ -26,7 +26,7 @@ module Timescale
|
|
26
26
|
}.freeze
|
27
27
|
|
28
28
|
def acts_as_hypertable?
|
29
|
-
included_modules.include?(
|
29
|
+
included_modules.include?(Timescaledb::ActsAsHypertable::Core)
|
30
30
|
end
|
31
31
|
|
32
32
|
# == Configuration options
|
@@ -45,7 +45,7 @@ module Timescale
|
|
45
45
|
def acts_as_hypertable(options = {})
|
46
46
|
return if acts_as_hypertable?
|
47
47
|
|
48
|
-
include
|
48
|
+
include Timescaledb::ActsAsHypertable::Core
|
49
49
|
|
50
50
|
class_attribute :hypertable_options, instance_writer: false
|
51
51
|
|
@@ -59,4 +59,4 @@ module Timescale
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
ActiveRecord::Base.extend
|
62
|
+
ActiveRecord::Base.extend Timescaledb::ActsAsHypertable
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module Timescaledb
|
2
2
|
class ContinuousAggregate < ActiveRecord::Base
|
3
3
|
self.table_name = "timescaledb_information.continuous_aggregates"
|
4
4
|
self.primary_key = 'materialization_hypertable_name'
|
5
5
|
|
6
6
|
has_many :jobs, foreign_key: "hypertable_name",
|
7
|
-
class_name: "
|
7
|
+
class_name: "Timescaledb::Job"
|
8
8
|
|
9
9
|
has_many :chunks, foreign_key: "hypertable_name",
|
10
|
-
class_name: "
|
10
|
+
class_name: "Timescaledb::Chunk"
|
11
11
|
|
12
12
|
scope :resume, -> do
|
13
13
|
{
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Timescaledb
|
2
2
|
class Hypertable < ActiveRecord::Base
|
3
3
|
self.table_name = "timescaledb_information.hypertables"
|
4
4
|
self.primary_key = "hypertable_name"
|
@@ -8,15 +8,15 @@ module Timescale
|
|
8
8
|
|
9
9
|
has_many :compression_settings,
|
10
10
|
foreign_key: "hypertable_name",
|
11
|
-
class_name: "
|
11
|
+
class_name: "Timescaledb::CompressionSetting"
|
12
12
|
|
13
13
|
has_one :dimensions,
|
14
14
|
foreign_key: "hypertable_name",
|
15
|
-
class_name: "
|
15
|
+
class_name: "Timescaledb::Dimension"
|
16
16
|
|
17
17
|
has_many :continuous_aggregates,
|
18
18
|
foreign_key: "hypertable_name",
|
19
|
-
class_name: "
|
19
|
+
class_name: "Timescaledb::ContinuousAggregate"
|
20
20
|
|
21
21
|
def chunks_detailed_size
|
22
22
|
struct_from "SELECT * from chunks_detailed_size('#{self.hypertable_name}')"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_record/connection_adapters/postgresql_adapter'
|
2
2
|
|
3
3
|
# Useful methods to run TimescaleDB in you Ruby app.
|
4
|
-
module
|
4
|
+
module Timescaledb
|
5
5
|
# Migration helpers can help you to setup hypertables by default.
|
6
6
|
module MigrationHelpers
|
7
7
|
# create_table can receive `hypertable` argument
|
@@ -102,4 +102,4 @@ module Timescale
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(
|
105
|
+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(Timescaledb::MigrationHelpers)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'scenic/adapters/postgres'
|
2
2
|
require 'scenic/adapters/postgres/views'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Timescaledb
|
5
5
|
module Scenic
|
6
6
|
class Views < ::Scenic::Adapters::Postgres::Views
|
7
7
|
# All of the views that this connection has defined, excluding any
|
@@ -45,7 +45,7 @@ module Timescale
|
|
45
45
|
# definition, since it's not part of the DDL).
|
46
46
|
#
|
47
47
|
# Our schema dumper implementation will handle dumping the continuous
|
48
|
-
# aggregate
|
48
|
+
# aggregate definitions, but we need to override Scenic's schema dumping
|
49
49
|
# to exclude those continuous aggregates.
|
50
50
|
def views
|
51
51
|
Views.new(connection).all
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Scenic does not include `WITH` option that is used with continuous aggregates.
|
2
|
+
module Timescaledb
|
3
|
+
module Scenic
|
4
|
+
module Extension
|
5
|
+
# @override Scenic::Adapters::Postgres#create_materialized_view
|
6
|
+
# Creates a materialized view in the database
|
7
|
+
#
|
8
|
+
# @param name The name of the materialized view to create
|
9
|
+
# @param sql_definition The SQL schema that defines the materialized view.
|
10
|
+
# @param with [String] Default: nil. Set with: "..." to add "WITH (...)".
|
11
|
+
# @param no_data [Boolean] Default: false. Set to true to not create data.
|
12
|
+
# materialized view without running the associated query. You will need
|
13
|
+
# to perform a non-concurrent refresh to populate with data.
|
14
|
+
#
|
15
|
+
# This is typically called in a migration via {Statements#create_view}.
|
16
|
+
# @return [void]
|
17
|
+
def create_materialized_view(name, sql_definition, with: nil, no_data: false)
|
18
|
+
execute <<-SQL
|
19
|
+
CREATE MATERIALIZED VIEW #{quote_table_name(name)}
|
20
|
+
#{"WITH (#{with})" if with} AS
|
21
|
+
#{sql_definition.rstrip.chomp(';')}
|
22
|
+
#{'WITH NO DATA' if no_data};
|
23
|
+
SQL
|
24
|
+
end
|
25
|
+
|
26
|
+
# @override Scenic::Adapters::Postgres#create_view
|
27
|
+
# to add the `with: ` keyword that can be used for such option.
|
28
|
+
#
|
29
|
+
def create_view(name, version: nil, with: nil, sql_definition: nil, materialized: false, no_data: false)
|
30
|
+
if version.present? && sql_definition.present?
|
31
|
+
raise(
|
32
|
+
ArgumentError,
|
33
|
+
"sql_definition and version cannot both be set",
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
if version.blank? && sql_definition.blank?
|
38
|
+
version = 1
|
39
|
+
end
|
40
|
+
|
41
|
+
sql_definition ||= definition(name, version)
|
42
|
+
|
43
|
+
if materialized
|
44
|
+
::Scenic.database.create_materialized_view(
|
45
|
+
name,
|
46
|
+
sql_definition,
|
47
|
+
no_data: no_data,
|
48
|
+
with: with
|
49
|
+
)
|
50
|
+
else
|
51
|
+
::Scenic.database.create_view(name, sql_definition, with: with)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def definition(name, version)
|
58
|
+
::Scenic::Definition.new(name, version).to_sql
|
59
|
+
end
|
60
|
+
end
|
61
|
+
module MigrationHelpers
|
62
|
+
# Create a timescale continuous aggregate view
|
63
|
+
def create_scenic_continuous_aggregate(name)
|
64
|
+
::Scenic.database.create_view(name, materialized: true, no_data: true, with: "timescaledb.continuous")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.include(Timescaledb::Scenic::MigrationHelpers)
|
72
|
+
Scenic::Adapters::Postgres.prepend(Timescaledb::Scenic::Extension)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_record/connection_adapters/postgresql_adapter'
|
2
2
|
require 'active_support/core_ext/string/indent'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Timescaledb
|
5
5
|
module SchemaDumper
|
6
6
|
def tables(stream)
|
7
7
|
super # This will call #table for each table in the database
|
@@ -10,7 +10,7 @@ module Timescale
|
|
10
10
|
|
11
11
|
def table(table_name, stream)
|
12
12
|
super(table_name, stream)
|
13
|
-
if hypertable =
|
13
|
+
if hypertable = Timescaledb::Hypertable.find_by(hypertable_name: table_name)
|
14
14
|
timescale_hypertable(hypertable, stream)
|
15
15
|
timescale_retention_policy(hypertable, stream)
|
16
16
|
end
|
@@ -58,7 +58,7 @@ module Timescale
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def timescale_continuous_aggregates(stream)
|
61
|
-
|
61
|
+
Timescaledb::ContinuousAggregates.all.each do |aggregate|
|
62
62
|
opts = if (refresh_policy = aggregate.jobs.refresh_continuous_aggregate.first)
|
63
63
|
interval = timescale_interval(refresh_policy.schedule_interval)
|
64
64
|
end_offset = timescale_interval(refresh_policy.config["end_offset"])
|
@@ -85,4 +85,4 @@ module Timescale
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper.prepend(
|
88
|
+
ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper.prepend(Timescaledb::SchemaDumper)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "active_support/core_ext/numeric/conversions"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Timescaledb
|
4
4
|
module StatsReport
|
5
5
|
module_function
|
6
6
|
def resume(scope=Hypertable.all)
|
@@ -19,7 +19,7 @@ module Timescale
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def compression_resume(scope)
|
22
|
-
sum = -> (method) { (scope.map(&method).inject(:+) || 0).
|
22
|
+
sum = -> (method) { (scope.map(&method).inject(:+) || 0).to_formatted_s(:human_size)}
|
23
23
|
{
|
24
24
|
uncompressed: sum[:before_total_bytes],
|
25
25
|
compressed: sum[:after_total_bytes]
|
data/lib/timescaledb.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
require_relative 'timescaledb/acts_as_hypertable'
|
4
|
+
require_relative 'timescaledb/acts_as_hypertable/core'
|
5
|
+
require_relative 'timescaledb/chunk'
|
6
|
+
require_relative 'timescaledb/compression_settings'
|
7
|
+
require_relative 'timescaledb/continuous_aggregates'
|
8
|
+
require_relative 'timescaledb/dimensions'
|
9
|
+
require_relative 'timescaledb/hypertable'
|
10
|
+
require_relative 'timescaledb/job'
|
11
|
+
require_relative 'timescaledb/job_stats'
|
12
|
+
require_relative 'timescaledb/schema_dumper'
|
13
|
+
require_relative 'timescaledb/stats_report'
|
14
|
+
require_relative 'timescaledb/migration_helpers'
|
15
|
+
require_relative 'timescaledb/version'
|
16
|
+
|
17
|
+
module Timescaledb
|
18
|
+
module_function
|
19
|
+
|
20
|
+
def chunks
|
21
|
+
Chunk.all
|
22
|
+
end
|
23
|
+
|
24
|
+
def hypertables
|
25
|
+
Hypertable.all
|
26
|
+
end
|
27
|
+
|
28
|
+
def continuous_aggregates
|
29
|
+
ContinuousAggregates.all
|
30
|
+
end
|
31
|
+
|
32
|
+
def compression_settings
|
33
|
+
CompressionSettings.all
|
34
|
+
end
|
35
|
+
|
36
|
+
def jobs
|
37
|
+
Job.all
|
38
|
+
end
|
39
|
+
|
40
|
+
def job_stats
|
41
|
+
JobStats.all
|
42
|
+
end
|
43
|
+
|
44
|
+
def stats(scope=Hypertable.all)
|
45
|
+
StatsReport.resume(scope)
|
46
|
+
end
|
47
|
+
|
48
|
+
def default_hypertable_options
|
49
|
+
Timescaledb::ActsAsHypertable::DEFAULT_OPTIONS
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
begin
|
54
|
+
require 'scenic'
|
55
|
+
require_relative 'timescaledb/scenic/adapter'
|
56
|
+
require_relative 'timescaledb/scenic/extension'
|
57
|
+
|
58
|
+
Scenic.configure do |config|
|
59
|
+
config.database = Timescaledb::Scenic::Adapter.new
|
60
|
+
end
|
61
|
+
|
62
|
+
rescue LoadError
|
63
|
+
# This is expected when the scenic gem is not being used
|
64
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require_relative 'lib/
|
1
|
+
require_relative 'lib/timescaledb/version'
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "timescaledb"
|
5
|
-
spec.version =
|
5
|
+
spec.version = Timescaledb::VERSION
|
6
6
|
spec.authors = ["Jônatas Davi Paganini"]
|
7
7
|
spec.email = ["jonatasdp@gmail.com"]
|
8
8
|
|
9
9
|
spec.summary = %q{TimescaleDB helpers for Ruby ecosystem.}
|
10
10
|
spec.description = %q{Functions from timescaledb available in the ActiveRecord models.}
|
11
|
-
spec.homepage = "https://github.com/jonatas/
|
11
|
+
spec.homepage = "https://github.com/jonatas/timescaledb"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
14
|
|