Module: RedshiftETL::Archive

Defined in:
lib/redshift_etl/archive.rb

Class Method Summary collapse

Class Method Details

.call(config) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/redshift_etl/archive.rb', line 3

def self.call(config)
  # Delete previously-stored files if doing a full update.
  config.s3_bucket.objects.with_prefix(config.final_s3_path).delete_all

  # Move objects from temp dir to final location.
  config.s3_bucket.objects.with_prefix(config.temp_s3_path).each do |object|
    filename = File.basename(object.key)
    new_location = config.final_s3_path + filename
    object.move_to(new_location)
  end
end