2023-07-12 02:15:38 -07:00
|
|
|
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
feat(Google BigQuery Node): Node improvements (#4877)
* :zap: setup
* :zap: finished v2 setup
* :zap: fix return all, fix simplify with nested schema
* :zap: fix for external tables, updated scopes
* :zap: query operation
* :zap: linter fixes
* :zap: fixed not processed errors when inserting, move main loop to execute function to allow bulk request
* :zap: customizible batch size when inserting, improoved errors
* :zap: options for mapping input
* :zap: fix for inserting RECORD type
* :zap: updated simplify logic
* :zap: fix for return with selected fields
* :zap: option to return table schema
* :zap: linter fixes
* :zap: fix imports
* :zap: query resource and fixes, rlc for projects
* :zap: removed simplify, added raw output option
* :zap: rlc for tables and datasets, no urls option
* :zap: updated hints and description of query parameter, fix getMany VIEW, multioptions fo fields
* :zap: added case when rows are empty
* :zap: linter fixes
* :zap: UI update, one resource
* :zap: fix for output with field named json
* :zap: using jobs instead queries
* :zap: added error message
* :zap: search for RLCs, fixes
* :zap: json processing
* :zap: removed getAll operation
* :zap: executeQuery update
* :zap: unit test
* :zap: tests setup, fixes
* :zap: tests
* Remove script for checking unused loadOptions
---------
Co-authored-by: agobrech <ael.gobrecht@gmail.com>
2023-04-19 05:55:01 -07:00
|
|
|
import { NodeOperationError } from 'n8n-workflow';
|
|
|
|
import type { GoogleBigQuery } from './node.type';
|
|
|
|
|
|
|
|
import * as record from './database/Database.resource';
|
|
|
|
|
|
|
|
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
|
|
const resource = this.getNodeParameter<GoogleBigQuery>('resource', 0);
|
|
|
|
const operation = this.getNodeParameter('operation', 0);
|
|
|
|
|
|
|
|
let returnData: INodeExecutionData[] = [];
|
|
|
|
|
|
|
|
const googleBigQuery = {
|
|
|
|
resource,
|
|
|
|
operation,
|
|
|
|
} as GoogleBigQuery;
|
|
|
|
|
|
|
|
switch (googleBigQuery.resource) {
|
|
|
|
case 'database':
|
|
|
|
returnData = await record[googleBigQuery.operation].execute.call(this);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known`);
|
|
|
|
}
|
|
|
|
|
2023-09-05 03:59:02 -07:00
|
|
|
return [returnData];
|
feat(Google BigQuery Node): Node improvements (#4877)
* :zap: setup
* :zap: finished v2 setup
* :zap: fix return all, fix simplify with nested schema
* :zap: fix for external tables, updated scopes
* :zap: query operation
* :zap: linter fixes
* :zap: fixed not processed errors when inserting, move main loop to execute function to allow bulk request
* :zap: customizible batch size when inserting, improoved errors
* :zap: options for mapping input
* :zap: fix for inserting RECORD type
* :zap: updated simplify logic
* :zap: fix for return with selected fields
* :zap: option to return table schema
* :zap: linter fixes
* :zap: fix imports
* :zap: query resource and fixes, rlc for projects
* :zap: removed simplify, added raw output option
* :zap: rlc for tables and datasets, no urls option
* :zap: updated hints and description of query parameter, fix getMany VIEW, multioptions fo fields
* :zap: added case when rows are empty
* :zap: linter fixes
* :zap: UI update, one resource
* :zap: fix for output with field named json
* :zap: using jobs instead queries
* :zap: added error message
* :zap: search for RLCs, fixes
* :zap: json processing
* :zap: removed getAll operation
* :zap: executeQuery update
* :zap: unit test
* :zap: tests setup, fixes
* :zap: tests
* Remove script for checking unused loadOptions
---------
Co-authored-by: agobrech <ael.gobrecht@gmail.com>
2023-04-19 05:55:01 -07:00
|
|
|
}
|