1 | /*!
|
2 | * Copyright 2014 Google Inc. All Rights Reserved.
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | /// <reference types="node" />
|
17 | import { DeleteCallback, Metadata, ServiceObject } from '@google-cloud/common';
|
18 | import { ResourceStream } from '@google-cloud/paginator';
|
19 | import { Duplex } from 'stream';
|
20 | import { BigQuery, PagedCallback, PagedRequest, PagedResponse, Query, QueryRowsResponse, ResourceCallback, SimpleQueryRowsCallback } from './bigquery';
|
21 | import { JobCallback, JobResponse, Table, TableMetadata, TableOptions } from './table';
|
22 | import { Model } from './model';
|
23 | import { Routine } from './routine';
|
24 | import bigquery from './types';
|
25 | export interface DatasetDeleteOptions {
|
26 | force?: boolean;
|
27 | }
|
28 | export interface DatasetOptions {
|
29 | location?: string;
|
30 | projectId?: string;
|
31 | }
|
32 | export type CreateDatasetOptions = bigquery.IDataset;
|
33 | export type GetModelsOptions = PagedRequest<bigquery.models.IListParams>;
|
34 | export type GetModelsResponse = PagedResponse<Model, GetModelsOptions, bigquery.IListModelsResponse>;
|
35 | export type GetModelsCallback = PagedCallback<Model, GetModelsOptions, bigquery.IListModelsResponse>;
|
36 | export type GetRoutinesOptions = PagedRequest<bigquery.routines.IListParams>;
|
37 | export type GetRoutinesResponse = PagedResponse<Routine, GetRoutinesOptions, bigquery.IListRoutinesResponse>;
|
38 | export type GetRoutinesCallback = PagedCallback<Routine, GetRoutinesOptions, bigquery.IListRoutinesResponse>;
|
39 | export type GetTablesOptions = PagedRequest<bigquery.tables.IListParams>;
|
40 | export type GetTablesResponse = PagedResponse<Table, GetTablesOptions, bigquery.ITableList>;
|
41 | export type GetTablesCallback = PagedCallback<Table, GetTablesOptions, bigquery.ITableList>;
|
42 | export type RoutineMetadata = bigquery.IRoutine;
|
43 | export type RoutineResponse = [Routine, bigquery.IRoutine];
|
44 | export type RoutineCallback = ResourceCallback<Routine, bigquery.IRoutine>;
|
45 | export type TableResponse = [Table, bigquery.ITable];
|
46 | export type TableCallback = ResourceCallback<Table, bigquery.ITable>;
|
47 | /**
|
48 | * Interact with your BigQuery dataset. Create a Dataset instance with
|
49 | * {@link BigQuery#createDataset} or {@link BigQuery#dataset}.
|
50 | *
|
51 | * @class
|
52 | * @param {BigQuery} bigQuery {@link BigQuery} instance.
|
53 | * @param {string} id The ID of the Dataset.
|
54 | * @param {object} [options] Dataset options.
|
55 | * @param {string} [options.projectId] The GCP project ID.
|
56 | * @param {string} [options.location] The geographic location of the dataset.
|
57 | * Defaults to US.
|
58 | *
|
59 | * @example
|
60 | * ```
|
61 | * const {BigQuery} = require('@google-cloud/bigquery');
|
62 | * const bigquery = new BigQuery();
|
63 | * const dataset = bigquery.dataset('institutions');
|
64 | * ```
|
65 | */
|
66 | declare class Dataset extends ServiceObject {
|
67 | bigQuery: BigQuery;
|
68 | location?: string;
|
69 | projectId: string;
|
70 | getModelsStream(options?: GetModelsOptions): ResourceStream<Model>;
|
71 | getRoutinesStream(options?: GetRoutinesOptions): ResourceStream<Routine>;
|
72 | getTablesStream(options?: GetTablesOptions): ResourceStream<Table>;
|
73 | constructor(bigQuery: BigQuery, id: string, options?: DatasetOptions);
|
74 | /**
|
75 | * Run a query as a job. No results are immediately returned. Instead, your
|
76 | * callback will be executed with a { Job} object that you must
|
77 | * ping for the results. See the Job documentation for explanations of how to
|
78 | * check on the status of the job.
|
79 | *
|
80 | * See {for full documentation of this method.
BigQuery#createQueryJob} |
81 | *
|
82 | * for full documentation of this method.
{object} options See { BigQuery#createQueryJob} |
83 | * for full documentation of this method.
{JobCallback} [callback] See { BigQuery#createQueryJob} |
84 | * Promise<JobResponse>} See { BigQuery#createQueryJob} for full documentation of this method.
{ |
85 | */
|
86 | createQueryJob(options: string | Query): Promise<JobResponse>;
|
87 | createQueryJob(options: string | Query, callback: JobCallback): void;
|
88 | /**
|
89 | * Run a query scoped to your dataset as a readable object stream.
|
90 | *
|
91 | * See {@link BigQuery#createQueryStream} for full documentation of this
|
92 | * method.
|
93 | *
|
94 | * @param {object} options See {@link BigQuery#createQueryStream} for full
|
95 | * documentation of this method.
|
96 | * @returns {stream}
|
97 | */
|
98 | createQueryStream(options: Query | string): Duplex;
|
99 | /**
|
100 | * @callback CreateRoutineCallback
|
101 | * @param {?Error} err Request error, if any.
|
102 | * @param {Routine} routine The newly created routine.
|
103 | * @param {object} response The full API response body.
|
104 | */
|
105 | /**
|
106 | * @typedef {array} CreateRoutineResponse
|
107 | * @property {Routine} 0 The newly created routine.
|
108 | * @property {object} 1 The full API response body.
|
109 | */
|
110 | /**
|
111 | * Create a {@link Routine}.
|
112 | *
|
113 | * See {@link https://cloud.google.com/bigquery/docs/reference/rest/v2/routines/insert| Routines: insert API Documentation}
|
114 | *
|
115 | * @param {string} id The routine ID.
|
116 | * @param {object} config A [routine resource]{@link https://cloud.google.com/bigquery/docs/reference/rest/v2/routines#Routine}.
|
117 | * @param {CreateRoutineCallback} [callback] The callback function.
|
118 | * @returns {Promise<CreateRoutineResponse>}
|
119 | *
|
120 | * @example
|
121 | * ```
|
122 | * const {BigQuery} = require('@google-cloud/bigquery');
|
123 | * const bigquery = new BigQuery();
|
124 | * const dataset = bigquery.dataset('my-dataset');
|
125 | *
|
126 | * const id = 'my-routine';
|
127 | * const config = {
|
128 | * arguments: [{
|
129 | * name: 'x',
|
130 | * dataType: {
|
131 | * typeKind: 'INT64'
|
132 | * }
|
133 | * }],
|
134 | * definitionBody: 'x * 3',
|
135 | * routineType: 'SCALAR_FUNCTION',
|
136 | * returnType: {
|
137 | * typeKind: 'INT64'
|
138 | * }
|
139 | * };
|
140 | *
|
141 | * dataset.createRoutine(id, config, (err, routine, apiResponse) => {
|
142 | * if (!err) {
|
143 | * // The routine was created successfully.
|
144 | * }
|
145 | * });
|
146 | *
|
147 | * ```
|
148 | * @example If the callback is omitted a Promise will be returned
|
149 | * ```
|
150 | * const [routine, apiResponse] = await dataset.createRoutine(id, config);
|
151 | * ```
|
152 | */
|
153 | createRoutine(id: string, config: RoutineMetadata): Promise<RoutineResponse>;
|
154 | createRoutine(id: string, config: RoutineMetadata, callback: RoutineCallback): void;
|
155 | /**
|
156 | * @callback TableCallback
|
157 | * @param {?Error} err Request error, if any.
|
158 | * @param {Table} table The table.
|
159 | * @param {object} apiResponse The full API response body.
|
160 | */
|
161 | /**
|
162 | * @typedef {array} TableResponse
|
163 | * @property {Table} 0 The table.
|
164 | * @property {object} 1 The full API response body.
|
165 | */
|
166 | /**
|
167 | * Create a {@link Table} given a tableId or configuration object.
|
168 | *
|
169 | * See {@link https://cloud.google.com/bigquery/docs/reference/v2/tables/insert| Tables: insert API Documentation}
|
170 | *
|
171 | * @param {string} id Table id.
|
172 | * @param {object} [options] See a
|
173 | * {@link https://cloud.google.com/bigquery/docs/reference/v2/tables#resource| Table resource}.
|
174 | * @param {string|object} [options.schema] A comma-separated list of name:type
|
175 | * pairs. Valid types are "string", "integer", "float", "boolean", and
|
176 | * "timestamp". If the type is omitted, it is assumed to be "string".
|
177 | * Example: "name:string, age:integer". Schemas can also be specified as a
|
178 | * JSON array of fields, which allows for nested and repeated fields. See
|
179 | * a {@link http://goo.gl/sl8Dmg| Table resource} for more detailed information.
|
180 | * @param {TableCallback} [callback] The callback function.
|
181 | * @param {?error} callback.err An error returned while making this request
|
182 | * @param {Table} callback.table The newly created table.
|
183 | * @param {object} callback.apiResponse The full API response.
|
184 | * @returns {Promise<TableResponse>}
|
185 | *
|
186 | * @example
|
187 | * ```
|
188 | * const {BigQuery} = require('@google-cloud/bigquery');
|
189 | * const bigquery = new BigQuery();
|
190 | * const dataset = bigquery.dataset('institutions');
|
191 | *
|
192 | * const tableId = 'institution_data';
|
193 | *
|
194 | * const options = {
|
195 | * // From the data.gov CSV dataset (http://goo.gl/kSE7z6):
|
196 | * schema: 'UNITID,INSTNM,ADDR,CITY,STABBR,ZIP,FIPS,OBEREG,CHFNM,...'
|
197 | * };
|
198 | *
|
199 | * dataset.createTable(tableId, options, (err, table, apiResponse) => {});
|
200 | *
|
201 | * //-
|
202 | * // If the callback is omitted, we'll return a Promise.
|
203 | * //-
|
204 | * dataset.createTable(tableId, options).then((data) => {
|
205 | * const table = data[0];
|
206 | * const apiResponse = data[1];
|
207 | * });
|
208 | * ```
|
209 | */
|
210 | createTable(id: string, options: TableMetadata): Promise<TableResponse>;
|
211 | createTable(id: string, options: TableMetadata, callback: TableCallback): void;
|
212 | createTable(id: string, callback: TableCallback): void;
|
213 | /**
|
214 | * @callback DeleteCallback
|
215 | * @param {?Error} err Request error, if any.
|
216 | * @param {object} apiResponse The full API response body.
|
217 | */
|
218 | /**
|
219 | * @typedef {array} Metadata
|
220 | * @property {object} 0 The full API response body.
|
221 | */
|
222 | /**
|
223 | * Delete the dataset.
|
224 | *
|
225 | * See {@link https://cloud.google.com/bigquery/docs/reference/v2/datasets/delete| Datasets: delete API Documentation}
|
226 | *
|
227 | * @param {object} [options] The configuration object.
|
228 | * @param {boolean} [options.force=false] Force delete dataset and all tables.
|
229 | * @param {DeleteCallback} [callback] The callback function.
|
230 | * @param {?error} callback.err An error returned while making this request
|
231 | * @param {object} callback.apiResponse The full API response.
|
232 | * @returns {Promise<Metadata>}
|
233 | *
|
234 | * @example
|
235 | * ```
|
236 | * const {BigQuery} = require('@google-cloud/bigquery');
|
237 | * const bigquery = new BigQuery();
|
238 | * const dataset = bigquery.dataset('institutions');
|
239 | *
|
240 | * //-
|
241 | * // Delete the dataset, only if it does not have any tables.
|
242 | * //-
|
243 | * dataset.delete((err, apiResponse) => {});
|
244 | *
|
245 | * //-
|
246 | * // Delete the dataset and any tables it contains.
|
247 | * //-
|
248 | * dataset.delete({ force: true }, (err, apiResponse) => {});
|
249 | *
|
250 | * //-
|
251 | * // If the callback is omitted, we'll return a Promise.
|
252 | * //-
|
253 | * dataset.delete().then((data) => {
|
254 | * const apiResponse = data[0];
|
255 | * });
|
256 | * ```
|
257 | */
|
258 | delete(options?: DatasetDeleteOptions): Promise<[Metadata]>;
|
259 | delete(options: DatasetDeleteOptions, callback: DeleteCallback): void;
|
260 | delete(callback: DeleteCallback): void;
|
261 | /**
|
262 | * @typedef {object} GetModelsOptions
|
263 | * @property {boolean} [autoPaginate=true] Have pagination handled
|
264 | * automatically.
|
265 | * @property {number} [maxApiCalls] Maximum number of API calls to make.
|
266 | * @property {number} [maxResults] Maximum number of results to return.
|
267 | * @property {string} [pageToken] Token returned from a previous call, to
|
268 | * request the next page of results.
|
269 | */
|
270 | /**
|
271 | * @callback GetModelsCallback
|
272 | * @param {?Error} err Request error, if any.
|
273 | * @param {Model[]} models List of model objects.
|
274 | * @param {GetModelsOptions} nextQuery If `autoPaginate` is set to true,
|
275 | * this will be a prepared query for the next page of results.
|
276 | * @param {object} response The full API response.
|
277 | */
|
278 | /**
|
279 | * @typedef {array} GetModelsResponse
|
280 | * @property {Model[]} 0 A list of the dataset's {@link Model} objects.
|
281 | * @property {GetModelsOptions} 1 If `autoPaginate` is set to true, this
|
282 | * will be a prepared query for the next page of results.
|
283 | * @property {object} 2 The full API response.
|
284 | */
|
285 | /**
|
286 | * Get a list of {@link Model} resources.
|
287 | *
|
288 | * See {@link https://cloud.google.com/bigquery/docs/reference/rest/v2/models/list| Models: list API Documentation}
|
289 | *
|
290 | * @param {GetModelsOptions} [options] Configuration object.
|
291 | * @param {boolean} [options.autoPaginate=true] Have pagination handled
|
292 | * automatically.
|
293 | * @param {number} [options.maxApiCalls] Maximum number of API calls to make.
|
294 | * @param {number} [options.maxResults] Maximum number of results to return.
|
295 | * @param {string} [options.pageToken] Token returned from a previous call, to
|
296 | * request the next page of results.
|
297 | * @param {GetModelsCallback} [callback] The callback function.
|
298 | * @param {?error} callback.err An error returned while making this request
|
299 | * @param {Model[]} callback.models The list of models from
|
300 | * your Dataset.
|
301 | * @param {GetModelsOptions} callback.nextQuery If `autoPaginate` is set to true, this
|
302 | * will be a prepared query for the next page of results.
|
303 | * @param {object} callback.apiResponse The full API response.
|
304 | * @returns {Promise<GetModelsResponse>}
|
305 | *
|
306 | * @example
|
307 | * ```
|
308 | * const {BigQuery} = require('@google-cloud/bigquery');
|
309 | * const bigquery = new BigQuery();
|
310 | * const dataset = bigquery.dataset('institutions');
|
311 | *
|
312 | * dataset.getModels((err, models) => {
|
313 | * // models is an array of `Model` objects.
|
314 | * });
|
315 | *
|
316 | * ```
|
317 | * @example To control how many API requests are made and page through the results manually, set `autoPaginate` to `false`.
|
318 | * ```
|
319 | * function manualPaginationCallback(err, models, nextQuery, apiResponse) {
|
320 | * if (nextQuery) {
|
321 | * // More results exist.
|
322 | * dataset.getModels(nextQuery, manualPaginationCallback);
|
323 | * }
|
324 | * }
|
325 | *
|
326 | * dataset.getModels({
|
327 | * autoPaginate: false
|
328 | * }, manualPaginationCallback);
|
329 | *
|
330 | * ```
|
331 | * @example If the callback is omitted, we'll return a Promise.
|
332 | * ```
|
333 | * dataset.getModels().then((data) => {
|
334 | * const models = data[0];
|
335 | * });
|
336 | * ```
|
337 | */
|
338 | getModels(options?: GetModelsOptions): Promise<GetModelsResponse>;
|
339 | getModels(options: GetModelsOptions, callback: GetModelsCallback): void;
|
340 | getModels(callback: GetModelsCallback): void;
|
341 | /**
|
342 | * @typedef {object} GetRoutinesOptions
|
343 | * @property {boolean} [autoPaginate=true] Have pagination handled
|
344 | * automatically.
|
345 | * @property {number} [maxApiCalls] Maximum number of API calls to make.
|
346 | * @property {number} [maxResults] Maximum number of results to return.
|
347 | * @property {string} [pageToken] Token returned from a previous call, to
|
348 | * request the next page of results.
|
349 | */
|
350 | /**
|
351 | * @callback GetRoutinesCallback
|
352 | * @param {?Error} err Request error, if any.
|
353 | * @param {Routine[]} routines List of routine objects.
|
354 | * @param {GetRoutinesOptions} nextQuery If `autoPaginate` is set to true,
|
355 | * this will be a prepared query for the next page of results.
|
356 | * @param {object} response The full API response.
|
357 | */
|
358 | /**
|
359 | * @typedef {array} GetRoutinesResponse
|
360 | * @property {Routine[]} 0 List of {@link Routine} objects.
|
361 | * @property {GetRoutinesOptions} 1 If `autoPaginate` is set to true, this
|
362 | * will be a prepared query for the next page of results.
|
363 | * @property {object} 2 The full API response.
|
364 | */
|
365 | /**
|
366 | * Get a list of routines.
|
367 | *
|
368 | * See {@link https://cloud.google.com/bigquery/docs/reference/rest/v2/routines/list| Routines: list API Documentation}
|
369 | *
|
370 | * @param {GetRoutinesOptions} [options] Request options.
|
371 | * @param {boolean} [options.autoPaginate=true] Have pagination handled
|
372 | * automatically.
|
373 | * @param {number} [options.maxApiCalls] Maximum number of API calls to make.
|
374 | * @param {number} [options.maxResults] Maximum number of results to return.
|
375 | * @param {string} [options.pageToken] Token returned from a previous call, to
|
376 | * request the next page of results.
|
377 | * @param {GetRoutinesCallback} [callback] The callback function.
|
378 | * @param {?error} callback.err An error returned while making this request
|
379 | * @param {Routine[]} callback.routines The list of models from
|
380 | * your Dataset.
|
381 | * @param {GetRoutinesOptions} callback.nextQuery If `autoPaginate` is set to true, this
|
382 | * will be a prepared query for the next page of results.
|
383 | * @param {object} callback.apiResponse The full API response.
|
384 | * @returns {Promise<GetRoutinesResponse>}
|
385 | *
|
386 | * @example
|
387 | * ```
|
388 | * const {BigQuery} = require('@google-cloud/bigquery');
|
389 | * const bigquery = new BigQuery();
|
390 | * const dataset = bigquery.dataset('institutions');
|
391 | *
|
392 | * dataset.getRoutines((err, routines) => {
|
393 | * // routines is an array of `Routine` objects.
|
394 | * });
|
395 | *
|
396 | * ```
|
397 | * @example To control how many API requests are made and page through the results manually, set `autoPaginate` to `false`.
|
398 | * ```
|
399 | * function manualPaginationCallback(err, routines, nextQuery, apiResponse) {
|
400 | * if (nextQuery) {
|
401 | * // More results exist.
|
402 | * dataset.getRoutines(nextQuery, manualPaginationCallback);
|
403 | * }
|
404 | * }
|
405 | *
|
406 | * dataset.getRoutines({
|
407 | * autoPaginate: false
|
408 | * }, manualPaginationCallback);
|
409 | *
|
410 | * ```
|
411 | * @example If the callback is omitted a Promise will be returned
|
412 | * ```
|
413 | * const [routines] = await dataset.getRoutines();
|
414 | * ```
|
415 | */
|
416 | getRoutines(options?: GetRoutinesOptions): Promise<GetRoutinesResponse>;
|
417 | getRoutines(options: GetRoutinesOptions, callback: GetRoutinesCallback): void;
|
418 | getRoutines(callback: GetRoutinesCallback): void;
|
419 | /**
|
420 | * @typedef {object} GetTablesOptions
|
421 | * @property {boolean} [autoPaginate=true] Have pagination handled
|
422 | * automatically.
|
423 | * @property {number} [maxApiCalls] Maximum number of API calls to make.
|
424 | * @property {number} [maxResults] Maximum number of results to return.
|
425 | * @property {string} [pageToken] Token returned from a previous call, to
|
426 | * request the next page of results.
|
427 | */
|
428 | /**
|
429 | * @callback GetTablesCallback
|
430 | * @param {?Error} err Request error, if any.
|
431 | * @param {Table[]} tables List of {@link Table} objects.
|
432 | * @param {GetTablesOptions} nextQuery If `autoPaginate` is set to true,
|
433 | * this will be a prepared query for the next page of results.
|
434 | * @param {object} response The full API response.
|
435 | */
|
436 | /**
|
437 | * @typedef {array} GetTablesResponse
|
438 | * @property {Table[]} 0 List of {@link Table} objects.
|
439 | * @property {GetTablesOptions} 1 If `autoPaginate` is set to true, this
|
440 | * will be a prepared query for the next page of results.
|
441 | * @property {object} 2 The full API response.
|
442 | */
|
443 | /**
|
444 | * Get a list of {@link Table} resources.
|
445 | *
|
446 | * See {@link https://cloud.google.com/bigquery/docs/reference/v2/tables/list| Tables: list API Documentation}
|
447 | *
|
448 | * @param {GetTablesOptions} options Configuration object.
|
449 | * @param {boolean} [options.autoPaginate=true] Have pagination handled automatically.
|
450 | * @param {number} [options.maxApiCalls] Maximum number of API calls to make.
|
451 | * @param {number} [options.maxResults] Maximum number of results to return.
|
452 | * @param {string} [options.pageToken] Token returned from a previous call, to
|
453 | * request the next page of results.
|
454 | * @param {GetTablesCallback} [callback] The callback function.
|
455 | * @param {?error} callback.err An error returned while making this request
|
456 | * @param {Table[]} callback.tables The list of tables from
|
457 | * your Dataset.
|
458 | * @param {GetTablesOptions} callback.nextQuery If `autoPaginate` is set to true, this
|
459 | * will be a prepared query for the next page of results.
|
460 | * @param {object} callback.apiResponse The full API response.
|
461 | * @returns {Promise<GetTablesResponse>}
|
462 | *
|
463 | * @example
|
464 | * ```
|
465 | * const {BigQuery} = require('@google-cloud/bigquery');
|
466 | * const bigquery = new BigQuery();
|
467 | * const dataset = bigquery.dataset('institutions');
|
468 | *
|
469 | * dataset.getTables((err, tables) => {
|
470 | * // tables is an array of `Table` objects.
|
471 | * });
|
472 | *
|
473 | * //-
|
474 | * // To control how many API requests are made and page through the results
|
475 | * // manually, set `autoPaginate` to `false`.
|
476 | * //-
|
477 | * function manualPaginationCallback(err, tables, nextQuery, apiResponse) {
|
478 | * if (nextQuery) {
|
479 | * // More results exist.
|
480 | * dataset.getTables(nextQuery, manualPaginationCallback);
|
481 | * }
|
482 | * }
|
483 | *
|
484 | * dataset.getTables({
|
485 | * autoPaginate: false
|
486 | * }, manualPaginationCallback);
|
487 | *
|
488 | * //-
|
489 | * // If the callback is omitted, we'll return a Promise.
|
490 | * //-
|
491 | * dataset.getTables().then((data) => {
|
492 | * const tables = data[0];
|
493 | * });
|
494 | * ```
|
495 | */
|
496 | getTables(options?: GetTablesOptions): Promise<GetTablesResponse>;
|
497 | getTables(options: GetTablesOptions, callback: GetTablesCallback): void;
|
498 | getTables(callback: GetTablesCallback): void;
|
499 | /**
|
500 | * Create a {@link Model} object.
|
501 | *
|
502 | * @throws {TypeError} if model ID is missing.
|
503 | *
|
504 | * @param {string} id The ID of the model.
|
505 | * @return {Model}
|
506 | *
|
507 | * @example
|
508 | * ```
|
509 | * const {BigQuery} = require('@google-cloud/bigquery');
|
510 | * const bigquery = new BigQuery();
|
511 | * const dataset = bigquery.dataset('institutions');
|
512 | *
|
513 | * const model = dataset.model('my-model');
|
514 | * ```
|
515 | */
|
516 | model(id: string): Model;
|
517 | /**
|
518 | * Run a query scoped to your dataset.
|
519 | *
|
520 | * See {@link BigQuery#query} for full documentation of this method.
|
521 | *
|
522 | * @param {object} options See {@link BigQuery#query} for full documentation of this method.
|
523 | * @param {function} [callback] See {@link BigQuery#query} for full documentation of this method.
|
524 | * @returns {Promise<SimpleQueryRowsResponse>}
|
525 | * @returns {Promise<QueryRowsResponse>} See {@link BigQuery#query} for full documentation of this method.
|
526 | */
|
527 | query(options: Query): Promise<QueryRowsResponse>;
|
528 | query(options: string): Promise<QueryRowsResponse>;
|
529 | query(options: Query, callback: SimpleQueryRowsCallback): void;
|
530 | query(options: string, callback: SimpleQueryRowsCallback): void;
|
531 | /**
|
532 | * Create a {@link Routine} object.
|
533 | *
|
534 | * @throws {TypeError} if routine ID is missing.
|
535 | *
|
536 | * @param {string} id The ID of the routine.
|
537 | * @returns {Routine}
|
538 | *
|
539 | * @example
|
540 | * ```
|
541 | * const {BigQuery} = require('@google-cloud/bigquery');
|
542 | * const bigquery = new BigQuery();
|
543 | * const dataset = bigquery.dataset('institutions');
|
544 | *
|
545 | * const routine = dataset.routine('my_routine');
|
546 | * ```
|
547 | */
|
548 | routine(id: string): Routine;
|
549 | /**
|
550 | * Create a {@link Table} object.
|
551 | *
|
552 | * @throws {TypeError} if table ID is missing.
|
553 | *
|
554 | * @param {string} id The ID of the table.
|
555 | * @param {object} [options] Table options.
|
556 | * @param {string} [options.location] The geographic location of the table, by
|
557 | * default this value is inherited from the dataset. This can be used to
|
558 | * configure the location of all jobs created through a table instance.
|
559 | * It cannot be used to set the actual location of the table. This value will
|
560 | * be superseded by any API responses containing location data for the
|
561 | * table.
|
562 | * @return {Table}
|
563 | *
|
564 | * @example
|
565 | * ```
|
566 | * const {BigQuery} = require('@google-cloud/bigquery');
|
567 | * const bigquery = new BigQuery();
|
568 | * const dataset = bigquery.dataset('institutions');
|
569 | *
|
570 | * const institutions = dataset.table('institution_data');
|
571 | * ```
|
572 | */
|
573 | table(id: string, options?: TableOptions): Table;
|
574 | }
|
575 | /**
|
576 | * Reference to the {@link Dataset} class.
|
577 | * @name module:@google-cloud/bigquery.Dataset
|
578 | * @see Dataset
|
579 | */
|
580 | export { Dataset };
|