Class: Ductr::KibaJob
- Includes:
- ETL::Parser, JobETLRunner
- Defined in:
- lib/ductr/kiba_job.rb
Overview
Base class for ETL job using kiba’s streaming runner. Example using the SQLite adapter:
class MyKibaJob < Ductr::KibaJob
source :some_adapter, :paginated, page_size: 4
def select_some_stuff(db, offset, limit)
db[:items].offset(offset).limit(limit)
end
lookup :some_adapter, :match, merge: [:id, :item], buffer_size: 4
def merge_with_stuff(db, ids)
db[:items_bis].select(:id, Sequel.as(:name, :name_bis), :item).where(item: ids)
end
transform
def generate_more_stuff(row)
{ name: "#{row[:name]}_#{row[:name_bis]}" }
end
destination :some_other_adapter, :basic
def my_destination(row, db)
logger.trace("Hello destination: #{row}")
db[:new_items].insert(name: row[:name])
end
end
Constant Summary collapse
- ETL_RUNNER_CLASS =
Returns The ETL runner class used by the job.
ETL::KibaRunner
Instance Attribute Summary
Attributes inherited from Job
Class Method Summary collapse
-
.destination(adapter_name, destination_type, **destination_options) ⇒ void
Annotation to define a destination method.
-
.lookup(adapter_name, lookup_type, **lookup_options) ⇒ void
Annotation to define a lookup method.
-
.source(adapter_name, source_type, **source_options) ⇒ void
Annotation to define a source method.
-
.transform(transform_class, **transform_options) ⇒ void
Annotation to define a transform method.
Methods included from ETL::Parser
Methods included from JobETLRunner
Methods inherited from Job
#adapter, #logger, #perform, #run
Methods included from JobStatus
Class Method Details
.destination(adapter_name, destination_type, **destination_options) ⇒ void
This method returns an undefined value.
Annotation to define a destination method
128 |
# File 'lib/ductr/kiba_job.rb', line 128 annotable :destination |
.lookup(adapter_name, lookup_type, **lookup_options) ⇒ void
This method returns an undefined value.
Annotation to define a lookup method
109 |
# File 'lib/ductr/kiba_job.rb', line 109 annotable :lookup |
.source(adapter_name, source_type, **source_options) ⇒ void
This method returns an undefined value.
Annotation to define a source method
57 |
# File 'lib/ductr/kiba_job.rb', line 57 annotable :source |
.transform(transform_class, **transform_options) ⇒ void
This method returns an undefined value.
Annotation to define a transform method
90 |
# File 'lib/ductr/kiba_job.rb', line 90 annotable :transform |