Skip to content

Commit

Permalink
fix(googleBigQuery Node): fix empty response when creating records (n…
Browse files Browse the repository at this point in the history
  • Loading branch information
Joffcom authored Sep 13, 2022
1 parent af34d5e commit 6413a45
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,21 @@ export class GoogleBigQuery implements INodeType {
`/v2/projects/${projectId}/datasets/${datasetId}/tables/${tableId}/insertAll`,
body,
);
returnData.push(responseData);

const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: 0 } },
);
returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
} else {
throw new NodeApiError(this.getNode(), error);
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: 0 } },
);
returnData.push(...executionErrorData);
}
throw new NodeApiError(this.getNode(), error, { itemIndex: 0 });
}
} else if (operation === 'getAll') {
// ----------------------------------
Expand Down Expand Up @@ -251,7 +259,10 @@ export class GoogleBigQuery implements INodeType {
);
}

responseData = simple ? simplify(responseData.rows, fields) : responseData.rows;
if (!returnAll) {
responseData = responseData.rows;
}
responseData = simple ? simplify(responseData, fields) : responseData;

const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
Expand Down

0 comments on commit 6413a45

Please sign in to comment.