The error from the insert operation
if any error was encountered, otherwise nil.
Returns
(Error, nil) โ the current value of error
#error?
deferror?()->Boolean
Checks if an error is present, meaning that the insert operation
encountered an error. Use #error to access the error. For
row-level errors, see #success? and #insert_errors.
Returns
(Boolean) โ true when an error is present, false
otherwise.
#error_count
deferror_count()->Integer,nil
The count of errors for rows that were not inserted.
Returns
(Integer, nil) โ The number of errors, or nil if the
insert operation encountered an error.
#error_rows
deferror_rows()->Array<Hash>,nil
The rows that were not inserted.
Returns
(Array<Hash>, nil) โ An array of hash objects containing the
row data, or nil if the insert operation encountered an error.
#errors_for
deferrors_for(row)->Array<Hash>,nil
Returns the error hashes for a row that was not inserted. Each
error hash contains the following keys: reason, location,
debugInfo, and message.
Parameter
row (Hash, nil) โ A hash containing the data for a row.
Returns
(Array<Hash>, nil) โ An array of error hashes, nil if no
errors are found in the response for the row, or nil if the
insert operation encountered an error.
#index_for
defindex_for(row)->Integer,nil
Returns the index for a row that was not inserted.
Parameter
row (Hash, nil) โ A hash containing the data for a row.
Returns
(Integer, nil) โ An error object, nil if no error is
found in the response for the row, or nil if the insert
operation encountered an error.
#insert_count
definsert_count()->Integer,nil
The count of rows in the response, minus the count of errors for
rows that were not inserted.
Returns
(Integer, nil) โ The number of rows inserted, or nil if
the insert operation encountered an error.
#insert_error_for
definsert_error_for(row)->InsertError,nil
Returns the error object for a row that was not inserted.
Parameter
row (Hash) โ A hash containing the data for a row.
Returns
(InsertError, nil) โ An error object, nil if no error is
found in the response for the row, or nil if the insert
operation encountered an error.
#insert_errors
definsert_errors()->Array<InsertError>,nil
The error objects for rows that were not inserted.
Returns
(Array<InsertError>, nil) โ An array containing error
objects, or nil if the insert operation encountered an error.
Checks if the error count for row-level errors is zero, meaning
that all of the rows were inserted. Use #insert_errors to access
the row-level errors. To check for and access any operation-level
error, use #error? and #error.
Returns
(Boolean, nil) โ true when the error count is zero,
false when the error count is positive, or nil if the insert
operation encountered an error.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["Version 1.45.0keyboard_arrow_down\n\n- [1.57.0 (latest)](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.56.0](/ruby/docs/reference/google-cloud-bigquery/1.56.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.55.0](/ruby/docs/reference/google-cloud-bigquery/1.55.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.54.0](/ruby/docs/reference/google-cloud-bigquery/1.54.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.53.0](/ruby/docs/reference/google-cloud-bigquery/1.53.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.52.1](/ruby/docs/reference/google-cloud-bigquery/1.52.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.51.1](/ruby/docs/reference/google-cloud-bigquery/1.51.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.50.0](/ruby/docs/reference/google-cloud-bigquery/1.50.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.49.1](/ruby/docs/reference/google-cloud-bigquery/1.49.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.48.1](/ruby/docs/reference/google-cloud-bigquery/1.48.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.47.0](/ruby/docs/reference/google-cloud-bigquery/1.47.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.46.1](/ruby/docs/reference/google-cloud-bigquery/1.46.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.45.0](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.44.2](/ruby/docs/reference/google-cloud-bigquery/1.44.2/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.43.1](/ruby/docs/reference/google-cloud-bigquery/1.43.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.42.0](/ruby/docs/reference/google-cloud-bigquery/1.42.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.41.0](/ruby/docs/reference/google-cloud-bigquery/1.41.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.40.0](/ruby/docs/reference/google-cloud-bigquery/1.40.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.39.0](/ruby/docs/reference/google-cloud-bigquery/1.39.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result)\n- [1.38.1](/ruby/docs/reference/google-cloud-bigquery/1.38.1/Google-Cloud-Bigquery-Table-AsyncInserter-Result) \nReference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::Table::AsyncInserter::Result.\n\nAsyncInserter::Result\n\n\n\u003cbr /\u003e\n\nRepresents the result from BigQuery, including any error\nencountered, when data is asynchronously inserted into a table for\nnear-immediate querying. See [Dataset#insert_async](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Dataset#Google__Cloud__Bigquery__Dataset_insert_async_instance_ \"Google::Cloud::Bigquery::Dataset#insert_async (method)\") and\n[Google::Cloud::Bigquery::Table#insert_async](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table#Google__Cloud__Bigquery__Table_insert_async_instance_ \"Google::Cloud::Bigquery::Table#insert_async (method)\"). \n\nInherits\n\n- Object\n\nExample \n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nbigquery = Google::Cloud::Bigquery.new\ndataset = bigquery.dataset \"my_dataset\"\ntable = dataset.table \"my_table\"\ninserter = table.insert_async do |result|\n if result.error?\n log_error result.error\n else\n log_insert \"inserted #{result.insert_count} rows \" \\\n \"with #{result.error_count} errors\"\n end\nend\n\nrows = [\n { \"first_name\" =\u003e \"Alice\", \"age\" =\u003e 21 },\n { \"first_name\" =\u003e \"Bob\", \"age\" =\u003e 22 }\n]\ninserter.insert rows\n\ninserter.stop.wait!\n```\n\nMethods\n\n#error \n\n def error() -\u003e Error, nil\n\nThe error from the insert operation\nif any error was encountered, otherwise `nil`. \n**Returns**\n\n- (Error, nil) --- the current value of error\n\n#error? \n\n def error?() -\u003e Boolean\n\nChecks if an error is present, meaning that the insert operation\nencountered an error. Use [#error](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result#Google__Cloud__Bigquery__Table__AsyncInserter__Result_error_instance_ \"Google::Cloud::Bigquery::Table::AsyncInserter::Result#error (method)\") to access the error. For\nrow-level errors, see [#success?](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result#Google__Cloud__Bigquery__Table__AsyncInserter__Result_success__instance_ \"Google::Cloud::Bigquery::Table::AsyncInserter::Result#success? (method)\") and [#insert_errors](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result#Google__Cloud__Bigquery__Table__AsyncInserter__Result_insert_errors_instance_ \"Google::Cloud::Bigquery::Table::AsyncInserter::Result#insert_errors (method)\"). \n**Returns**\n\n- (Boolean) --- `true` when an error is present, `false` otherwise.\n\n#error_count \n\n def error_count() -\u003e Integer, nil\n\nThe count of errors for rows that were not inserted. \n**Returns**\n\n- (Integer, nil) --- The number of errors, or `nil` if the insert operation encountered an error.\n\n#error_rows \n\n def error_rows() -\u003e Array\u003cHash\u003e, nil\n\nThe rows that were not inserted. \n**Returns**\n\n- (Array\\\u003cHash\\\u003e, nil) --- An array of hash objects containing the row data, or `nil` if the insert operation encountered an error.\n\n#errors_for \n\n def errors_for(row) -\u003e Array\u003cHash\u003e, nil\n\nReturns the error hashes for a row that was not inserted. Each\nerror hash contains the following keys: `reason`, `location`,\n`debugInfo`, and `message`. \n**Parameter**\n\n- **row** (Hash, nil) --- A hash containing the data for a row. \n**Returns**\n\n- (Array\\\u003cHash\\\u003e, nil) --- An array of error hashes, `nil` if no errors are found in the response for the row, or `nil` if the insert operation encountered an error.\n\n#index_for \n\n def index_for(row) -\u003e Integer, nil\n\nReturns the index for a row that was not inserted. \n**Parameter**\n\n- **row** (Hash, nil) --- A hash containing the data for a row. \n**Returns**\n\n- (Integer, nil) --- An error object, `nil` if no error is found in the response for the row, or `nil` if the insert operation encountered an error.\n\n#insert_count \n\n def insert_count() -\u003e Integer, nil\n\nThe count of rows in the response, minus the count of errors for\nrows that were not inserted. \n**Returns**\n\n- (Integer, nil) --- The number of rows inserted, or `nil` if the insert operation encountered an error.\n\n#insert_error_for \n\n def insert_error_for(row) -\u003e InsertError, nil\n\nReturns the error object for a row that was not inserted. \n**Parameter**\n\n- **row** (Hash) --- A hash containing the data for a row. \n**Returns**\n\n- ([InsertError](./Google-Cloud-Bigquery-InsertResponse-InsertError), nil) --- An error object, `nil` if no error is found in the response for the row, or `nil` if the insert operation encountered an error.\n\n#insert_errors \n\n def insert_errors() -\u003e Array\u003cInsertError\u003e, nil\n\nThe error objects for rows that were not inserted. \n**Returns**\n\n- (Array\\\u003c[InsertError](./Google-Cloud-Bigquery-InsertResponse-InsertError)\\\u003e, nil) --- An array containing error objects, or `nil` if the insert operation encountered an error.\n\n#insert_response \n\n def insert_response() -\u003e Google::Cloud::Bigquery::InsertResponse, nil\n\nThe response from the insert operation if no\nerror was encountered, or `nil` if the insert operation\nencountered an error. \n**Returns**\n\n- ([Google::Cloud::Bigquery::InsertResponse](./Google-Cloud-Bigquery-InsertResponse), nil) --- the current value of insert_response\n\n#success? \n\n def success?() -\u003e Boolean, nil\n\nChecks if the error count for row-level errors is zero, meaning\nthat all of the rows were inserted. Use [#insert_errors](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result#Google__Cloud__Bigquery__Table__AsyncInserter__Result_insert_errors_instance_ \"Google::Cloud::Bigquery::Table::AsyncInserter::Result#insert_errors (method)\") to access\nthe row-level errors. To check for and access any operation-level\nerror, use [#error?](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result#Google__Cloud__Bigquery__Table__AsyncInserter__Result_error__instance_ \"Google::Cloud::Bigquery::Table::AsyncInserter::Result#error? (method)\") and [#error](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Table-AsyncInserter-Result#Google__Cloud__Bigquery__Table__AsyncInserter__Result_error_instance_ \"Google::Cloud::Bigquery::Table::AsyncInserter::Result#error (method)\"). \n**Returns**\n\n- (Boolean, nil) --- `true` when the error count is zero, `false` when the error count is positive, or `nil` if the insert operation encountered an error."]]