module JDBCHelper::Athena

Constants

DRIVER_NAME

Public Class Methods

configure_driver_path(class_path) click to toggle source
# File lib/jdbc_helper/athena.rb, line 22
def self.configure_driver_path(class_path)
  paths = ENV["CLASSPATH"].to_s.split(":")
  paths << class_path

  ENV["CLASSPATH"] = paths.uniq.join(":")
end
connect(key: nil, secret: nil, region: "us-east-1", s3_staging_dir: nil, extra_params: {}, &block) click to toggle source
# File lib/jdbc_helper/athena.rb, line 13
def self.connect(key: nil, secret: nil, region: "us-east-1", s3_staging_dir: nil, extra_params: {}, &block)
  connect_impl :athena, {
    url: "jdbc:awsathena://athena.#{region}.amazonaws.com:443",
    user: key || ENV["AWS_ACCESS_KEY"],
    password: secret || ENV['AWS_SECRET_KEY'],
    s3_staging_dir: s3_uri(s3_staging_dir || ENV["ATHENA_S3_STAGING_DIR"])
  }, {}, &block
end
s3_uri(path) click to toggle source
# File lib/jdbc_helper/athena.rb, line 29
def self.s3_uri(path)
  return path if path.to_s.start_with?("s3://")

  path = "s3://#{path}"
  path = path + "/" unless path.end_with?("/")

  path
end