Class: Chicago::ETL::KeyBuilder::Factory Private

Inherits:
Object
  • Object
show all
Defined in:
lib/chicago/etl/key_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Creates the appropriate KeyBuilder for a star schema table.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, staging_db) ⇒ Factory

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Factory.



20
21
22
23
# File 'lib/chicago/etl/key_builder.rb', line 20

def initialize(table, staging_db)
  @table = table
  @staging_db = staging_db
end

Instance Attribute Details

#staging_dbObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
# File 'lib/chicago/etl/key_builder.rb', line 18

def staging_db
  @staging_db
end

#tableObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
# File 'lib/chicago/etl/key_builder.rb', line 18

def table
  @table
end

Instance Method Details

#makeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates the appropriate key builder for a schema table, depending on the table type and whether rows are identified by original keys or need to be hashed.



28
29
30
31
32
33
34
# File 'lib/chicago/etl/key_builder.rb', line 28

def make
  if dimension?
    dimension_key_builder
  elsif fact?
    FactKeyBuilder.new(staging_db[table.table_name])
  end
end