Class: Bricolage::TDDataSource

Inherits:
DataSource show all
Includes:
CommandUtils
Defined in:
lib/bricolage/tddatasource.rb

Constant Summary

Constants inherited from DataSource

DataSource::CLASSES

Instance Attribute Summary

Attributes inherited from DataSource

#context, #logger, #name

Instance Method Summary collapse

Methods included from CommandUtils

#command, #make_tmpfile, #new_tmpfile_path, #retrieve_last_match_from_stderr

Methods inherited from DataSource

get_class, new_for_type, #open, #open_for_batch, #redshift_loader_source?

Constructor Details

#initialize(database: nil, username: nil, apikey: nil, td: 'td', priority: -2)) ⇒ TDDataSource



13
14
15
16
17
18
# File 'lib/bricolage/tddatasource.rb', line 13

def initialize(database: nil, username: nil, apikey: nil, td: 'td', priority: -2)
  @database = database
  @apikey = apikey
  @td = td
  @priority = priority
end

Instance Method Details

#delete_command_args(*args) ⇒ Object



28
29
30
# File 'lib/bricolage/tddatasource.rb', line 28

def delete_command_args(*args)
  [@td, "--apikey=#{@apikey}", "table:partial_delete", @database, *args, "--wait"]
end

#exec(*args) ⇒ Object



32
33
34
# File 'lib/bricolage/tddatasource.rb', line 32

def exec(*args)
  JobResult.for_process_status(command(*args))
end

#new_taskObject



20
21
22
# File 'lib/bricolage/tddatasource.rb', line 20

def new_task
  TDTask.new(self)
end

#query_command_args(*args) ⇒ Object



24
25
26
# File 'lib/bricolage/tddatasource.rb', line 24

def query_command_args(*args)
  [@td, "--apikey=#{@apikey}", "query", "--database=#{@database}", "--wait"] + args
end