Class: Sequel::Snowflake::Dataset
- Inherits:
-
ODBC::Dataset
- Object
- ODBC::Dataset
- Sequel::Snowflake::Dataset
- Includes:
- DatasetMethods
- Defined in:
- lib/sequel/adapters/snowflake.rb
Overview
A custom Sequel Dataset class crafted specifically to handle Snowflake results.
Instance Method Summary collapse
- #fetch_rows(sql) ⇒ Object
-
#supports_merge? ⇒ Boolean
Whether the MERGE statement is supported: github.com/jeremyevans/sequel/blob/master/lib/sequel/dataset/features.rb#L129 Snowflake reference: docs.snowflake.com/en/sql-reference/sql/merge.
Methods included from DatasetMethods
Instance Method Details
#fetch_rows(sql) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sequel/adapters/snowflake.rb', line 26 def fetch_rows(sql) execute(sql) do |s| i = -1 cols = s.columns(true).map{|c| [output_identifier(c.name), c.type, c.scale, i+=1]} columns = cols.map{|c| c[0]} self.columns = columns s.each do |row| hash = {} cols.each{|n,type,scale,j| hash[n] = convert_snowflake_value(row[j], type, scale)} yield hash end end self end |
#supports_merge? ⇒ Boolean
Whether the MERGE statement is supported: github.com/jeremyevans/sequel/blob/master/lib/sequel/dataset/features.rb#L129 Snowflake reference: docs.snowflake.com/en/sql-reference/sql/merge
44 45 46 |
# File 'lib/sequel/adapters/snowflake.rb', line 44 def supports_merge? true end |