Class: Bricolage::StreamingLoad::StreamingLoadV3Job

Inherits:
RubyJobClass
  • Object
show all
Defined in:
lib/bricolage/streamingload/jobparams.rb

Constant Summary collapse

DEFAULT_LOAD_OPTIONS =
PSQLLoadOptions.new(opts)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ StreamingLoadV3Job

Returns a new instance of StreamingLoadV3Job.



117
118
119
# File 'lib/bricolage/streamingload/jobparams.rb', line 117

def initialize(params)
  @params = params
end

Class Method Details

.declarations(params) ⇒ Object



111
112
113
114
115
# File 'lib/bricolage/streamingload/jobparams.rb', line 111

def self.declarations(params)
  Bricolage::Declarations.new(
    'dest_table' => nil,
  )
end

.default_load_optionsObject



94
95
# File 'lib/bricolage/streamingload/jobparams.rb', line 94

def self.default_load_options
end

.parameters(params) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'lib/bricolage/streamingload/jobparams.rb', line 83

def self.parameters(params)
  params.add DestTableParam.new(optional: false)
  params.add DestTableParam.new('work-table', optional: true)
  params.add KeyValuePairsParam.new('load-options', 'OPTIONS', 'Loader options.',
      optional: true, default: DEFAULT_LOAD_OPTIONS,
      value_handler: lambda {|value, ctx, vars| PSQLLoadOptions.parse(value) })
  params.add SQLFileParam.new('sql-file', 'PATH', 'SQL to insert rows from the work table to the target table.', optional: true)
  params.add DataSourceParam.new('sql', 'redshift-ds', 'Target data source.')
  params.add DataSourceParam.new('s3', 'ctl-ds', 'Manifest file data source.')
end

Instance Method Details

#bind(ctx, vars) ⇒ Object



121
122
123
# File 'lib/bricolage/streamingload/jobparams.rb', line 121

def bind(ctx, vars)
  @params['sql-file'].bind(ctx, vars) if @params['sql-file']
end