Module: RedshiftConnector::Exporter

Defined in:
lib/redshift_connector/exporter.rb

Class Method Summary collapse

Class Method Details

.builderObject



13
14
15
# File 'lib/redshift_connector/exporter.rb', line 13

def Exporter.builder
  default_data_source.exporter_builder
end

.default_data_sourceObject



9
10
11
# File 'lib/redshift_connector/exporter.rb', line 9

def Exporter.default_data_source
  @default_data_source or raise ArgumentError, "RedshiftConnector::Exporter.default_data_source was not set"
end

.default_data_source=(ds) ⇒ Object



5
6
7
# File 'lib/redshift_connector/exporter.rb', line 5

def Exporter.default_data_source=(ds)
  @default_data_source = ds
end

.for_query(**params) ⇒ Object



25
26
27
# File 'lib/redshift_connector/exporter.rb', line 25

def Exporter.for_query(**params)
  builder.build_for_query(**params)
end

.for_table(**params) ⇒ Object



21
22
23
# File 'lib/redshift_connector/exporter.rb', line 21

def Exporter.for_table(**params)
  builder.build_for_table(**params)
end

.for_table_delta(**params) ⇒ Object



17
18
19
# File 'lib/redshift_connector/exporter.rb', line 17

def Exporter.for_table_delta(**params)
  builder.build_for_table_delta(**params)
end

.foreach(**params, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/redshift_connector/exporter.rb', line 29

def Exporter.foreach(**params, &block)
  exporter = for_query(**params)
  bundle = exporter.execute
  begin
    bundle.each_row(&block)
  ensure
    bundle.clear if bundle.respond_to?(:clear)
  end
end