Module: Timescaledb
- Defined in:
- lib/timescaledb/toolkit/helpers.rb,
lib/timescaledb.rb,
lib/timescaledb/job.rb,
lib/timescaledb/chunk.rb,
lib/timescaledb/stats.rb,
lib/timescaledb/version.rb,
lib/timescaledb/database.rb,
lib/timescaledb/extension.rb,
lib/timescaledb/job_stats.rb,
lib/timescaledb/connection.rb,
lib/timescaledb/dimensions.rb,
lib/timescaledb/hypertable.rb,
lib/timescaledb/stats/chunks.rb,
lib/timescaledb/stats_report.rb,
lib/timescaledb/configuration.rb,
lib/timescaledb/schema_dumper.rb,
lib/timescaledb/database/types.rb,
lib/timescaledb/scenic/adapter.rb,
lib/timescaledb/stats/job_stats.rb,
lib/timescaledb/database/quoting.rb,
lib/timescaledb/scenic/extension.rb,
lib/timescaledb/migration_helpers.rb,
lib/timescaledb/stats/hypertables.rb,
lib/timescaledb/acts_as_hypertable.rb,
lib/timescaledb/application_record.rb,
lib/timescaledb/connection_handling.rb,
lib/timescaledb/toolkit/time_vector.rb,
lib/timescaledb/compression_settings.rb,
lib/timescaledb/continuous_aggregates.rb,
lib/timescaledb/acts_as_hypertable/core.rb,
lib/timescaledb/database/chunk_statements.rb,
lib/timescaledb/database/schema_statements.rb,
lib/timescaledb/stats/continuous_aggregates.rb,
lib/timescaledb/continuous_aggregates_helper.rb,
lib/timescaledb/database/hypertable_statements.rb
Overview
Useful methods to run TimescaleDB in you Ruby app.
Defined Under Namespace
Modules: ActsAsHypertable, ContinuousAggregatesHelper, Extension, MigrationHelpers, Scenic, SchemaDumper, StatsReport, Toolkit
Classes: ApplicationRecord, Chunk, CompressionSetting, Configuration, Connection, ConnectionNotEstablishedError, ContinuousAggregates, Database, Dimension, Hypertable, Job, JobStat, Stats
Constant Summary
collapse
- VERSION =
'0.3.3'
- JobStats =
JobStat
- Dimensions =
attribute :time_interval, :interval
Dimension
- CompressionSettings =
CompressionSetting
Class Method Summary
collapse
Class Method Details
.chunks ⇒ Object
71
72
73
|
# File 'lib/timescaledb.rb', line 71
def chunks
Chunk.all
end
|
.compression_settings ⇒ Object
83
84
85
|
# File 'lib/timescaledb.rb', line 83
def compression_settings
CompressionSettings.all
end
|
.configuration ⇒ Object
33
34
35
|
# File 'lib/timescaledb.rb', line 33
def configuration
@configuration ||= Configuration.new
end
|
29
30
31
|
# File 'lib/timescaledb.rb', line 29
def configure
yield(configuration) if block_given?
end
|
.connection ⇒ Object
63
64
65
|
# File 'lib/timescaledb.rb', line 63
def connection
Connection.instance
end
|
.continuous_aggregates ⇒ Object
79
80
81
|
# File 'lib/timescaledb.rb', line 79
def continuous_aggregates
ContinuousAggregates.all
end
|
.default_hypertable_options ⇒ Object
.establish_connection(config) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/timescaledb/connection_handling.rb', line 7
def establish_connection(config)
Connection.instance.config = config
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection(config)
end
end
|
.extension ⇒ Object
67
68
69
|
# File 'lib/timescaledb.rb', line 67
def extension
Extension
end
|
.hypertables ⇒ Object
75
76
77
|
# File 'lib/timescaledb.rb', line 75
def hypertables
Hypertable.all
end
|
.job_stats ⇒ Object
91
92
93
|
# File 'lib/timescaledb.rb', line 91
def job_stats
JobStats.all
end
|
.jobs ⇒ Object
87
88
89
|
# File 'lib/timescaledb.rb', line 87
def jobs
Job.all
end
|
.setup_scenic_integration ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/timescaledb.rb', line 37
def setup_scenic_integration
return unless configuration.enable_scenic_integration?
return if @scenic_integration_setup
begin
require 'scenic'
require_relative 'timescaledb/scenic/adapter'
require_relative 'timescaledb/scenic/extension'
::Scenic.configure do |config|
config.database = Timescaledb::Scenic::Adapter.new
end
::Scenic::Adapters::Postgres.include(Timescaledb::Scenic::Extension)
::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(Timescaledb::Scenic::MigrationHelpers)
@scenic_integration_setup = true
rescue LoadError
@scenic_integration_setup = false
end
end
|
.stats(scope = Hypertable.all) ⇒ Object
95
96
97
|
# File 'lib/timescaledb.rb', line 95
def stats(scope=Hypertable.all)
StatsReport.resume(scope)
end
|
.use_connection(conn) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/timescaledb/connection_handling.rb', line 18
def use_connection(conn)
Connection.instance.use_connection(conn)
if defined?(ActiveRecord::Base) && ActiveRecord::Base.connected?
ar_conn = ActiveRecord::Base.connection
current_conn = ar_conn.raw_connection
if current_conn != conn
ar_conn.instance_variable_set(:@raw_connection, conn)
end
end
end
|