Class: AmazonAthena::Partition
- Inherits:
-
Object
- Object
- AmazonAthena::Partition
- Defined in:
- lib/amazon_athena/partition.rb
Instance Method Summary collapse
-
#initialize(options: {}, location: nil) ⇒ Partition
constructor
A new instance of Partition.
- #to_s ⇒ Object
Constructor Details
#initialize(options: {}, location: nil) ⇒ Partition
Returns a new instance of Partition.
4 5 6 7 |
# File 'lib/amazon_athena/partition.rb', line 4 def initialize(options: {}, location: nil) @options = @location = location end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/amazon_athena/partition.rb', line 9 def to_s return nil if @options.empty? # TODO: Sanitize and handle non-strings opts = @options.map {|k,v| "#{k} = '#{v}'"}.join(", ") sql = "PARTITION (#{opts})" sql += " LOCATION '#{@location}'" if @location sql end |