Class: RedshiftConnector::Reader::RedshiftCSV

Inherits:
Abstract
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/redshift_connector/reader/redshift_csv.rb

Overview

Reads CSV file generated by Redshift UNLOAD statement (with option ADDQUOTES ESCAPE). UNLOAD escapes data by ‘' (backslash character), we cannot use standard CSV class.

Constant Summary

Constants inherited from Abstract

Abstract::READER_CLASSES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

declare_reader, get_reader_class

Constructor Details

#initialize(f) ⇒ RedshiftCSV

f

IO



17
18
19
20
# File 'lib/redshift_connector/reader/redshift_csv.rb', line 17

def initialize(f)
  @f = f
  @csv = RedshiftCsvFile.new(@f)
end

Class Method Details

.data_object?(key) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/redshift_connector/reader/redshift_csv.rb', line 12

def self.data_object?(key)
  /\.csv(?:\.|\z)/ =~ File.basename(key)
end