lib/etl/transform/foreign_key_lookup_transform.rb
# Transform the value by resolving it to a foriegn key
Transform the value by resolving it to a foriegn key
Transform the value by resolving it to a foriegn key
def transform(name, value, row)
        fk = @collection[value]
        unless fk
          raise ResolverError, "Foreign key for #{value} not found and no resolver specified" unless resolver
          raise ResolverError, "Resolver does not appear to respond to resolve method" unless resolver.respond_to?(:resolve)
          fk = resolver.resolve(value)
          fk ||= @default
          raise ResolverError, "Unable to resolve #{value} to foreign key for #{name} in row #{ETL::Engine.rows_read}. You may want to specify a :default value." unless fk
          @collection[value] = fk
        end
        fk
      end
def transform ( name , value , row ) fk = @collection [ value ] unless fk raise ResolverError , "Foreign key for #{value} not found and no resolver specified" unless resolver raise ResolverError , "Resolver does not appear to respond to resolve method" unless resolver . respond_to? ( :resolve ) fk = resolver . resolve ( value ) fk ||= @default raise ResolverError , "Unable to resolve #{value} to foreign key for #{name} in row #{ETL::Engine.rows_read}. You may want to specify a :default value." unless fk @collection [ value ] = fk end fk end
Transform the value by resolving it to a foriegn key
Transform the value by resolving it to a foriegn key
name
<not_specific>
value
<not_specific>
row
<not_specific>