Class: RedshiftConnector::QueueryExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/redshift_connector/queuery_exporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ds:, query:, bundle_params: nil, enable_sort: false, logger: RedshiftConnector.logger) ⇒ QueueryExporter



5
6
7
8
9
10
11
12
# File 'lib/redshift_connector/queuery_exporter.rb', line 5

def initialize(ds:, query:, bundle_params: nil, enable_sort: false, logger: RedshiftConnector.logger)
  @ds = ds
  @query = query
  @bundle_params = bundle_params
  @bundle = nil
  @enable_sort = enable_sort
  @logger = logger
end

Instance Attribute Details

#bundleObject (readonly)

Returns the value of attribute bundle.



16
17
18
# File 'lib/redshift_connector/queuery_exporter.rb', line 16

def bundle
  @bundle
end

#bundle_paramsObject (readonly)

Returns the value of attribute bundle_params.



15
16
17
# File 'lib/redshift_connector/queuery_exporter.rb', line 15

def bundle_params
  @bundle_params
end

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

#queryObject (readonly)

Returns the value of attribute query.



14
15
16
# File 'lib/redshift_connector/queuery_exporter.rb', line 14

def query
  @query
end

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
# File 'lib/redshift_connector/queuery_exporter.rb', line 19

def execute
  @logger.info "EXPORT #{@query.description} -> (Queuery S3 tmp)"
  stmt = @query.to_sql
  @logger.info "[SQL/Queuery] #{stmt.strip}"
  # FIXME: support enable_sort
  # FIXME: pass bundle_params?
  @bundle = @ds.execute_query(stmt)
  @bundle
end