Class: Chicago::ETL::HashingKeyBuilder Private
- Inherits:
-
KeyBuilder
- Object
- KeyBuilder
- Chicago::ETL::HashingKeyBuilder
- 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.
Key builder for dimensions with natuaral keys, but no simple key.
This should not be instantiated directly, use KeyBuilder.for_dimension.
Instance Attribute Summary collapse
- #columns ⇒ Object readonly private
- #hash_preparation ⇒ Object private
Instance Method Summary collapse
-
#initialize(key_table, columns) ⇒ HashingKeyBuilder
constructor
private
A new instance of HashingKeyBuilder.
- #original_key(row) ⇒ Object private
- #original_key_select_fragment ⇒ Object private
Methods inherited from KeyBuilder
Constructor Details
#initialize(key_table, columns) ⇒ HashingKeyBuilder
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 HashingKeyBuilder.
166 167 168 169 170 |
# File 'lib/chicago/etl/key_builder.rb', line 166 def initialize(key_table, columns) super(key_table) @columns = columns @hash_preparation = lambda {|column| column.to_s.upcase } end |
Instance Attribute Details
#columns ⇒ Object (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.
163 164 165 |
# File 'lib/chicago/etl/key_builder.rb', line 163 def columns @columns end |
#hash_preparation ⇒ Object
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.
164 165 166 |
# File 'lib/chicago/etl/key_builder.rb', line 164 def hash_preparation @hash_preparation end |
Instance Method Details
#original_key(row) ⇒ Object
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.
172 173 174 175 |
# File 'lib/chicago/etl/key_builder.rb', line 172 def original_key(row) str = columns.map {|column| hash_preparation.call(row[column]) }.join Digest::MD5.hexdigest(str).upcase end |
#original_key_select_fragment ⇒ Object
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.
177 178 179 |
# File 'lib/chicago/etl/key_builder.rb', line 177 def original_key_select_fragment :hex.sql_function(:original_id).as(:original_id) end |