Class: RedshiftConnector::ExporterBuilder
- Inherits:
-
Object
- Object
- RedshiftConnector::ExporterBuilder
- Defined in:
- lib/redshift_connector/exporter_builder.rb
Instance Method Summary collapse
- #build_for_query(schema:, table:, bucket: nil, query:, txn_id: "#{Time.now.strftime('%Y%m%d_%H%M%S')}_#{$$}", filter: nil, enable_sort: false, logger: RedshiftConnector.logger, quiet: false) ⇒ Object
- #build_for_table(schema:, table:, columns:, bundle_params:, logger: RedshiftConnector.logger) ⇒ Object
- #build_for_table_delta(schema:, table:, condition:, columns:, bundle_params:, logger: RedshiftConnector.logger) ⇒ Object
-
#initialize(ds:, exporter_class:) ⇒ ExporterBuilder
constructor
A new instance of ExporterBuilder.
Constructor Details
#initialize(ds:, exporter_class:) ⇒ ExporterBuilder
Returns a new instance of ExporterBuilder.
6 7 8 9 |
# File 'lib/redshift_connector/exporter_builder.rb', line 6 def initialize(ds:, exporter_class:) @ds = ds @exporter_class = exporter_class end |
Instance Method Details
#build_for_query(schema:, table:, bucket: nil, query:, txn_id: "#{Time.now.strftime('%Y%m%d_%H%M%S')}_#{$$}", filter: nil, enable_sort: false, logger: RedshiftConnector.logger, quiet: false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/redshift_connector/exporter_builder.rb', line 21 def build_for_query( schema:, table:, bucket: nil, query:, txn_id: "#{Time.now.strftime('%Y%m%d_%H%M%S')}_#{$$}", filter: nil, enable_sort: false, logger: RedshiftConnector.logger, quiet: false ) logger = NullLogger.new if quiet bundle_params = DataFileBundleParams.new( bucket: bucket, schema: schema, table: table, txn_id: txn_id, filter: filter, logger: logger ) @exporter_class.new( ds: @ds, query: ArbitraryQuery.new(query), bundle_params: bundle_params, enable_sort: enable_sort, logger: logger ) end |
#build_for_table(schema:, table:, columns:, bundle_params:, logger: RedshiftConnector.logger) ⇒ Object
16 17 18 19 |
# File 'lib/redshift_connector/exporter_builder.rb', line 16 def build_for_table(schema:, table:, columns:, bundle_params:, logger: RedshiftConnector.logger) query = SelectAllQuery.new(schema: schema, table: table, columns: columns) @exporter_class.new(ds: @ds, query: query, bundle_params: bundle_params, logger: logger) end |
#build_for_table_delta(schema:, table:, condition:, columns:, bundle_params:, logger: RedshiftConnector.logger) ⇒ Object
11 12 13 14 |
# File 'lib/redshift_connector/exporter_builder.rb', line 11 def build_for_table_delta(schema:, table:, condition:, columns:, bundle_params:, logger: RedshiftConnector.logger) query = DeltaQuery.new(schema: schema, table: table, columns: columns, condition: condition) @exporter_class.new(ds: @ds, query: query, bundle_params: bundle_params, logger: logger) end |