Class: Ductr::SequelBase::BasicLookup

Inherits:
ETL::Transform show all
Defined in:
lib/ductr/sequel_base/basic_lookup.rb

Overview

A lookup control that execute one query per row.

Instance Attribute Summary

Attributes inherited from ETL::Control

#adapter, #job_method, #options

Instance Method Summary collapse

Methods inherited from ETL::Transform

#close

Methods inherited from ETL::Control

#call_method, #initialize

Constructor Details

This class inherits a constructor from Ductr::ETL::Control

Instance Method Details

#process(row) ⇒ Hash<Symbol, Object>

Calls the job’s method to merge its result with the current row.

Parameters:

  • row (Hash<Symbol, Object>)

    The current row, preferably a Hash

Returns:

  • (Hash<Symbol, Object>)

    The row merged with looked up row or the untouched row if nothing was found



16
17
18
19
20
21
# File 'lib/ductr/sequel_base/basic_lookup.rb', line 16

def process(row)
  matching_row = call_method(adapter.db, row).first
  return row unless matching_row

  row.merge matching_row
end