fix(googleBigQuery Node): fix empty response when creating records (#4056)

This commit is contained in:
Jonathan Bennetts 2022-09-13 08:55:58 +01:00 committed by GitHub
parent c4fd8ce28b
commit 9f92a4d681
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,13 +190,21 @@ export class GoogleBigQuery implements INodeType {
`/v2/projects/${projectId}/datasets/${datasetId}/tables/${tableId}/insertAll`, `/v2/projects/${projectId}/datasets/${datasetId}/tables/${tableId}/insertAll`,
body, body,
); );
returnData.push(responseData);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: 0 } },
);
returnData.push(...executionData);
} catch (error) { } catch (error) {
if (this.continueOnFail()) { if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } }); const executionErrorData = this.helpers.constructExecutionMetaData(
} else { this.helpers.returnJsonArray({ error: error.message }),
throw new NodeApiError(this.getNode(), error); { itemData: { item: 0 } },
);
returnData.push(...executionErrorData);
} }
throw new NodeApiError(this.getNode(), error, { itemIndex: 0 });
} }
} else if (operation === 'getAll') { } else if (operation === 'getAll') {
// ---------------------------------- // ----------------------------------
@ -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( const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData), this.helpers.returnJsonArray(responseData),