ruby-pg
driver to connect to RisingWave.
Run RisingWave
To learn about how to run RisingWave, see Run RisingWave.Install the ruby-pg
driver
For information about how to install ruby-pg
, see the official ruby-pg documentation.
Connect to RisingWave
To connect to RisingWave viaruby-pg
:
The
BasicTypeMapForResults
class isn’t supported currently, you need to cast RisingWave types into Ruby types manually.Create a source
The code below creates a sourcewalk
with the datagen
connector. The datagen
connector is used to generate mock data. The walk
source consists of two columns, distance
and duration
, which respectively represent the distance and the duration of a walk. The source is a simplified version of the data that is tracked by smart watches.
All the code examples in this guide include a section for connecting to RisingWave. If you perform multiple actions within one connection session, you do not need to repeat this section.
Create a materialized view
The code in this section creates a materialized viewcounter
to capture the latest total distance and duration.
Query a materialized view
The code in this section queries the materialized viewcounter
to get real-time data.