Class: BeetleETL::Import

Inherits:
Object
  • Object
show all
Defined in:
lib/beetle_etl/import.rb

Instance Method Summary collapse

Instance Method Details

#cleanupObject



28
29
30
31
32
# File 'lib/beetle_etl/import.rb', line 28

def cleanup
  transformations.each do |t|
    DropStage.new(t.table_name).run
  end
end

#importObject



19
20
21
22
23
24
25
26
# File 'lib/beetle_etl/import.rb', line 19

def import
  data_report = AsyncStepRunner.new(data_steps).run
  load_report = BeetleETL.database.transaction do
    AsyncStepRunner.new(load_steps).run
  end

  data_report.deep_merge load_report
end

#runObject



6
7
8
9
10
11
# File 'lib/beetle_etl/import.rb', line 6

def run
  setup
  import
ensure
  cleanup
end

#setupObject



13
14
15
16
17
# File 'lib/beetle_etl/import.rb', line 13

def setup
  transformations.each do |t|
    CreateStage.new(t.table_name, t.relations, t.column_names).run
  end
end