Module: BigQuery::Tabledata

Included in:
Client
Defined in:
lib/bigquery-client/tabledata.rb

Instance Method Summary collapse

Instance Method Details

#insert(table, arg) ⇒ Object Also known as: insert_all



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bigquery-client/tabledata.rb', line 5

def insert(table, arg)
  rows = arg.is_a?(Array) ? arg : [arg]
  access_api(
    api_method: bigquery.tabledata.insert_all,
    parameters: {
      tableId: table
    },
    body_object: {
      rows: rows.map { |row| { json: row } }
    }
  )
end

#list_tabledata(table) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/bigquery-client/tabledata.rb', line 19

def list_tabledata(table)
  access_api(
    api_method: bigquery.tabledata.list,
    parameters: {
      tableId: table
    }
  )
end