Module: Analytic::Utility::ClassMethods

Defined in:
app/models/analytic/utility.rb

Overview

Class-level methods mixed into the including class via ActiveSupport::Concern.

Instance Method Summary collapse

Instance Method Details

#execute(sql) ⇒ Array<String>

Executes raw SQL against the default connection.

Parameters:

  • sql (String)

    SQL to run

Returns:

  • (Array<String>)

    status messages (empty on success)



19
20
21
22
23
24
25
26
27
# File 'app/models/analytic/utility.rb', line 19

def execute(sql)
  status = []
  begin
    ActiveRecord::Base.lease_connection.execute(sql)
  rescue StandardError => e
    status << "Fact Table could not be updated, message : #{e}"
  end
  status
end