Class: AmazonAthena::Commands::AlterTableDropPartition
- Inherits:
-
AmazonAthena::Command
- Object
- AmazonAthena::Command
- AmazonAthena::Commands::AlterTableDropPartition
- Defined in:
- lib/amazon_athena/commands/alter_table_drop_partition.rb
Instance Method Summary collapse
-
#initialize(database_table, partitions) ⇒ AlterTableDropPartition
constructor
A new instance of AlterTableDropPartition.
- #partition_clauses ⇒ Object
- #run(connection) ⇒ Object
- #statement ⇒ Object
Methods inherited from AmazonAthena::Command
Constructor Details
#initialize(database_table, partitions) ⇒ AlterTableDropPartition
Returns a new instance of AlterTableDropPartition.
8 9 10 11 |
# File 'lib/amazon_athena/commands/alter_table_drop_partition.rb', line 8 def initialize(database_table, partitions) @database_table = database_table @partitions = partitions end |
Instance Method Details
#partition_clauses ⇒ Object
13 14 15 |
# File 'lib/amazon_athena/commands/alter_table_drop_partition.rb', line 13 def partition_clauses @partitions.map {|p| " #{p}"}.join(",\n") end |
#run(connection) ⇒ Object
21 22 23 24 |
# File 'lib/amazon_athena/commands/alter_table_drop_partition.rb', line 21 def run(connection) # TODO: Map fields directly connection.query(statement).raw_output end |
#statement ⇒ Object
17 18 19 |
# File 'lib/amazon_athena/commands/alter_table_drop_partition.rb', line 17 def statement "ALTER TABLE #{@database_table} DROP\n#{partition_clauses};" end |