Class: ETL::Screen::RowCountScreen

Inherits:
Object
  • Object
show all
Defined in:
lib/etl/screen/row_count_screen.rb

Overview

This screen validates the number of rows which will be bulk loaded against the results from some sort of a row count query. If there is a difference then the screen will not pass

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(control, configuration = {}) ⇒ RowCountScreen

Returns a new instance of RowCountScreen.



8
9
10
11
12
# File 'lib/etl/screen/row_count_screen.rb', line 8

def initialize(control, configuration={})
  @control = control
  @configuration = configuration
  execute
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



7
8
9
# File 'lib/etl/screen/row_count_screen.rb', line 7

def configuration
  @configuration
end

#controlObject

Returns the value of attribute control.



7
8
9
# File 'lib/etl/screen/row_count_screen.rb', line 7

def control
  @control
end

Instance Method Details

#executeObject



13
14
15
16
17
# File 'lib/etl/screen/row_count_screen.rb', line 13

def execute
  unless Engine.rows_written == configuration[:rows]
    raise "Rows written (#{Engine.rows_written}) does not match expected rows (#{configuration[:rows]})"
  end
end