The TimescaleDB Ruby Gem¶
Welcome to the TimescaleDB gem! To experiment with the code, start installing the gem:
You can install the gem locally:
Or require it directly in the Gemfile of your project:
- The model can use the acts_as_hypertable macro. Check more on models documentation.
- The ActiveRecord migrations can use the create_table supporting the
hypertablekeyword. It's also enabling you to add retention and continuous aggregates policies
- A standalone
create_hypertablemacro is also allowed in the migrations.
- Testing also becomes easier as the schema dumper will automatically introduce the hypertables to all environments.
- It also contains a scenic extension to work with scenic views as it's a wide adoption in the community.
- The gem is also packed with a command line utility that makes it easier to navigate in your database with Pry and all your hypertables available in a Ruby style.
The all_in_one example shows:
- Create a hypertable with compression settings
- Insert data
- Run some queries
- Check chunk size per model
- Compress a chunk
- Check chunk status
- Decompress a chunk
The ranking example shows how to configure a Rails app and navigate all the features available.
There are also examples in the toolkit-demo folder that can help you to understand how to properly use the toolkit functions.
- ohlc is a funtion that groups data by Open, High, Low, Close and make histogram availables to group the data, very useful for financial analysis.
- While building the LTTB tutorial I created the lttb is a simple charting using the Largest Triangle Three Buckets and there. A zoomable version which allows to navigate in the data and zoom it keeping the same data resolution is also available.
- A small example showing how to process volatility is also good to get familiar with the pipeline functions. A benchmark implementing the same in Ruby is also available to check how it compares to the SQL implementation.
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.
The gem is available as open source under the MIT License.
Code of Conduct¶
Everyone interacting in the Timescale project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the code of conduct.