diff --git a/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts b/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts index 3059d5699e..6e2dd9a541 100644 --- a/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts +++ b/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts @@ -13,12 +13,13 @@ export class GoogleBigQuery extends VersionedNodeType { group: ['input'], subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Consume Google BigQuery API', - defaultVersion: 2, + defaultVersion: 2.1, }; const nodeVersions: IVersionedNodeType['nodeVersions'] = { 1: new GoogleBigQueryV1(baseDescription), 2: new GoogleBigQueryV2(baseDescription), + 2.1: new GoogleBigQueryV2(baseDescription), }; super(nodeVersions, baseDescription); diff --git a/packages/nodes-base/nodes/Google/BigQuery/test/v2/utils/utils.test.ts b/packages/nodes-base/nodes/Google/BigQuery/test/v2/utils/utils.test.ts index 89a246fb72..4548310140 100644 --- a/packages/nodes-base/nodes/Google/BigQuery/test/v2/utils/utils.test.ts +++ b/packages/nodes-base/nodes/Google/BigQuery/test/v2/utils/utils.test.ts @@ -1,11 +1,14 @@ -import type { IDataObject, IExecuteFunctions } from 'n8n-workflow'; +import type { IDataObject, IExecuteFunctions, INode } from 'n8n-workflow'; import { constructExecutionMetaData } from 'n8n-core'; import { mock } from 'jest-mock-extended'; import { prepareOutput } from '../../../v2/helpers/utils'; describe('Google BigQuery v2 Utils', () => { it('should prepareOutput', () => { - const thisArg = mock({ helpers: mock({ constructExecutionMetaData }) }); + const thisArg = mock({ + getNode: () => ({ typeVersion: 2.1 }) as INode, + helpers: mock({ constructExecutionMetaData }), + }); const response: IDataObject = { kind: 'bigquery#getQueryResultsResponse', etag: 'e_tag', diff --git a/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts b/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts index 25da3dc09e..d6b67b1df0 100644 --- a/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts +++ b/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts @@ -249,10 +249,16 @@ export async function execute(this: IExecuteFunctions): Promise { - return getFieldValue(schema[index], repeatedField as unknown as IDataObject); + return getFieldValue( + schema[index], + repeatedField as unknown as IDataObject, + parseTimestamps, + ); }, ); } @@ -68,12 +81,18 @@ export function prepareOutput( responseData = response; } else { const { rows, schema } = response; + const parseTimestamps = this.getNode().typeVersion >= 2.1; if (rows !== undefined && schema !== undefined) { const fields = (schema as TableSchema).fields; responseData = rows; - responseData = simplify(responseData as TableRawData[], fields, includeSchema); + responseData = simplify( + responseData as TableRawData[], + fields, + includeSchema, + parseTimestamps, + ); } else if (schema && includeSchema) { responseData = { success: true, _schema: schema }; } else {