Module: BigQuery::Client::Jobs

Included in:
BigQuery::Client
Defined in:
lib/big_query/client/jobs.rb

Instance Method Summary collapse

Instance Method Details

#get_query_results(id, opts = {}) ⇒ Hash

Gets the results of a given job

Parameters:

  • id (Integer)

    job id to fetch

  • options (Hash)

    bigquery opts accepted

Returns:

  • (Hash)

    json api response



32
33
34
35
36
37
# File 'lib/big_query/client/jobs.rb', line 32

def get_query_results(id, opts = {})
  opts['jobId'] ||= id

  api(api_method: @bq.jobs.get_query_results,
      parameters: opts)
end

#insert_job(opts) ⇒ Hash

Insert a job

Parameters:

  • options (Hash)

    hash of job options

Returns:

  • (Hash)

    json api response



43
44
45
46
# File 'lib/big_query/client/jobs.rb', line 43

def insert_job(opts)
  api(api_method: @bq.jobs.insert,
      body_object: {configuration: opts})
end

#job(id, opts = {}) ⇒ Hash

Fetches a bigquery job by id

Parameters:

  • id (Integer)

    job id to fetch

  • options (Hash)

    bigquery opts accepted

Returns:

  • (Hash)

    json api response



11
12
13
14
15
16
# File 'lib/big_query/client/jobs.rb', line 11

def job(id, opts = {})
  opts['jobId'] ||= id

  api(api_method: @bq.jobs.get,
      parameters: opts)
end

#jobs(opts = {}) ⇒ Hash

lists all the jobs

Parameters:

  • options (Hash)

    bigquery opts accepted

Returns:

  • (Hash)

    json api response



22
23
24
25
# File 'lib/big_query/client/jobs.rb', line 22

def jobs(opts = {})
  api(api_method: @bq.jobs.list,
      parameters: opts)
end