class TinyPresto::TinyPresto
Singleton object representing a Presto cluster running in the local machine.
Attributes
client[R]
cluster[R]
Public Class Methods
new()
click to toggle source
# File lib/tiny-presto.rb, line 16 def initialize @cluster = Cluster.new @cluster.run @client = Presto::Client.new( server: 'localhost:8080', catalog: 'memory', user: 'tiny-user', schema: 'default', # TODO: Remove after presto-client-ruby supports Trino http_headers: { 'X-Trino-User' => 'tiny-user', 'X-Trino-Catalog' => 'memory', 'X-Trino-Schema' => 'default' }) loop do @client.run('show schemas') break rescue StandardError => _ # Waiting for the cluster is launched sleep(1) end end
Public Instance Methods
stop()
click to toggle source
# File lib/tiny-presto.rb, line 39 def stop @cluster.stop end