Class: AmazonAthena::Commands::ShowTables
- Inherits:
-
AmazonAthena::Command
- Object
- AmazonAthena::Command
- AmazonAthena::Commands::ShowTables
- Defined in:
- lib/amazon_athena/commands/show_tables.rb
Instance Method Summary collapse
-
#initialize(database_name) ⇒ ShowTables
constructor
A new instance of ShowTables.
- #run(connection) ⇒ Object
- #statement ⇒ Object
Methods inherited from AmazonAthena::Command
Constructor Details
#initialize(database_name) ⇒ ShowTables
Returns a new instance of ShowTables.
7 8 9 |
# File 'lib/amazon_athena/commands/show_tables.rb', line 7 def initialize(database_name) @database_name = database_name.strip end |
Instance Method Details
#run(connection) ⇒ Object
15 16 17 18 19 |
# File 'lib/amazon_athena/commands/show_tables.rb', line 15 def run(connection) connection.query(statement).map {|row| row.tab_name } rescue Exception => e e.getCause() end |
#statement ⇒ Object
11 12 13 |
# File 'lib/amazon_athena/commands/show_tables.rb', line 11 def statement "SHOW TABLES IN #{@database_name};" end |