Class: RedshiftExtractor::Copy
- Inherits:
-
Object
- Object
- RedshiftExtractor::Copy
- Defined in:
- lib/redshift_extractor/copy.rb
Instance Attribute Summary collapse
-
#aws_access_key_id ⇒ Object
readonly
Returns the value of attribute aws_access_key_id.
-
#aws_secret_access_key ⇒ Object
readonly
Returns the value of attribute aws_secret_access_key.
-
#data_source ⇒ Object
readonly
Returns the value of attribute data_source.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #copy_sql ⇒ Object
- #credentials ⇒ Object
-
#initialize(args) ⇒ Copy
constructor
A new instance of Copy.
Constructor Details
#initialize(args) ⇒ Copy
5 6 7 8 9 10 |
# File 'lib/redshift_extractor/copy.rb', line 5 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 |
Instance Attribute Details
#aws_access_key_id ⇒ Object (readonly)
Returns the value of attribute aws_access_key_id.
3 4 5 |
# File 'lib/redshift_extractor/copy.rb', line 3 def aws_access_key_id @aws_access_key_id end |
#aws_secret_access_key ⇒ Object (readonly)
Returns the value of attribute aws_secret_access_key.
3 4 5 |
# File 'lib/redshift_extractor/copy.rb', line 3 def aws_secret_access_key @aws_secret_access_key end |
#data_source ⇒ Object (readonly)
Returns the value of attribute data_source.
3 4 5 |
# File 'lib/redshift_extractor/copy.rb', line 3 def data_source @data_source end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
3 4 5 |
# File 'lib/redshift_extractor/copy.rb', line 3 def table_name @table_name end |
Instance Method Details
#copy_sql ⇒ Object
12 13 14 |
# File 'lib/redshift_extractor/copy.rb', line 12 def copy_sql "copy #{table_name} from '#{data_source}' credentials '#{credentials}' manifest dateformat 'auto' timeformat 'auto' blanksasnull emptyasnull escape gzip removequotes delimiter '|';" end |
#credentials ⇒ Object
16 17 18 |
# File 'lib/redshift_extractor/copy.rb', line 16 def credentials "aws_access_key_id=#{aws_access_key_id};aws_secret_access_key=#{aws_secret_access_key}" end |