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