Sha256: d164017cb5f2d45e4c2286e7d66d5ca29b7c779335c99746e9d4bb84d9e5d77f
Contents?: true
Size: 695 Bytes
Versions: 18
Compression:
Stored size: 695 Bytes
Contents
module Chicago module ETL class EtlBatchIdDatasetFilter def initialize(etl_batch_id) @etl_batch_id = etl_batch_id end # Returns a new dataset, filtered by all tables where the etl # batch id matches. def filter(dataset) dataset.filter(conditions(filterable_tables(dataset))) end private def filterable_tables(dataset) dataset.dependant_tables.select {|t| dataset.db.schema(t).map(&:first).include?(:etl_batch_id) } end def conditions(tables) tables. map {|t| {:etl_batch_id.qualify(t) => @etl_batch_id} }. inject {|a,b| a | b} end end end end
Version data entries
18 entries across 18 versions & 1 rubygems