Currently, I am successfully importing data from Firebase to BigQuery using the onWrite event and the table.insert function. However, I am facing an issue when trying to update data in BigQuery on the onUpdate event as the table.update function is not available or working. Can anyone suggest an alternative solution for updating data in this scenario? Below is the code snippet I have been using:
exports.updatetobigquery =
functions.database.ref('/mn_users/{userId}/').onUpdate(event => {
const dataset =
bigquery.dataset('KHUSHUApp');//functions.config().bigquery.datasetname);
const table =
dataset.table('mn_users');//functions.config().bigquery.tablename);
console.log('Uppercasing', event.data.val());
return table.update({
'id': event.data.key,
'name': event.data.val().name,
'email': event.data.val().email
});
});