Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions bigquery/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,24 @@ function insertRowsAsStream (datasetId, tableId, rows, projectId) {

// Inserts data into a table
bigquery
.dataset(datasetId)
.table(tableId)
.insert(rows)
.then((insertErrors) => {
console.log('Inserted:');
.dataset(datasetId)
.table(tableId)
.insert(rows)
.then((response) => {
const insertErrors = response.insertErrors;
if (insertErrors && insertErrors.length > 0) {
console.log('start insert errors');
insertErrors.forEach((err) => console.error(JSON.stringify(err, null, 2)));
console.log('end insert errors');
} else {
console.log('inserted:');
rows.forEach((row) => console.log(row));

if (insertErrors && insertErrors.length > 0) {
console.log('Insert errors:');
insertErrors.forEach((err) => console.error(err));
}
})
.catch((err) => {
console.error('ERROR:', err);
});
console.log('end inserted');
}
})
.catch((err) => {
console.error('Exception:', JSON.stringify(err, null, 2));
});
// [END bigquery_insert_stream]
}

Expand Down