Module: BigQuery::Jobs

Included in:
Client
Defined in:
lib/bigquery-client/jobs.rb,
lib/bigquery-client/run_query.rb

Defined Under Namespace

Classes: RunQuery

Instance Method Summary collapse

Instance Method Details

#fetch_job(id, options = {}) ⇒ Object



43
44
45
46
47
48
# File 'lib/bigquery-client/jobs.rb', line 43

def fetch_job(id, options = {})
  access_api(
    api_method: bigquery.jobs.get,
    parameters: { jobId: id }.merge(options)
  )
end

#find_all(query, options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/bigquery-client/jobs.rb', line 9

def find_all(query, options = {})
  raise NotImplementedError
end

#jobs(options = {}) ⇒ Object



36
37
38
39
40
41
# File 'lib/bigquery-client/jobs.rb', line 36

def jobs(options = {})
  access_api(
    api_method: bigquery.jobs.list,
    parameters: options
  )
end

#jobs_query(query, options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/bigquery-client/jobs.rb', line 17

def jobs_query(query, options = {})
  default = { query: query, timeoutMs: 600_000 }
  access_api(
    api_method: bigquery.jobs.query,
    body_object: default.merge(options)
  )
end

#load(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/bigquery-client/jobs.rb', line 25

def load(options = {})
  access_api(
    api_method: bigquery.jobs.insert,
    body_object: {
      configuration: {
        load: options
      }
    }
  )
end

#query(query, options = {}) ⇒ Object



13
14
15
# File 'lib/bigquery-client/jobs.rb', line 13

def query(query, options = {})
  RunQuery.new(self, query, options).call
end

#query_results(id, options = {}) ⇒ Object



50
51
52
53
54
55
# File 'lib/bigquery-client/jobs.rb', line 50

def query_results(id, options = {})
  access_api(
    api_method: bigquery.jobs.get_query_results,
    parameters: { jobId: id }.merge(options)
  )
end

#sql(query, options = {}) ⇒ Object



5
6
7
# File 'lib/bigquery-client/jobs.rb', line 5

def sql(query, options = {})
  query(query, options).to_a
end