MCPcopy Create free account
hub / github.com/dataform-co/dataform / runQuery

Method runQuery

cli/api/dbadapters/bigquery.ts:351–380  ·  view source on GitHub ↗
(
    query: string,
    params?: { [name: string]: any },
    rowLimit?: number,
    byteLimit?: number,
    location?: string
  )

Source from the content-addressed store, hash-verified

349 }
350
351 private async runQuery(
352 query: string,
353 params?: { [name: string]: any },
354 rowLimit?: number,
355 byteLimit?: number,
356 location?: string
357 ): Promise<IExecutionResult> {
358 const results = await new Promise<any[]>((resolve, reject) => {
359 const allRows = new LimitedResultSet({
360 rowLimit,
361 byteLimit
362 });
363 const stream = this.getClient().createQueryStream({
364 query,
365 params,
366 location
367 });
368 stream
369 .on("error", e => reject(coerceAsError(e)))
370 .on("data", row => {
371 if (!allRows.push(row)) {
372 stream.end();
373 }
374 })
375 .on("end", () => {
376 resolve(allRows.rows);
377 });
378 });
379 return { rows: cleanRows(results), metadata: {} };
380 }
381
382 private prepareQueryOptions(
383 query: string,

Callers 1

executeMethod · 0.95

Calls 5

getClientMethod · 0.95
pushMethod · 0.95
coerceAsErrorFunction · 0.90
cleanRowsFunction · 0.85
endMethod · 0.80

Tested by

no test coverage detected