Sha256: 2631dd3ac803651f3591cc0837785bbb67c0013f01e317b4727fa1e88a5d7912

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require_relative '../command'

module AmazonAthena
  module Commands
    class ShowPartitions < AmazonAthena::Command

      def initialize(database_table)
        @database_table = database_table
      end

      def statement
        "SHOW PARTITIONS #{@database_table};"
      end

      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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
athena-cli-0.1.0 lib/amazon_athena/commands/show_partitions.rb