Class: RedshiftCopier::CopyFile

Inherits:
Object
  • Object
show all
Defined in:
lib/redshift_copier/copy_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CopyFile

Returns a new instance of CopyFile.



5
6
7
8
9
10
11
12
13
14
# File 'lib/redshift_copier/copy_file.rb', line 5

def initialize(args)
  @schema = args.fetch(:schema)
  @table = args.fetch(:table)
  @create_sql = args.fetch(:create_sql)
  @aws_access_key_id = args.fetch(:aws_access_key_id)
  @aws_secret_access_key = args.fetch(:aws_secret_access_key)
  @s3_csv_location = args.fetch(:s3_csv_location)
  @db_config = args.fetch(:db_config)
  @copy_command_options = args.fetch(:copy_command_options, "dateformat 'auto' timeformat 'auto' blanksasnull emptyasnull escape removequotes delimiter ',' ignoreheader 1;")
end

Instance Attribute Details

#aws_access_key_idObject (readonly)

Returns the value of attribute aws_access_key_id.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def aws_access_key_id
  @aws_access_key_id
end

#aws_secret_access_keyObject (readonly)

Returns the value of attribute aws_secret_access_key.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def aws_secret_access_key
  @aws_secret_access_key
end

#copy_command_optionsObject (readonly)

Returns the value of attribute copy_command_options.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def copy_command_options
  @copy_command_options
end

#create_sqlObject (readonly)

Returns the value of attribute create_sql.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def create_sql
  @create_sql
end

#db_configObject (readonly)

Returns the value of attribute db_config.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def db_config
  @db_config
end

#s3_csv_locationObject (readonly)

Returns the value of attribute s3_csv_location.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def s3_csv_location
  @s3_csv_location
end

#schemaObject (readonly)

Returns the value of attribute schema.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def schema
  @schema
end

#tableObject (readonly)

Returns the value of attribute table.



3
4
5
# File 'lib/redshift_copier/copy_file.rb', line 3

def table
  @table
end

Instance Method Details

#runObject



16
17
18
19
20
# File 'lib/redshift_copier/copy_file.rb', line 16

def run
  drop
  create
  copy
end