Class: RedshiftConnector::UrlDataFileBundle

Inherits:
AbstractDataFileBundle show all
Defined in:
lib/redshift_connector/url_data_file_bundle.rb

Constant Summary

Constants inherited from AbstractDataFileBundle

AbstractDataFileBundle::REPORT_SIZE

Instance Attribute Summary collapse

Attributes inherited from AbstractDataFileBundle

#batch_size, #logger

Instance Method Summary collapse

Methods inherited from AbstractDataFileBundle

#all_data_objects, #each_batch, #each_object, #each_row

Constructor Details

#initialize(urls, format: :redshift_csv, filter: nil, logger: RedshiftConnector.logger) ⇒ UrlDataFileBundle

Returns a new instance of UrlDataFileBundle.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
# File 'lib/redshift_connector/url_data_file_bundle.rb', line 9

def initialize(urls, format: :redshift_csv, filter: nil, logger: RedshiftConnector.logger)
  super filter: filter, batch_size: 1000, logger: logger
  reader_class = Reader.get(format)
  raise ArgumentError, 'no URL given' if urls.empty?
  @data_files = urls.map {|url| UrlDataFile.new(URI.parse(url), reader_class: reader_class) }
  logger.info "reader: #{reader_class}"
end

Instance Attribute Details

#data_filesObject (readonly)

Returns the value of attribute data_files.



17
18
19
# File 'lib/redshift_connector/url_data_file_bundle.rb', line 17

def data_files
  @data_files
end