Sha256: b4f56c5edb2e08e7da5aae9d15559634701e47854b04b70a24700b653de8d3e5

Contents?: true

Size: 1003 Bytes

Versions: 19

Compression:

Stored size: 1003 Bytes

Contents

module ETL #:nodoc:
  module Processor #:nodoc:
    # A processor which will truncate a table. Use as a pre-processor for cleaning out a table
    # prior to loading
    class TruncateProcessor < ETL::Processor::Processor
      # Defines the table to truncate
      attr_reader :table
      
      # Defines the database connection to use
      attr_reader :target
      
      # Initialize the processor
      #
      # Options:
      # * <tt>:target</tt>: The target connection
      # * <tt>:table</tt>: The table name
      def initialize(control, configuration)
        super
        #@file = File.join(File.dirname(control.file), configuration[:file])
        @target = configuration[:target] || {}
        @table = configuration[:table]
      end
      
      def process
        conn = ETL::Engine.connection(target)
        conn.truncate(table_name)
      end
      
      private
      def table_name
        ETL::Engine.table(table, ETL::Engine.connection(target))
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 7 rubygems

Version Path
aeden-activewarehouse-etl-0.9.1 etl/lib/etl/processor/truncate_processor.rb
colincasey-activewarehouse-etl-0.9.4 lib/etl/processor/truncate_processor.rb
colincasey-activewarehouse-etl-0.9.5 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.2 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.3 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.4 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.5 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.6 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.7 lib/etl/processor/truncate_processor.rb
jayzes-activewarehouse-etl-0.9.1.1 lib/etl/processor/truncate_processor.rb
jayzes-activewarehouse-etl-0.9.1.2 lib/etl/processor/truncate_processor.rb
jayzes-activewarehouse-etl-0.9.1 lib/etl/processor/truncate_processor.rb
activewarehouse-etl-0.9.5.rc1 lib/etl/processor/truncate_processor.rb
darrell-activewarehouse-etl-0.9.1.6 lib/etl/processor/truncate_processor.rb
darrell-activewarehouse-etl-0.9.1.4 lib/etl/processor/truncate_processor.rb
factorylabs-activewarehouse-etl-0.9.1.8 lib/etl/processor/truncate_processor.rb
balinterdi-activewarehouse-etl-0.9.2 lib/etl/processor/truncate_processor.rb
activewarehouse-etl-0.9.0 lib/etl/processor/truncate_processor.rb
activewarehouse-etl-0.9.1 lib/etl/processor/truncate_processor.rb