class RedshiftConnector::DeltaQuery
Public Class Methods
new(schema:, table:, columns:, condition: nil)
click to toggle source
# File lib/redshift_connector/query.rb, line 3 def initialize(schema:, table:, columns:, condition: nil) @schema = schema @table = table @columns = columns @condition = condition end
Public Instance Methods
description()
click to toggle source
# File lib/redshift_connector/query.rb, line 14 def description "#{table_spec} (#{@columns.join(', ')}) where (#{@condition})" end
table_spec()
click to toggle source
# File lib/redshift_connector/query.rb, line 10 def table_spec "#{@schema}.#{@table}" end
to_sql()
click to toggle source
# File lib/redshift_connector/query.rb, line 18 def to_sql "select #{@columns.map {|c| %Q("#{c}") }.join(', ')}" \ + " from #{table_spec}" \ + (@condition ? " where #{@condition}" : '') end