timescaledb 0.2.6 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/bin/tsdb +30 -29
  3. data/lib/timescaledb/acts_as_hypertable/core.rb +1 -1
  4. data/lib/timescaledb/acts_as_hypertable.rb +5 -2
  5. data/lib/timescaledb/connection.rb +43 -0
  6. data/lib/timescaledb/connection_handling.rb +16 -0
  7. data/lib/timescaledb/database/chunk_statements.rb +21 -0
  8. data/lib/timescaledb/database/hypertable_statements.rb +37 -0
  9. data/lib/timescaledb/database/quoting.rb +12 -0
  10. data/lib/timescaledb/database/schema_statements.rb +246 -0
  11. data/lib/timescaledb/database/types.rb +20 -0
  12. data/lib/timescaledb/database.rb +15 -0
  13. data/lib/timescaledb/migration_helpers.rb +36 -8
  14. data/lib/timescaledb/schema_dumper.rb +40 -12
  15. data/lib/timescaledb/stats/chunks.rb +41 -0
  16. data/lib/timescaledb/stats/continuous_aggregates.rb +24 -0
  17. data/lib/timescaledb/stats/hypertables.rb +102 -0
  18. data/lib/timescaledb/stats/job_stats.rb +29 -0
  19. data/lib/timescaledb/stats.rb +22 -0
  20. data/lib/timescaledb/toolkit/time_vector.rb +21 -17
  21. data/lib/timescaledb/version.rb +1 -1
  22. data/lib/timescaledb.rb +3 -0
  23. metadata +15 -95
  24. data/.github/workflows/ci.yml +0 -72
  25. data/.gitignore +0 -12
  26. data/.rspec +0 -3
  27. data/.ruby-version +0 -1
  28. data/.tool-versions +0 -1
  29. data/.travis.yml +0 -9
  30. data/CODE_OF_CONDUCT.md +0 -74
  31. data/Fastfile +0 -17
  32. data/Gemfile +0 -8
  33. data/Gemfile.lock +0 -75
  34. data/Gemfile.scenic +0 -7
  35. data/Gemfile.scenic.lock +0 -119
  36. data/README.md +0 -490
  37. data/Rakefile +0 -21
  38. data/bin/console +0 -28
  39. data/bin/setup +0 -13
  40. data/docs/command_line.md +0 -178
  41. data/docs/img/lttb_example.png +0 -0
  42. data/docs/img/lttb_sql_vs_ruby.gif +0 -0
  43. data/docs/img/lttb_zoom.gif +0 -0
  44. data/docs/index.md +0 -72
  45. data/docs/migrations.md +0 -76
  46. data/docs/models.md +0 -78
  47. data/docs/toolkit.md +0 -507
  48. data/docs/toolkit_lttb_tutorial.md +0 -557
  49. data/docs/toolkit_lttb_zoom.md +0 -357
  50. data/docs/toolkit_ohlc.md +0 -315
  51. data/docs/videos.md +0 -16
  52. data/examples/all_in_one/all_in_one.rb +0 -94
  53. data/examples/all_in_one/benchmark_comparison.rb +0 -108
  54. data/examples/all_in_one/caggs.rb +0 -93
  55. data/examples/all_in_one/query_data.rb +0 -78
  56. data/examples/ranking/.gitattributes +0 -7
  57. data/examples/ranking/.gitignore +0 -29
  58. data/examples/ranking/.ruby-version +0 -1
  59. data/examples/ranking/Gemfile +0 -33
  60. data/examples/ranking/Gemfile.lock +0 -189
  61. data/examples/ranking/README.md +0 -166
  62. data/examples/ranking/Rakefile +0 -6
  63. data/examples/ranking/app/controllers/application_controller.rb +0 -2
  64. data/examples/ranking/app/controllers/concerns/.keep +0 -0
  65. data/examples/ranking/app/jobs/application_job.rb +0 -7
  66. data/examples/ranking/app/models/application_record.rb +0 -3
  67. data/examples/ranking/app/models/concerns/.keep +0 -0
  68. data/examples/ranking/app/models/game.rb +0 -2
  69. data/examples/ranking/app/models/play.rb +0 -7
  70. data/examples/ranking/bin/bundle +0 -114
  71. data/examples/ranking/bin/rails +0 -4
  72. data/examples/ranking/bin/rake +0 -4
  73. data/examples/ranking/bin/setup +0 -33
  74. data/examples/ranking/config/application.rb +0 -39
  75. data/examples/ranking/config/boot.rb +0 -4
  76. data/examples/ranking/config/credentials.yml.enc +0 -1
  77. data/examples/ranking/config/database.yml +0 -86
  78. data/examples/ranking/config/environment.rb +0 -5
  79. data/examples/ranking/config/environments/development.rb +0 -60
  80. data/examples/ranking/config/environments/production.rb +0 -75
  81. data/examples/ranking/config/environments/test.rb +0 -53
  82. data/examples/ranking/config/initializers/cors.rb +0 -16
  83. data/examples/ranking/config/initializers/filter_parameter_logging.rb +0 -8
  84. data/examples/ranking/config/initializers/inflections.rb +0 -16
  85. data/examples/ranking/config/initializers/timescale.rb +0 -2
  86. data/examples/ranking/config/locales/en.yml +0 -33
  87. data/examples/ranking/config/puma.rb +0 -43
  88. data/examples/ranking/config/routes.rb +0 -6
  89. data/examples/ranking/config/storage.yml +0 -34
  90. data/examples/ranking/config.ru +0 -6
  91. data/examples/ranking/db/migrate/20220209120747_create_games.rb +0 -10
  92. data/examples/ranking/db/migrate/20220209120910_create_plays.rb +0 -19
  93. data/examples/ranking/db/migrate/20220209143347_create_score_per_hours.rb +0 -5
  94. data/examples/ranking/db/schema.rb +0 -47
  95. data/examples/ranking/db/seeds.rb +0 -7
  96. data/examples/ranking/db/views/score_per_hours_v01.sql +0 -7
  97. data/examples/ranking/lib/tasks/.keep +0 -0
  98. data/examples/ranking/log/.keep +0 -0
  99. data/examples/ranking/public/robots.txt +0 -1
  100. data/examples/ranking/storage/.keep +0 -0
  101. data/examples/ranking/tmp/.keep +0 -0
  102. data/examples/ranking/tmp/pids/.keep +0 -0
  103. data/examples/ranking/tmp/storage/.keep +0 -0
  104. data/examples/ranking/vendor/.keep +0 -0
  105. data/examples/toolkit-demo/compare_volatility.rb +0 -104
  106. data/examples/toolkit-demo/lttb/README.md +0 -15
  107. data/examples/toolkit-demo/lttb/lttb.rb +0 -92
  108. data/examples/toolkit-demo/lttb/lttb_sinatra.rb +0 -139
  109. data/examples/toolkit-demo/lttb/lttb_test.rb +0 -21
  110. data/examples/toolkit-demo/lttb/views/index.erb +0 -27
  111. data/examples/toolkit-demo/lttb-zoom/README.md +0 -13
  112. data/examples/toolkit-demo/lttb-zoom/lttb_zoomable.rb +0 -90
  113. data/examples/toolkit-demo/lttb-zoom/views/index.erb +0 -33
  114. data/examples/toolkit-demo/ohlc.rb +0 -175
  115. data/mkdocs.yml +0 -34
  116. data/timescaledb.gemspec +0 -40
data/README.md DELETED
@@ -1,490 +0,0 @@
1
- # TimescaleDB
2
-
3
- Welcome to the TimescaleDB gem! To experiment with the code, start installing the
4
- gem:
5
-
6
- ```bash
7
- gem install timescaledb
8
- ```
9
-
10
- ## The `tsdb` CLI
11
-
12
- When you install the gem locally, a new command line application named `tsdb`
13
- will be linked in your command line.
14
-
15
- It accepts a Postgresql URI and some extra flags that can help you to get more
16
- info from your TimescaleDB server:
17
-
18
- ```bash
19
- tsdb <uri> --stats
20
- ```
21
-
22
- Where the `<uri>` is replaced with params from your connection like:
23
-
24
- ```bash
25
- tsdb postgres://<user>@localhost:5432/<dbname> --stats
26
- ```
27
-
28
-
29
- Or just check the stats:
30
-
31
- ```bash
32
- tsdb "postgres://<user>@localhost:5432/timescaledb_test" --stats
33
- ```
34
-
35
- These is a sample output from database example with almost no data:
36
-
37
- ```ruby
38
- {:hypertables=>
39
- {:count=>3,
40
- :uncompressed=>2,
41
- :chunks=>{:total=>1, :compressed=>0, :uncompressed=>1},
42
- :size=>{:before_compressing=>"80 KB", :after_compressing=>"0 Bytes"}},
43
- :continuous_aggregates=>{:count=>1},
44
- :jobs_stats=>[{:success=>nil, :runs=>nil, :failures=>nil}]}
45
- ```
46
-
47
- To start a interactive ruby/[pry](https://github.com/pry/pry) console use `--console`:
48
- The console will dynamically create models for all hypertables that it finds
49
- in the database.
50
-
51
- Let's consider the [caggs.sql](https://gist.github.com/jonatas/95573ad8744994094ec9f284150004f9#file-caggs-sql)
52
- as the example of database.
53
-
54
-
55
- ```bash
56
- psql postgres://<user>@localhost:5432/playground -f caggs.sql
57
- ```
58
-
59
- Then use `tsdb` in the command line with the same URI and `--stats`:
60
-
61
- ```bash
62
- tsdb postgres://<user>@localhost:5432/playground --stats
63
- {:hypertables=>
64
- {:count=>1,
65
- :uncompressed=>1,
66
- :approximate_row_count=>{"ticks"=>352},
67
- :chunks=>{:total=>1, :compressed=>0, :uncompressed=>1},
68
- :size=>{:uncompressed=>"88 KB", :compressed=>"0 Bytes"}},
69
- :continuous_aggregates=>{:total=>1},
70
- :jobs_stats=>[{:success=>nil, :runs=>nil, :failures=>nil}]}
71
- ```
72
-
73
- To have some interactive playground with the actual database using ruby, just
74
- try the same command before changing from `--stats` to `--console`:
75
-
76
- ### tsdb --console
77
-
78
- The same database from previous example, is used so
79
- the context has a hypertable named `ticks` and a view named `ohlc_1m`.
80
-
81
-
82
- ```ruby
83
- tsdb postgres://<user>@localhost:5432/playground --console
84
- pry(Timescale)>
85
- ```
86
-
87
- The `tsdb` CLI will automatically create ActiveRecord models for hypertables and
88
- continuous aggregates views.
89
-
90
- ```ruby
91
- Tick
92
- => Timescaledb::Tick(time: datetime, symbol: string, price: decimal, volume: integer)
93
- ```
94
-
95
- Note that it's only created for this session and will never be cached in the
96
- library or any other place.
97
-
98
- In this case, `Tick` model comes from `ticks` hypertable that was found in the database.
99
- It contains several extra methods inherited from `acts_as_hypertable` macro.
100
-
101
- Let's start with the `.hypertable` method.
102
-
103
- ```ruby
104
- Tick.hypertable
105
- => #<Timescaledb::Hypertable:0x00007fe99c258900
106
- hypertable_schema: "public",
107
- hypertable_name: "ticks",
108
- owner: "jonatasdp",
109
- num_dimensions: 1,
110
- num_chunks: 1,
111
- compression_enabled: false,
112
- is_distributed: false,
113
- replication_factor: nil,
114
- data_nodes: nil,
115
- tablespaces: nil>
116
- ```
117
-
118
- The core of the hypertables are the fragmentation of the data into chunks that
119
- are the child tables that distribute the data. You can check all chunks directly
120
- from the hypertable relation.
121
-
122
- ```ruby
123
- Tick.hypertable.chunks
124
- unknown OID 2206: failed to recognize type of 'primary_dimension_type'. It will be treated as String.
125
- => [#<Timescaledb::Chunk:0x00007fe99c31b068
126
- hypertable_schema: "public",
127
- hypertable_name: "ticks",
128
- chunk_schema: "_timescaledb_internal",
129
- chunk_name: "_hyper_33_17_chunk",
130
- primary_dimension: "time",
131
- primary_dimension_type: "timestamp without time zone",
132
- range_start: 1999-12-30 00:00:00 +0000,
133
- range_end: 2000-01-06 00:00:00 +0000,
134
- range_start_integer: nil,
135
- range_end_integer: nil,
136
- is_compressed: false,
137
- chunk_tablespace: nil,
138
- data_nodes: nil>]
139
- ```
140
-
141
- > Chunks are created by partitioning a hypertable's data into one
142
- > (or potentially multiple) dimensions. All hypertables are partitioned by the
143
- > values belonging to a time column, which may be in timestamp, date, or
144
- > various integer forms. If the time partitioning interval is one day,
145
- > for example, then rows with timestamps that belong to the same day are co-located
146
- > within the same chunk, while rows belonging to different days belong to different chunks.
147
- > Learn more [here](https://docs.timescale.com/timescaledb/latest/overview/core-concepts/hypertables-and-chunks/).
148
-
149
- Another core concept of TimescaleDB is compression. With data partitioned, it
150
- becomes very convenient to compress and decompress chunks independently.
151
-
152
- ```ruby
153
- Tick.hypertable.chunks.first.compress!
154
- ActiveRecord::StatementInvalid: PG::FeatureNotSupported: ERROR: compression not enabled on "ticks"
155
- DETAIL: It is not possible to compress chunks on a hypertable that does not have compression enabled.
156
- HINT: Enable compression using ALTER TABLE with the timescaledb.compress option.
157
- ```
158
-
159
- As compression is not enabled, let's do it executing a plain SQL directly from
160
- the actual context. To borrow a connection, let's use the Tick object.
161
-
162
- ```ruby
163
- Tick.connection.execute("ALTER TABLE ticks SET (timescaledb.compress)") # => PG_OK
164
- ```
165
-
166
- And now, it's possible to compress and decompress:
167
-
168
- ```ruby
169
- Tick.hypertable.chunks.first.compress!
170
- Tick.hypertable.chunks.first.decompress!
171
- ```
172
- Learn more about TimescaleDB compression [here](https://docs.timescale.com/timescaledb/latest/overview/core-concepts/compression/).
173
-
174
- The `ohlc_1m` view is also available as an ActiveRecord:
175
-
176
- ```ruby
177
- Ohlc1m
178
- => Timescaledb::Ohlc1m(bucket: datetime, symbol: string, open: decimal, high: decimal, low: decimal, close: decimal, volume: integer)
179
- ```
180
-
181
- And you can run any query as you do with regular active record queries.
182
-
183
- ```ruby
184
- Ohlc1m.order(bucket: :desc).last
185
- => #<Timescaledb::Ohlc1m:0x00007fe99c2c38e0
186
- bucket: 2000-01-01 00:00:00 UTC,
187
- symbol: "SYMBOL",
188
- open: 0.13e2,
189
- high: 0.3e2,
190
- low: 0.1e1,
191
- close: 0.1e2,
192
- volume: 27600>
193
- ```
194
-
195
- ## Installation
196
-
197
- Add this line to your application's Gemfile:
198
-
199
- ```ruby
200
- gem 'timescaledb'
201
- ```
202
-
203
- And then execute:
204
-
205
- $ bundle install
206
-
207
- Or install it yourself as:
208
-
209
- $ gem install timescaledb
210
-
211
-
212
- ## Usage
213
-
214
- Check the [examples/ranking](examples/ranking) to get a Rails complete example.
215
-
216
- You can check the [all_in_one.rb](examples/all_in_one/all_in_one.rb) example that will:
217
-
218
- 1. Create hypertable with compression settings
219
- 2. Insert data
220
- 3. Run some queries
221
- 4. Check chunk size per model
222
- 5. Compress a chunk
223
- 6. Check chunk status
224
- 7. Decompress a chunk
225
-
226
- ### Toolkit
227
-
228
- Toolkit contains a lot of extra features to analyse data more deeply directly in
229
- the SQL. There are a few examples in the [examples/toolkit-demo](examples/toolkit-demo)
230
- folder that can let you benchmark and see the differences between implementing
231
- the algorithm directly in Ruby or directly in SQL using the [Timescaledb
232
- Toolkit](https://github.com/timescale/timescaledb-toolkit) extension.
233
-
234
- For now you can benchmark and compare:
235
-
236
- 1. [volatility](examples/toolkit-demo/compare_volatility.rb) algorithm.
237
- 2. [lttb](examples/toolkit-demo/lttb/lttb_sinatra.rb) algorithm.
238
-
239
- ### Testing
240
-
241
- If you need some inspiration for how are you going to test your hypertables,
242
- please check the [spec/spec_helper.rb](spec/spec_helper.rb) for inspiration.
243
-
244
- ### Migrations
245
-
246
- Create table is now with the `hypertable` keyword allowing to pass a few options
247
- to the function call while also using `create_table` method:
248
-
249
- #### create_table with `:hypertable`
250
-
251
- ```ruby
252
- hypertable_options = {
253
- time_column: 'created_at',
254
- chunk_time_interval: '1 min',
255
- compress_segmentby: 'identifier',
256
- compression_interval: '7 days'
257
- }
258
-
259
- create_table(:events, id: false, hypertable: hypertable_options) do |t|
260
- t.string :identifier, null: false
261
- t.jsonb :payload
262
- t.timestamps
263
- end
264
- ```
265
-
266
- #### create_continuous_aggregate
267
-
268
- This example shows a ticks table grouping ticks as OHLCV histograms for every
269
- minute.
270
-
271
- ```ruby
272
- hypertable_options = {
273
- time_column: 'created_at',
274
- chunk_time_interval: '1 min',
275
- compress_segmentby: 'symbol',
276
- compress_orderby: 'created_at',
277
- compression_interval: '7 days'
278
- }
279
- create_table :ticks, hypertable: hypertable_options, id: false do |t|
280
- t.string :symbol
281
- t.decimal :price
282
- t.integer :volume
283
- t.timestamps
284
- end
285
- Tick = Class.new(ActiveRecord::Base) do
286
- self.table_name = 'ticks'
287
- self.primary_key = 'symbol'
288
- acts_as_hypertable
289
- end
290
-
291
- query = Tick.select(<<~QUERY)
292
- time_bucket('1m', created_at) as time,
293
- symbol,
294
- FIRST(price, created_at) as open,
295
- MAX(price) as high,
296
- MIN(price) as low,
297
- LAST(price, created_at) as close,
298
- SUM(volume) as volume").group("1,2")
299
- QUERY
300
-
301
- options = {
302
- with_data: false,
303
- refresh_policies: {
304
- start_offset: "INTERVAL '1 month'",
305
- end_offset: "INTERVAL '1 minute'",
306
- schedule_interval: "INTERVAL '1 minute'"
307
- }
308
- }
309
-
310
- create_continuous_aggregate('ohlc_1m', query, **options)
311
- ```
312
-
313
- #### Scenic integration
314
-
315
- The [Scenic](https://github.com/scenic-views/scenic) gem is an easy way to
316
- manage database view definitions for a Rails application. TimescaleDB's
317
- continuous aggregates are more complex than regular PostgreSQL views, and
318
- the schema dumper included with Scenic can't dump a complete definition.
319
-
320
- This gem automatically configures Scenic to use a `Timescaledb::Scenic::Adapter`
321
- which will correctly handle schema dumping.
322
-
323
- ### Enable ActsAsHypertable
324
-
325
- You can declare a Rails model as a Hypertable by invoking the `acts_as_hypertable` macro. This macro extends your existing model with timescaledb-related functionality.
326
- model:
327
-
328
- ```ruby
329
- class Event < ActiveRecord::Base
330
- acts_as_hypertable
331
- end
332
- ```
333
-
334
- By default, ActsAsHypertable assumes a record's _time_column_ is called `created_at`.
335
-
336
- ### Options
337
-
338
- If you are using a different time_column name, you can specify it as follows when invoking the `acts_as_hypertable` macro:
339
-
340
- ```ruby
341
- class Event < ActiveRecord::Base
342
- acts_as_hypertable time_column: :timestamp
343
- end
344
- ```
345
-
346
- ### Chunks
347
-
348
- To get all the chunks from a model's hypertable, you can use `.chunks`.
349
-
350
- ```ruby
351
- Event.chunks # => [#<Timescaledb::Chunk>, ...]
352
- ```
353
-
354
- ### Hypertable metadata
355
-
356
- To get the models' hypertable metadata, you can use `.hypertable`.
357
-
358
- ```ruby
359
- Event.hypertable # => #<Timescaledb::Hypertable>
360
- ```
361
-
362
- To get hypertable metadata for all hypertables: `Timescaledb.hypertables`.
363
-
364
- ### Compression Settings
365
-
366
- Compression settings are accessible through the hypertable.
367
-
368
- ```ruby
369
- Event.hypertable.compression_settings # => [#<Timescaledb::CompressionSettings>, ...]
370
- ```
371
-
372
- To get compression settings for all hypertables: `Timescaledb.compression_settings`.
373
-
374
- ### Scopes
375
-
376
- The `acts_as_hypertable` macro can be very useful to generate some extra scopes
377
- for you. Example of a weather condition:
378
-
379
- ```ruby
380
- class Condition < ActiveRecord::Base
381
- acts_as_hypertable time_column: "time"
382
- end
383
- ```
384
-
385
- Through the [ActsAsHypertable](./lib/timescaledb/acts_as_hypertable) on the model,
386
- a few scopes are created based on the `time_column` argument:
387
-
388
- | Scope name | What they return |
389
- |------------------------|---------------------------------------|
390
- | `Model.previous_month` | Records created in the previous month |
391
- | `Model.previous_week` | Records created in the previous week |
392
- | `Model.this_month` | Records created this month |
393
- | `Model.this_week` | Records created this week |
394
- | `Model.yesterday` | Records created yesterday |
395
- | `Model.today` | Records created today |
396
- | `Model.last_hour` | Records created in the last hour |
397
-
398
- All time-related scopes respect your application's timezone.
399
-
400
- When you enable ActsAsTimeVector on your model, we include a couple default scopes. They are:
401
-
402
- ```ruby
403
- class Condition < ActiveRecord::Base
404
- acts_as_time_vector time_column: "time",
405
- value_column: "temperature",
406
- segment_by: "device_id"
407
- end
408
- ```
409
-
410
- ## RSpec Hooks
411
-
412
- In case you want to use TimescaleDB on a Rails environment, you may have some
413
- issues as the schema dump used for tests does not consider hypertables metadata.
414
-
415
- As a work around, you can dynamically create the hypertables yourself for
416
- testing environments using the following hook which you can
417
- define in `spec/rspec_helper.rb`:
418
-
419
- ```ruby
420
- config.before(:suite) do
421
- hypertable_models = ActiveRecord::Base.descendants.select(&:acts_as_hypertable?)
422
-
423
- hypertable_models.each do |klass|
424
- table_name = klass.table_name
425
- time_column = klass.hypertable_options[:time_column]
426
-
427
- if klass.try(:hypertable).present?
428
- ApplicationRecord.logger.info "hypertable already created for '#{table_name}', skipping."
429
- next
430
- end
431
-
432
- ApplicationRecord.connection.execute <<~SQL
433
- SELECT create_hypertable('#{table_name}', '#{time_column.to_s}')
434
- SQL
435
- end
436
- end
437
- ```
438
-
439
- ## Development
440
-
441
- After checking out the repo, run `bin/setup` to install the development dependencies. Then, `bundle exec rake test:setup` to setup the test database and tables. Finally, run `bundle exec rake` to run the tests.
442
-
443
- You can also run `tsdb` for an interactive prompt that will allow you to experiment.
444
-
445
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
446
-
447
- You can create a `.env` file locally to run tests locally. Make sure to put your
448
- own credentials there!
449
-
450
- ```bash
451
- PG_URI_TEST="postgres://<user>@localhost:5432/<dbname>"
452
- ```
453
-
454
- You can put some postgres URI directly as a parameter of
455
- `tsdb`. Here is an example from the console:
456
-
457
- ```bash
458
- tsdb "postgres://<user>@localhost:5432/timescaledb_test"
459
- ```
460
-
461
- ## More resources
462
-
463
- This library was started on [twitch.tv/timescaledb](https://twitch.tv/timescaledb).
464
- You can watch all episodes here:
465
-
466
- 1. [Wrapping Functions to Ruby Helpers](https://www.youtube.com/watch?v=hGPsUxLFAYk).
467
- 2. [Extending ActiveRecord with Timescale Helpers](https://www.youtube.com/watch?v=IEyJIHk1Clk).
468
- 3. [Setup Hypertables for Rails testing environment](https://www.youtube.com/watch?v=wM6hVrZe7xA).
469
- 4. [Packing the code to this repository](https://www.youtube.com/watch?v=CMdGAl_XlL4).
470
- 4. [the code to this repository](https://www.youtube.com/watch?v=CMdGAl_XlL4).
471
- 5. [Working with Timescale continuous aggregates](https://youtu.be/co4HnBkHzVw).
472
- 6. [Creating the command-line application in Ruby to explore the Timescale API](https://www.youtube.com/watch?v=I3vM_q2m7T0).
473
-
474
- ### TODO
475
-
476
- Here is a list of functions that would be great to have:
477
-
478
- - [ ] Add data nodes support
479
-
480
- ## Contributing
481
-
482
- Bug reports and pull requests are welcome on GitHub at https://github.com/jonatas/timescaledb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/jonatas/timescaledb/blob/master/CODE_OF_CONDUCT.md).
483
-
484
- ## License
485
-
486
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
487
-
488
- ## Code of Conduct
489
-
490
- Everyone interacting in the Timescale project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jonatas/timescaledb/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile DELETED
@@ -1,21 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- begin
5
- require "gemika/tasks"
6
- rescue LoadError
7
- puts "Run `gem install gemika` for additional tasks"
8
- end
9
-
10
- RSpec::Core::RakeTask.new(:spec)
11
-
12
- task default: "matrix:spec"
13
-
14
- namespace :test do
15
- task :setup do
16
- require_relative "spec/spec_helper"
17
-
18
- teardown_tables
19
- setup_tables
20
- end
21
- end
data/bin/console DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "timescaledb"
5
-
6
- def uri_from_test
7
- require 'dotenv'
8
- Dotenv.load!
9
- ENV['PG_URI_TEST']
10
- end
11
-
12
- ActiveRecord::Base.establish_connection(ARGV[0] || uri_from_test)
13
-
14
- Timescaledb::Hypertable.find_each do |hypertable|
15
- class_name = hypertable.hypertable_name.singularize.camelize
16
-
17
- model = Class.new(ActiveRecord::Base) do
18
- self.table_name = hypertable.hypertable_name
19
- self.primary_key = self.column_names.first
20
-
21
- acts_as_hypertable
22
- end
23
-
24
- Timescaledb.const_set(class_name, model)
25
- end
26
-
27
- require "pry"
28
- Pry.start(Timescaledb)
data/bin/setup DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
-
6
- set -vx
7
-
8
- bundle install
9
-
10
- bundle install --gemfile Gemfile.scenic
11
-
12
- # For running tests it's going to use PG_URI_TEST env variable.
13
- # Please make sure you set it properly to a TEST database!"