class AmazonAthena::Commands::ShowPartitions

Public Class Methods

new(database_table) click to toggle source
# File lib/amazon_athena/commands/show_partitions.rb, line 7
def initialize(database_table)
  @database_table = database_table
end

Public Instance Methods

run(connection) click to toggle source
# File lib/amazon_athena/commands/show_partitions.rb, line 15
def run(connection)
  # TODO: Map fields directly
  connection.query(statement).raw_output
rescue Exception => e
  case e.message
  when /not a partitioned table/
    "Error: #{@database_table} is not a partitioned table."
  end
end
statement() click to toggle source
# File lib/amazon_athena/commands/show_partitions.rb, line 11
def statement
  "SHOW PARTITIONS #{@database_table};"
end