(
statement: string,
options: {
params?: { [name: string]: any };
onCancel?: OnCancel;
interactive?: boolean;
rowLimit?: number;
byteLimit?: number;
bigquery?: IBigQueryExecutionOptions;
} = { interactive: false, rowLimit: 1000, byteLimit: 1024 * 1024 }
)
| 85 | } |
| 86 | |
| 87 | public async execute( |
| 88 | statement: string, |
| 89 | options: { |
| 90 | params?: { [name: string]: any }; |
| 91 | onCancel?: OnCancel; |
| 92 | interactive?: boolean; |
| 93 | rowLimit?: number; |
| 94 | byteLimit?: number; |
| 95 | bigquery?: IBigQueryExecutionOptions; |
| 96 | } = { interactive: false, rowLimit: 1000, byteLimit: 1024 * 1024 } |
| 97 | ): Promise<IExecutionResult> { |
| 98 | if (options?.interactive && options?.bigquery?.labels) { |
| 99 | throw new Error("BigQuery job labels may not be set for interactive queries."); |
| 100 | } |
| 101 | |
| 102 | if (!statement) { |
| 103 | throw new Error("Query string cannot be empty"); |
| 104 | } |
| 105 | return this.pool |
| 106 | .addSingleTask({ |
| 107 | generator: () => |
| 108 | options?.interactive |
| 109 | ? this.runQuery( |
| 110 | statement, |
| 111 | options?.params, |
| 112 | options?.rowLimit, |
| 113 | options?.byteLimit, |
| 114 | options.bigquery?.location |
| 115 | ) |
| 116 | : this.createQueryJob( |
| 117 | statement, |
| 118 | options?.params, |
| 119 | options?.rowLimit, |
| 120 | options?.byteLimit, |
| 121 | options?.onCancel, |
| 122 | options?.bigquery?.labels, |
| 123 | options?.bigquery?.location, |
| 124 | options?.bigquery?.jobPrefix, |
| 125 | options?.bigquery?.dryRun, |
| 126 | options?.bigquery?.reservation |
| 127 | ) |
| 128 | }) |
| 129 | .promise(); |
| 130 | } |
| 131 | |
| 132 | public async executeRaw( |
| 133 | statement: string, |
no test coverage detected