class Riak::TimeSeries::Query

A query for Riak Time Series. Supports SQL for querying (data manipulation language, or DML).

Attributes

client[R]

@!attribute [r] client @return [Riak::Client] the Riak client to use for the TS query

interpolations[RW]

Values to be interpolated into the query, support planned in Riak TS 1.2

query_text[RW]

@!attribute [rw] query_text @return [String] the SQL query to run

results[R]

#!attribute [r] results @return [Riak::Client::BeefcakeProtobuffsBackend::TsQueryResp]

backend-dependent results object

Public Class Methods

new(client, query_text, interpolations = {}) click to toggle source

Initialize a query object

@param [Riak::Client] client the client connected to the riak cluster @param [String] query_text the SQL query to run @param interpolations planned for Riak TS 1.1

# File lib/riak/time_series/query.rb, line 29
def initialize(client, query_text, interpolations = {})
  @client = client
  @query_text = query_text
  @interpolations = interpolations
end

Public Instance Methods

issue!() click to toggle source

Run the query against Riak TS, and store the results in the `results` attribute

# File lib/riak/time_series/query.rb, line 37
def issue!
  @results = client.backend do |be|
    op = be.time_series_query_operator(client.convert_timestamp)
    op.query(query_text, interpolations)
  end
end