Sha256: 2f26ac07966e177ec4f6a3bb738b1cc125c7c9b4bf03fd332b06d5fcb104e379

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

module RedshiftExtractor; class Copy

  attr_reader :aws_access_key_id, :aws_secret_access_key, :data_source, :table_name

  def initialize(args)
    @aws_access_key_id = args.fetch(:aws_access_key_id)
    @aws_secret_access_key = args.fetch(:aws_secret_access_key)
    @data_source = args.fetch(:data_source)
    @table_name = args.fetch(:table_name)
  end

  def copy_sql
    "copy #{table_name} from '#{data_source}'"\
    " credentials '#{credentials}'"\
    " manifest dateformat 'auto' timeformat 'auto' blanksasnull emptyasnull escape gzip removequotes delimiter '|';"
  end

  def credentials
    "aws_access_key_id=#{aws_access_key_id};aws_secret_access_key=#{aws_secret_access_key}"
  end

end; end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redshift_extractor-0.2.0 lib/redshift_extractor/copy.rb