Sha256: 488e10dc8237235aa3170ddf683fe979071f4c2f761b85eb3d8e0d4b8627f82d
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
# the generated ruby files use a relative require, so we need to add the # generated directory to $LOAD_PATH this_dir = File.expand_path(File.dirname(__FILE__)) gen_dir = File.join(this_dir, 'impala/protocol') $LOAD_PATH.push(gen_dir) unless $LOAD_PATH.include?(gen_dir) require 'impala/version' require 'thrift' require 'time' require 'impala/protocol' require 'impala/cursor' require 'impala/connection' module Impala DEFAULT_HOST = 'localhost' DEFAULT_PORT = 21000 class Error < StandardError; end class InvalidQueryError < Error; end class ConnectionError < Error; end class CursorError < Error; end # Connect to an Impala server. If a block is given, it will close the # connection after yielding the connection to the block. # @param [String] host the hostname or IP address of the Impala server # @param [int] port the port that the Impala server is listening on # @yieldparam [Connection] conn the open connection. Will be closed once the block # finishes # @return [Connection] the open connection, or, if a block is # passed, the return value of the block def self.connect(host=DEFAULT_HOST, port=DEFAULT_PORT) connection = Connection.new(host, port) if block_given? begin ret = yield connection ensure connection.close end else ret = connection end ret end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sequel-impala-1.0.1 | lib/impala.rb |
sequel-impala-1.0.0 | lib/impala.rb |