Skip to content

Multiple INSERT/UPDATE statements returns undefined method `dataset_id' for nil:NilClass #9617

@bfeigin

Description

@bfeigin

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS: OSX 11.2.1
  • Ruby version: ruby 2.6.3p62
  • Gem name and version: google-cloud-bigquery (1.16.0)

Steps to reproduce

  1. establish connection to bigquery
  2. Run query with multiple SELECT, INSERT or a single CREATE [OR REPLACE] PROCEDURE
  3. see error undefined method `dataset_id' for nil:NilClass

Code example

credentials = { ... }

multi_insert_statement = "INSERT into `sql-app-00000.ds1.test_set`(foo) values ('foo');
INSERT into `sql-app-00000.ds1.test_set`(foo) values ('foo');"
bigquery_client = Google::Cloud::Bigquery.new(credentials: credentials)
bigquery_client.query(multi_insert_statement)
> undefined method `dataset_id

Full backtrace

irb(main):030:0> client = Google::Cloud::Bigquery.new(credentials: credentials)
=> #<Google::Cloud::Bigquery::Project:0x0000... @service=Google::Cloud::Bigquery::Service(sql-app-XXXXX)>
irb(main):031:0> client.query statement
Traceback (most recent call last):
        1: from (irb):31
NoMethodError (undefined method `dataset_id' for nil:NilClass)

rescued error.backtrace:

/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/service.rb:500:in `rescue in execute'
/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/service.rb:493:in `execute'
/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/service.rb:354:in `job_query_results'
/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/query_job.rb:538:in `block in wait_until_done!'
/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/query_job.rb:537:in `loop'
/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/query_job.rb:537:in `wait_until_done!'
/usr/local/bundle/ruby/2.6.0/gems/google-cloud-bigquery-1.16.0/lib/google/cloud/bigquery/project.rb:769:in `query'

Traced with breakpoints

Tracing with breakpoints leads me to the source at

@gapi.configuration.query.destination_table.dataset_id

Called in
def data token: nil, max: nil, start: nil

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions