Class: RedshiftConnector::SelectAllQuery
- Inherits:
-
Object
- Object
- RedshiftConnector::SelectAllQuery
- Defined in:
- lib/redshift_connector/query.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(schema:, table:, columns:) ⇒ SelectAllQuery
constructor
A new instance of SelectAllQuery.
- #table_spec ⇒ Object
- #to_sql ⇒ Object
Constructor Details
#initialize(schema:, table:, columns:) ⇒ SelectAllQuery
Returns a new instance of SelectAllQuery.
26 27 28 29 30 |
# File 'lib/redshift_connector/query.rb', line 26 def initialize(schema:, table:, columns:) @schema = schema @table = table @columns = columns end |
Instance Method Details
#description ⇒ Object
36 37 38 |
# File 'lib/redshift_connector/query.rb', line 36 def description "#{table_spec} (#{@columns.join(', ')})" end |
#table_spec ⇒ Object
32 33 34 |
# File 'lib/redshift_connector/query.rb', line 32 def table_spec "#{@schema}.#{@table}" end |
#to_sql ⇒ Object
40 41 42 43 |
# File 'lib/redshift_connector/query.rb', line 40 def to_sql "select #{@columns.map {|c| %Q("#{c}") }.join(', ')}" \ + " from #{table_spec}" end |