Module: ActiveRecord::Extra::BQ

Included in:
Base
Defined in:
lib/active_record/extra/bq.rb

Instance Method Summary collapse

Instance Method Details

#bq_append(options = {}, &block) ⇒ Object

Can provide a CSV via the block Or specify a filename or URI



10
11
12
13
14
15
16
17
# File 'lib/active_record/extra/bq.rb', line 10

def bq_append(options = {}, &block)
  if block_given?
    headers = columns.map(&:name)
    # TODO: Validate row length (AND types?)
    csv     = CSV.generate { |csv| yield(csv) }
    data_part(csv)
  end
end

#dataset_idObject



24
25
26
# File 'lib/active_record/extra/bq.rb', line 24

def dataset_id

end

#table_idObject

TODO: split these on table name



20
21
22
# File 'lib/active_record/extra/bq.rb', line 20

def table_id

end