-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
🚨This issue needs some love.This issue needs some love.triage meI really want to be triaged.I really want to be triaged.
Description
I have tried created a table using the api successfully with 2 fields as nullable.
However I was unable to insertRowsAsStream as using code below
const params = {
datasetId: "Event",
tableId: "navigation9",
projectId: "xxxx-9a8cd",
rows: [
{ Name: "test0", Age: 0 },
{ Name: "test2", Age: 1 },
{ Name: "test3", Age: 2 },
{ Name: "test4", Age: 3 },
{ Name: "test5", Age: 0 }
]
}
insertRowsAsStream(params)
const insertRowsAsStream = ({ datasetId, tableId, rows, projectId }) => new Promise((resolve, reject) => {
const BigQuery = require('@google-cloud/bigquery');
// Instantiates a client
const bigquery = BigQuery({
projectId: projectId
});
console.log('insertRowAsStream rows = ', JSON.stringify(rows, null, 2))
// Inserts data into a table
bigquery
.dataset(datasetId)
.table(tableId)
.insert(rows)
.then((insertErrors) => {
console.log('Inserted:');
rows.forEach((row) => console.log(row));
if (insertErrors && insertErrors.length > 0) {
console.log('Insert errors:');
insertErrors.forEach((err) => console.error(err));
reject('ERROR: ' + JSON.stringify(insertErrors, null, 2));
} else {
resolve('Sucessfully Inserted')
}
})
.catch((err) => {
console.error('ERROR:', err);
reject('ERROR:' + err);
});
// [END bigquery_insert_stream]
});
The log result i got is not very helpful
Inserted:
{ Name: 'test0', Age: 0 }
{ Name: 'test2', Age: 1 }
{ Name: 'test3', Age: 2 }
{ Name: 'test4', Age: 3 }
{ Name: 'test5', Age: 0 }
Insert errors:
{ kind: 'bigquery#tableDataInsertAllResponse' }
Here is do not know what causing the error
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.triage meI really want to be triaged.I really want to be triaged.