Class: Sequel::Impala::Dataset

Inherits:
Dataset
  • Object
show all
Includes:
DatasetMethods
Defined in:
lib/sequel/adapters/impala.rb

Constant Summary collapse

APOS =
"'".freeze
STRING_ESCAPES =
{
  "\\" => "\\\\".freeze,
  "'" => "\\'".freeze,
  "\n" => "\\n".freeze,
  "\r" => "\\r".freeze,
  "\0" => "\\0".freeze,
  "\b" => "\\b".freeze,
  "\04" => "\\Z".freeze,
 # Impala is supposed to support this, but using it
 # breaks things to the point of returning bad data.
 # If you don't do this, the tabs in the input
 # get converted to spaces, but that's better than the
 # alternative.
 # "\t" => "\\t".freeze,
}.freeze
STRING_ESCAPE_RE =

Impala is supposed to support this, but using it breaks things to the point of returning bad data. If you don’t do this, the tabs in the input get converted to spaces, but that’s better than the alternative. “t” => “\t”.freeze,

/(#{Regexp.union(STRING_ESCAPES.keys)})/

Constants included from DatasetMethods

Sequel::Impala::DatasetMethods::BACKTICK, Sequel::Impala::DatasetMethods::BOOL_FALSE, Sequel::Impala::DatasetMethods::BOOL_TRUE, Sequel::Impala::DatasetMethods::CONSTANT_LITERAL_MAP, Sequel::Impala::DatasetMethods::EXCEPT_SOURCE_COLUMN, Sequel::Impala::DatasetMethods::EXCEPT_STRATEGIES, Sequel::Impala::DatasetMethods::NOT, Sequel::Impala::DatasetMethods::PAREN_CLOSE, Sequel::Impala::DatasetMethods::PAREN_OPEN, Sequel::Impala::DatasetMethods::REGEXP, Sequel::Impala::DatasetMethods::SELECT_VALUES, Sequel::Impala::DatasetMethods::SPACE, Sequel::Impala::DatasetMethods::STRING_ESCAPE_REPLACE

Instance Method Summary collapse

Methods included from DatasetMethods

#complex_expression_sql_append, #constant_sql_append, #date_add_sql_append, #delete, #delete_sql, #empty?, #except, #except_strategy, #from, #insert_overwrite, #insert_supports_empty_values?, #intersect, #join_table, #supports_cte?, #supports_cte_in_subqueries?, #supports_derived_column_lists?, #supports_intersect_except_all?, #supports_is_true?, #supports_multiple_column_in?, #supports_regexp?, #supports_window_functions?, #to_parquet, #truncate_sql, #update, #update_sql, #with, #with_recursive

Instance Method Details

#fetch_rows(sql) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
# File 'lib/sequel/adapters/impala.rb', line 190

def fetch_rows(sql)
  execute(sql, @opts) do |cursor|
    self.columns = cursor.columns.map!{|c| output_identifier(c)}
    cursor.typecast_map['timestamp'] = db.method(:to_application_timestamp)
    cursor.each do |row|
      yield row
    end
  end

  self
end

#profile(profile_name = :default) ⇒ Object



202
203
204
# File 'lib/sequel/adapters/impala.rb', line 202

def profile(profile_name=:default)
  clone(:profile_name => profile_name)
end

#query_id(query_id_name = :default) ⇒ Object



206
207
208
# File 'lib/sequel/adapters/impala.rb', line 206

def query_id(query_id_name=:default)
  clone(:query_id_name => query_id_name)
end