Method: DataDuck::RedshiftDestination#load_table!

Defined in:
lib/dataduck/redshift_destination.rb

#load_table!(table) ⇒ Object



261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/dataduck/redshift_destination.rb', line 261

def load_table!(table)
  DataDuck::Logs.info "Loading table #{ table.name }..."
  s3_object = self.upload_table_to_s3!(table)
  self.create_output_tables!(table)
  query_to_run = self.copy_query(table, s3_object.s3_path)
  self.query(query_to_run)
  s3_object.delete!

  if table.staging_name != table.building_name
    self.merge_from_staging!(table)
    self.drop_staging_table!(table)
  end
end