Class: Boxcars::SQLActiveRecord

Inherits:
SQLBase show all
Defined in:
lib/boxcars/boxcar/sql_active_record.rb

Overview

A Boxcar that interprets a prompt and executes SQL code using Active Record to get answers

Constant Summary

Constants inherited from SQLBase

Boxcars::SQLBase::LOCKED_OUT_TABLES, Boxcars::SQLBase::SQLDESC

Instance Attribute Summary

Attributes inherited from SQLBase

#connection, #the_tables

Attributes inherited from EngineBoxcar

#engine, #prompt, #stop, #top_k

Attributes inherited from Boxcar

#description, #name, #parameters, #return_direct

Instance Method Summary collapse

Methods inherited from SQLBase

#prediction_additional

Methods inherited from EngineBoxcar

#apply, #call, #check_output_keys, #extract_code, #generate, #input_key, #input_keys, #output_key, #output_keys, #predict, #prediction_additional, #prediction_input, #prediction_variables

Methods inherited from Boxcar

#apply, assi, #call, #conduct, hist, #input_keys, #load, #output_keys, #run, #save, #schema, syst, user, #validate_inputs, #validate_outputs

Constructor Details

#initialize(connection: nil, tables: nil, except_tables: nil, **kwargs) ⇒ SQLActiveRecord

Returns a new instance of SQLActiveRecord.

Parameters:

  • connection (ActiveRecord::Connection) (defaults to: nil)

    The SQL connection to use for this boxcar.

  • tables (Array<String>) (defaults to: nil)

    The tables to use for this boxcar. Will use all if nil.

  • except_tables (Array<String>) (defaults to: nil)

    The tables to exclude from this boxcar. Will exclude none if nil.

  • kwargs (Hash)

    Any other keyword arguments to pass to the parent class. This can include :name, :description, :prompt, :top_k, :stop, and :engine



12
13
14
15
# File 'lib/boxcars/boxcar/sql_active_record.rb', line 12

def initialize(connection: nil, tables: nil, except_tables: nil, **kwargs)
  connection ||= ::ActiveRecord::Base.connection
  super
end