lib/etl/transform/foreign_key_lookup_transform.rb
# Initialize the SQL resolver. Use the given table and field name to search
# for the appropriate foreign key. The field should be the name of a natural
# key that is used to locate the surrogate key for the record.
#
# The connection argument is optional. If specified it can be either a symbol
# referencing a connection defined in the ETL database.yml file or an actual
# ActiveRecord connection instance. If the connection is not specified then
# the ActiveRecord::Base.connection will be used.
Initialize the SQL resolver. Use the given table and field name to search
for the appropriate foreign key. The field should be the name of a natural
key that is used to locate the surrogate key for the record.

The connection argument is optional. If specified it can be either a symbol
referencing a connection defined in the ETL database.yml file or an actual
ActiveRecord connection instance. If the connection is not specified then
the ActiveRecord::Base.connection will be used.
Initialize the SQL resolver . Use the given table and field name to search for the appropriate foreign key . The field should be the name of a natural key that is used to locate the surrogate key for the record . The connection argument is optional . If specified it can be either a symbol referencing a connection defined in the ETL database . yml file or an actual ActiveRecord connection instance . If the connection is not specified then the ActiveRecord :: Base . connection will be used .
def load_cache
    @use_cache = true
    q = "SELECT id, #{@field} FROM #{table_name}"
    @connection.select_all(q).each do |record|
      cache[record[@field]] = record['id']
    end
  end
def load_cache @use_cache = true q = "SELECT id, #{@field} FROM #{table_name}" @connection . select_all ( q ) . each do | record | cache [ record [ @field ] ] = record [ 'id' ] end end
Initialize the SQL resolver.
Initialize the SQL resolver .