@google-cloud/bigquery

  • Version 5.9.1
  • Published
  • 557 kB
  • 11 dependencies
  • Apache-2.0 license

Install

npm i @google-cloud/bigquery
yarn add @google-cloud/bigquery
pnpm add @google-cloud/bigquery

Overview

Google BigQuery Client Library for Node.js

Index

Variables

Classes

Interfaces

Type Aliases

Variables

variable PROTOCOL_REGEX

const PROTOCOL_REGEX: RegExp;

    Classes

    class BigQuery

    class BigQuery extends common.Service {}
    • In the following examples from this page and the other modules (Dataset, Table, etc.), we are going to be using a dataset from [data.gov](http://goo.gl/f2SXcb) of higher education institutions.

      We will create a table with the correct schema, import the public CSV file into that table, and query it for data.

      Parameter options

      Constructor options.

      Example 1

      Install the client library with npm: npm install @google-cloud/bigquery

      Example 2

      Import the client library const {BigQuery} = require('@google-cloud/bigquery');

      Example 3

      Create a client that uses Application Default Credentials (ADC): const bigquery = new BigQuery();

      Example 4

      Create a client with explicit credentials: const bigquery = new BigQuery({ projectId: 'your-project-id', keyFilename: '/path/to/keyfile.json' });

      Example 5

      include:samples/quickstart.js region_tag:bigquery_quickstart Full quickstart example:

      See Also

    constructor

    constructor(options?: BigQueryOptions);

      property createQueryStream

      createQueryStream: (options?: Query | string) => any;

        property getDatasetsStream

        getDatasetsStream: (options?: GetDatasetsOptions) => any;

          property getJobsStream

          getJobsStream: (options?: GetJobsOptions) => any;

            property location

            location?: string;

              method createDataset

              createDataset: {
              (id: string, options?: DatasetResource): Promise<DatasetResponse>;
              (id: string, options: bigquery.IDataset, callback: DatasetCallback): void;
              (id: string, callback: DatasetCallback): void;
              };

                method createJob

                createJob: {
                (options: JobOptions): Promise<JobResponse>;
                (options: JobOptions, callback: JobCallback): void;
                };

                  method createQueryJob

                  createQueryJob: {
                  (options: Query | string): Promise<JobResponse>;
                  (options: string | Query, callback: JobCallback): void;
                  };

                    method dataset

                    dataset: (id: string, options?: DatasetOptions) => Dataset;
                    • Create a reference to a dataset.

                      Parameter id

                      ID of the dataset.

                      Parameter options

                      Dataset options.

                      Parameter

                      {string} [options.location] The geographic location of the dataset. Required except for US and EU.

                      Returns

                      {Dataset}

                      Example 1

                      const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('higher_education');

                    method date

                    static date: (value: BigQueryDateOptions | string) => BigQueryDate;
                    • The DATE type represents a logical calendar date, independent of time zone. It does not represent a specific 24-hour time period. Rather, a given DATE value represents a different 24-hour period when interpreted in different time zones, and may represent a shorter or longer day during Daylight Savings Time transitions.

                      Parameter value

                      The date. If a string, this should be in the format the API describes: YYYY-[M]M-[D]D. Otherwise, provide an object.

                      Parameter

                      {string|number} value.year Four digits.

                      Parameter

                      {string|number} value.month One or two digits.

                      Parameter

                      {string|number} value.day One or two digits.

                      Example 1

                      const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const date = bigquery.date('2017-01-01');

                      //- // Alternatively, provide an object. //- const date2 = bigquery.date({ year: 2017, month: 1, day: 1 });

                    • Parameter value

                      The date. If a string, this should be in the format the API describes: YYYY-[M]M-[D]D. Otherwise, provide an object.

                      Parameter

                      {string|number} value.year Four digits.

                      Parameter

                      {string|number} value.month One or two digits.

                      Parameter

                      {string|number} value.day One or two digits.

                      Returns

                      {BigQueryDate}

                      Example 1

                      const {BigQuery} = require('@google-cloud/bigquery'); const date = BigQuery.date('2017-01-01');

                      //- // Alternatively, provide an object. //- const date2 = BigQuery.date({ year: 2017, month: 1, day: 1 });

                    method datetime

                    static datetime: (value: BigQueryDatetimeOptions | string) => BigQueryDatetime;
                    • A DATETIME data type represents a point in time. Unlike a TIMESTAMP, this does not refer to an absolute instance in time. Instead, it is the civil time, or the time that a user would see on a watch or calendar.

                      BigQuery#datetime

                      Parameter value

                      The time. If a string, this should be in the format the API describes: YYYY-[M]M-[D]D[ [H]H:[M]M:[S]S[.DDDDDD]]. Otherwise, provide an object.

                      Parameter

                      {string|number} value.year Four digits.

                      Parameter

                      {string|number} value.month One or two digits.

                      Parameter

                      {string|number} value.day One or two digits.

                      Parameter

                      {string|number} [value.hours] One or two digits (00 - 23).

                      Parameter

                      {string|number} [value.minutes] One or two digits (00 - 59).

                      Parameter

                      {string|number} [value.seconds] One or two digits (00 - 59).

                      Parameter

                      {string|number} [value.fractional] Up to six digits for microsecond precision.

                      Example 1

                      const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const datetime = bigquery.datetime('2017-01-01 13:00:00');

                      //- // Alternatively, provide an object. //- const datetime = bigquery.datetime({ year: 2017, month: 1, day: 1, hours: 14, minutes: 0, seconds: 0 });

                    method decodeIntegerValue_

                    static decodeIntegerValue_: (value: IntegerTypeCastValue) => number;
                    • Convert an INT64 value to Number.

                      Parameter value

                      The INT64 value to convert.

                    method geography

                    static geography: (value: string) => Geography;
                    • A geography value represents a surface area on the Earth in Well-known Text (WKT) format.

                      BigQuery#geography

                      Parameter value

                      The geospatial data.

                      Returns

                      {Geography}

                      Example 1

                      const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const geography = bigquery.geography('POINT(1, 2)');

                    method getDatasets

                    getDatasets: {
                    (options?: GetDatasetsOptions): Promise<DatasetsResponse>;
                    (options: GetDatasetsOptions, callback: DatasetsCallback): void;
                    (callback: DatasetsCallback): void;
                    };

                      method getJobs

                      getJobs: {
                      (options?: GetJobsOptions): Promise<GetJobsResponse>;
                      (options: GetJobsOptions, callback: GetJobsCallback): void;
                      (callback: GetJobsCallback): void;
                      };

                        method getTypeDescriptorFromProvidedType_

                        static getTypeDescriptorFromProvidedType_: (
                        providedType: string | ProvidedTypeStruct | ProvidedTypeArray
                        ) => ValueType;

                        method getTypeDescriptorFromValue_

                        static getTypeDescriptorFromValue_: (value: unknown) => ValueType;

                        method int

                        static int: (
                        value: string | number | IntegerTypeCastValue,
                        typeCastOptions?: IntegerTypeCastOptions
                        ) => BigQueryInt;
                        • A BigQueryInt wraps 'INT64' values. Can be used to maintain precision.

                          BigQuery#int

                          Parameter value

                          The INT64 value to convert.

                          Parameter typeCastOptions

                          Configuration to convert value. Must provide an integerTypeCastFunction to handle conversion.

                          Returns

                          {BigQueryInt}

                          Example 1

                          const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery();

                          const largeIntegerValue = Number.MAX_SAFE_INTEGER + 1;

                          const options = { integerTypeCastFunction: value => value.split(), };

                          const bqInteger = bigquery.int(largeIntegerValue, options);

                          const customValue = bqInteger.valueOf(); // customValue is the value returned from your integerTypeCastFunction.

                        method job

                        job: (id: string, options?: JobOptions) => Job;
                        • Create a reference to an existing job.

                          Parameter id

                          ID of the job.

                          Parameter options

                          Configuration object.

                          Parameter

                          {string} [options.location] The geographic location of the job. Required except for US and EU.

                          Returns

                          {Job}

                          Example 1

                          const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery();

                          const myExistingJob = bigquery.job('job-id');

                        method mergeSchemaWithRows_

                        static mergeSchemaWithRows_: (
                        schema: TableSchema | TableField,
                        rows: TableRow[],
                        wrapIntegers: boolean | IntegerTypeCastOptions,
                        selectedFields?: string[]
                        ) => any[];
                        • Merge a rowset returned from the API with a table schema.

                          Parameter schema

                          Parameter rows

                          Parameter wrapIntegers

                          Wrap values of 'INT64' type in BigQueryInt objects. If a boolean, this will wrap values in BigQueryInt objects. If an object, this will return a value returned by wrapIntegers.integerTypeCastFunction. Please see IntegerTypeCastOptions for options descriptions.

                          Parameter selectedFields

                          List of fields to return. If unspecified, all fields are returned.

                          Returns

                          {array} Fields using their matching names from the table's schema.

                        method query

                        query: {
                        (query: string, options?: QueryOptions): Promise<QueryRowsResponse>;
                        (
                        query: Query,
                        options?: QueryResultsOptions
                        ): Promise<SimpleQueryRowsResponse>;
                        (
                        query: string,
                        options: QueryResultsOptions,
                        callback?: QueryRowsCallback
                        ): void;
                        (
                        query: Query,
                        options: QueryResultsOptions,
                        callback?: SimpleQueryRowsCallback
                        ): void;
                        (query: string, callback?: QueryRowsCallback): void;
                        (query: Query, callback?: SimpleQueryRowsCallback): void;
                        };

                          method queryAsStream_

                          queryAsStream_: (
                          query: Query,
                          optionsOrCallback?: QueryStreamOptions,
                          cb?: SimpleQueryRowsCallback
                          ) => void;
                          • This method will be called by createQueryStream(). It is required to properly set the autoPaginate option value.

                          method time

                          static time: (value: BigQueryTimeOptions | string) => BigQueryTime;
                          • A TIME data type represents a time, independent of a specific date.

                            BigQuery#time

                            Parameter value

                            The time. If a string, this should be in the format the API describes: [H]H:[M]M:[S]S[.DDDDDD]. Otherwise, provide an object.

                            Parameter

                            {string|number} [value.hours] One or two digits (00 - 23).

                            Parameter

                            {string|number} [value.minutes] One or two digits (00 - 59).

                            Parameter

                            {string|number} [value.seconds] One or two digits (00 - 59).

                            Parameter

                            {string|number} [value.fractional] Up to six digits for microsecond precision.

                            Example 1

                            const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const time = bigquery.time('14:00:00'); // 2:00 PM

                            //- // Alternatively, provide an object. //- const time = bigquery.time({ hours: 14, minutes: 0, seconds: 0 });

                          method timestamp

                          static timestamp: (value: Date | string) => BigQueryTimestamp;
                          • A timestamp represents an absolute point in time, independent of any time zone or convention such as Daylight Savings Time.

                            BigQuery#timestamp

                            Parameter value

                            The time.

                            Returns

                            {BigQueryTimestamp}

                            Example 1

                            const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const timestamp = bigquery.timestamp(new Date());

                          method valueToQueryParameter_

                          static valueToQueryParameter_: (
                          value: any,
                          providedType?: string | ProvidedTypeStruct | ProvidedTypeArray
                          ) => bigquery.IQueryParameter;

                          class BigQueryDate

                          class BigQueryDate {}
                          • Date class for BigQuery.

                          constructor

                          constructor(value: string | BigQueryDateOptions);

                            property value

                            value: string;

                              class BigQueryDatetime

                              class BigQueryDatetime {}
                              • Datetime class for BigQuery.

                              constructor

                              constructor(value: string | BigQueryDatetimeOptions);

                                property value

                                value: string;

                                  class BigQueryInt

                                  class BigQueryInt extends Number {}
                                  • Build a BigQueryInt object. For long integers, a string can be provided.

                                    Parameter value

                                    The 'INT64' value.

                                    Parameter typeCastOptions

                                    Configuration to convert values of 'INT64' type to a custom value. Must provide an integerTypeCastFunction to handle conversion.

                                    Parameter

                                    {function} typeCastOptions.integerTypeCastFunction A custom user provided function to convert value.

                                    Parameter

                                    {string|string[]} [typeCastOptions.fields] Schema field names to be converted using integerTypeCastFunction.

                                    Example 1

                                    const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const anInt = bigquery.int(7);

                                  constructor

                                  constructor(
                                  value: string | number | IntegerTypeCastValue,
                                  typeCastOptions?: IntegerTypeCastOptions
                                  );

                                    property type

                                    type: string;

                                      property typeCastFunction

                                      typeCastFunction?: Function;

                                        property value

                                        value: string;

                                          method toJSON

                                          toJSON: () => Json;

                                            method valueOf

                                            valueOf: () => any;

                                              class BigQueryTime

                                              class BigQueryTime {}
                                              • Time class for BigQuery.

                                              constructor

                                              constructor(value: string | BigQueryTimeOptions);

                                                property value

                                                value: string;

                                                  class BigQueryTimestamp

                                                  class BigQueryTimestamp {}
                                                  • Timestamp class for BigQuery.

                                                  constructor

                                                  constructor(value: string | Date);

                                                    property value

                                                    value: string;

                                                      class Dataset

                                                      class Dataset extends ServiceObject {}
                                                      • Interact with your BigQuery dataset. Create a Dataset instance with BigQuery#createDataset or BigQuery#dataset.

                                                        Parameter bigQuery

                                                        BigQuery instance.

                                                        Parameter id

                                                        The ID of the Dataset.

                                                        Parameter options

                                                        Dataset options.

                                                        Parameter

                                                        {string} [options.location] The geographic location of the dataset. Defaults to US.

                                                        Example 1

                                                        const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('institutions');

                                                      constructor

                                                      constructor(bigQuery: BigQuery, id: string, options?: DatasetOptions);

                                                        property bigQuery

                                                        bigQuery: BigQuery;

                                                          property getModelsStream

                                                          getModelsStream: (options?: GetModelsOptions) => any;

                                                            property getRoutinesStream

                                                            getRoutinesStream: (options?: GetRoutinesOptions) => any;

                                                              property getTablesStream

                                                              getTablesStream: (options?: GetTablesOptions) => any;

                                                                property location

                                                                location?: string;

                                                                  method createQueryJob

                                                                  createQueryJob: {
                                                                  (options: string | Query): Promise<JobResponse>;
                                                                  (options: string | Query, callback: JobCallback): void;
                                                                  };

                                                                    method createQueryStream

                                                                    createQueryStream: (options: Query | string) => any;

                                                                    method createRoutine

                                                                    createRoutine: {
                                                                    (id: string, config: RoutineMetadata): Promise<RoutineResponse>;
                                                                    (id: string, config: bigquery.IRoutine, callback: RoutineCallback): void;
                                                                    };

                                                                      method createTable

                                                                      createTable: {
                                                                      (id: string, options: TableMetadata): Promise<TableResponse>;
                                                                      (id: string, options: TableMetadata, callback: TableCallback): void;
                                                                      (id: string, callback: TableCallback): void;
                                                                      };

                                                                        method delete

                                                                        delete: {
                                                                        (options?: DatasetDeleteOptions): Promise<[Metadata]>;
                                                                        (options: DatasetDeleteOptions, callback: any): void;
                                                                        (callback: any): void;
                                                                        };

                                                                          method getModels

                                                                          getModels: {
                                                                          (options?: GetModelsOptions): Promise<GetModelsResponse>;
                                                                          (options: GetModelsOptions, callback: GetModelsCallback): void;
                                                                          (callback: GetModelsCallback): void;
                                                                          };

                                                                            method getRoutines

                                                                            getRoutines: {
                                                                            (options?: GetRoutinesOptions): Promise<GetRoutinesResponse>;
                                                                            (options: GetRoutinesOptions, callback: GetRoutinesCallback): void;
                                                                            (callback: GetRoutinesCallback): void;
                                                                            };

                                                                              method getTables

                                                                              getTables: {
                                                                              (options?: GetTablesOptions): Promise<GetTablesResponse>;
                                                                              (options: GetTablesOptions, callback: GetTablesCallback): void;
                                                                              (callback: GetTablesCallback): void;
                                                                              };

                                                                                method model

                                                                                model: (id: string) => Model;
                                                                                • Create a Model object.

                                                                                  Parameter id

                                                                                  The ID of the model. {Model}

                                                                                  Throws

                                                                                  {TypeError} if model ID is missing.

                                                                                  Example 1

                                                                                  const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('institutions');

                                                                                  const model = dataset.model('my-model');

                                                                                method query

                                                                                query: {
                                                                                (options: Query): Promise<QueryRowsResponse>;
                                                                                (options: string): Promise<QueryRowsResponse>;
                                                                                (options: Query, callback: SimpleQueryRowsCallback): void;
                                                                                (options: string, callback: SimpleQueryRowsCallback): void;
                                                                                };

                                                                                  method routine

                                                                                  routine: (id: string) => Routine;
                                                                                  • Create a Routine object.

                                                                                    Parameter id

                                                                                    The ID of the routine.

                                                                                    Returns

                                                                                    {Routine}

                                                                                    Throws

                                                                                    {TypeError} if routine ID is missing.

                                                                                    Example 1

                                                                                    const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('institutions');

                                                                                    const routine = dataset.routine('my_routine');

                                                                                  method table

                                                                                  table: (id: string, options?: TableOptions) => Table;
                                                                                  • Create a Table object.

                                                                                    Parameter id

                                                                                    The ID of the table.

                                                                                    Parameter options

                                                                                    Table options.

                                                                                    Parameter

                                                                                    {string} [options.location] The geographic location of the table, by default this value is inherited from the dataset. This can be used to configure the location of all jobs created through a table instance. It cannot be used to set the actual location of the table. This value will be superseded by any API responses containing location data for the table. {Table}

                                                                                    Throws

                                                                                    {TypeError} if table ID is missing.

                                                                                    Example 1

                                                                                    const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('institutions');

                                                                                    const institutions = dataset.table('institution_data');

                                                                                  class Geography

                                                                                  class Geography {}
                                                                                  • Geography class for BigQuery.

                                                                                  constructor

                                                                                  constructor(value: string);

                                                                                    property value

                                                                                    value: string;

                                                                                      class Job

                                                                                      class Job extends Operation {}
                                                                                      • Job objects are returned from various places in the BigQuery API:

                                                                                        - BigQuery#getJobs - BigQuery#job - BigQuery#query - BigQuery#createJob - Table#copy - Table#createWriteStream - Table#extract - Table#load

                                                                                        They can be used to check the status of a running job or fetching the results of a previously-executed one.

                                                                                        Parameter bigQuery

                                                                                        BigQuery instance.

                                                                                        Parameter id

                                                                                        The ID of the job.

                                                                                        Parameter options

                                                                                        Configuration object.

                                                                                        Parameter

                                                                                        {string} [options.location] The geographic location of the job. Required except for US and EU.

                                                                                        Example 1

                                                                                        const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery();

                                                                                        const job = bigquery.job('job-id');

                                                                                        //- // All jobs are event emitters. The status of each job is polled // continuously, starting only after you register a "complete" listener. //- job.on('complete', (metadata) => { // The job is complete. });

                                                                                        //- // Be sure to register an error handler as well to catch any issues which // impeded the job. //- job.on('error', (err) => { // An error occurred during the job. });

                                                                                        //- // To force the Job object to stop polling for updates, simply remove any // "complete" listeners you've registered. // // The easiest way to do this is with removeAllListeners(). //- job.removeAllListeners();

                                                                                      constructor

                                                                                      constructor(bigQuery: BigQuery, id: string, options?: JobOptions);

                                                                                        property bigQuery

                                                                                        bigQuery: BigQuery;

                                                                                          property getQueryResultsStream

                                                                                          getQueryResultsStream: (options?: QueryResultsOptions) => any;

                                                                                            property location

                                                                                            location?: string;

                                                                                              method cancel

                                                                                              cancel: { (): Promise<CancelResponse>; (callback: CancelCallback): void };

                                                                                                method getQueryResults

                                                                                                getQueryResults: {
                                                                                                (options?: QueryResultsOptions): Promise<QueryRowsResponse>;
                                                                                                (options: QueryResultsOptions, callback: QueryRowsCallback): void;
                                                                                                (callback: QueryRowsCallback): void;
                                                                                                };

                                                                                                  method getQueryResultsAsStream_

                                                                                                  getQueryResultsAsStream_: (
                                                                                                  options: QueryResultsOptions,
                                                                                                  callback: QueryRowsCallback
                                                                                                  ) => void;
                                                                                                  • This method will be called by getQueryResultsStream(). It is required to properly set the autoPaginate option value.

                                                                                                  method poll_

                                                                                                  poll_: (callback: any) => void;
                                                                                                  • Poll for a status update. Execute the callback:

                                                                                                    - callback(err): Job failed - callback(): Job incomplete - callback(null, metadata): Job complete

                                                                                                    Parameter callback

                                                                                                  class Model

                                                                                                  class Model extends common.ServiceObject {}
                                                                                                  • Model objects are returned by methods such as Dataset#model and Dataset#getModels.

                                                                                                    Parameter dataset

                                                                                                    Dataset instance.

                                                                                                    Parameter id

                                                                                                    The ID of the model.

                                                                                                    Example 1

                                                                                                    const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('my-dataset');

                                                                                                    const model = dataset.model('my-model');

                                                                                                  constructor

                                                                                                  constructor(dataset: Dataset, id: string);

                                                                                                    property bigQuery

                                                                                                    bigQuery: BigQuery;

                                                                                                      property dataset

                                                                                                      dataset: Dataset;

                                                                                                        method createExtractJob

                                                                                                        createExtractJob: {
                                                                                                        (
                                                                                                        destination: string | File,
                                                                                                        options?: CreateExtractJobOptions
                                                                                                        ): Promise<JobResponse>;
                                                                                                        (
                                                                                                        destination: string | File,
                                                                                                        options: CreateExtractJobOptions,
                                                                                                        callback: JobCallback
                                                                                                        ): void;
                                                                                                        (destination: string | File, callback: JobCallback): void;
                                                                                                        };

                                                                                                          method extract

                                                                                                          extract: {
                                                                                                          (
                                                                                                          destination: string | File,
                                                                                                          options?: CreateExtractJobOptions
                                                                                                          ): Promise<JobMetadataResponse>;
                                                                                                          (
                                                                                                          destination: string | File,
                                                                                                          options: CreateExtractJobOptions,
                                                                                                          callback?: JobMetadataCallback
                                                                                                          ): void;
                                                                                                          (destination: string | File, callback?: JobMetadataCallback): void;
                                                                                                          };

                                                                                                            class Routine

                                                                                                            class Routine extends common.ServiceObject {}
                                                                                                            • Routine objects are returned by methods such as Dataset#routine, Dataset#createRoutine, and Dataset#getRoutines.

                                                                                                              Parameter dataset

                                                                                                              Dataset instance.

                                                                                                              Parameter id

                                                                                                              The ID of the routine.

                                                                                                              Example 1

                                                                                                              const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('my-dataset');

                                                                                                              const routine = dataset.routine('my_routine');

                                                                                                            constructor

                                                                                                            constructor(dataset: Dataset, id: string);

                                                                                                              method setMetadata

                                                                                                              setMetadata: {
                                                                                                              (metadata: RoutineMetadata): Promise<common.SetMetadataResponse>;
                                                                                                              (metadata: bigquery.IRoutine, callback: any): void;
                                                                                                              };

                                                                                                                class Table

                                                                                                                class Table extends common.ServiceObject {}
                                                                                                                • Table objects are returned by methods such as Dataset#table, Dataset#createTable, and Dataset#getTables.

                                                                                                                  Parameter dataset

                                                                                                                  Dataset instance.

                                                                                                                  Parameter id

                                                                                                                  The ID of the table.

                                                                                                                  Parameter options

                                                                                                                  Table options.

                                                                                                                  Parameter

                                                                                                                  {string} [options.location] The geographic location of the table, by default this value is inherited from the dataset. This can be used to configure the location of all jobs created through a table instance. It cannot be used to set the actual location of the table. This value will be superseded by any API responses containing location data for the table.

                                                                                                                  Example 1

                                                                                                                  const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('my-dataset');

                                                                                                                  const table = dataset.table('my-table');

                                                                                                                constructor

                                                                                                                constructor(dataset: Dataset, id: string, options?: TableOptions);

                                                                                                                  property bigQuery

                                                                                                                  bigQuery: BigQuery;

                                                                                                                    property createReadStream

                                                                                                                    createReadStream: (options?: GetRowsOptions) => any;

                                                                                                                      property dataset

                                                                                                                      dataset: Dataset;

                                                                                                                        property location

                                                                                                                        location?: string;

                                                                                                                          method copy

                                                                                                                          copy: {
                                                                                                                          (
                                                                                                                          destination: Table,
                                                                                                                          metadata?: CopyTableMetadata
                                                                                                                          ): Promise<JobMetadataResponse>;
                                                                                                                          (
                                                                                                                          destination: Table,
                                                                                                                          metadata: CopyTableMetadata,
                                                                                                                          callback: JobMetadataCallback
                                                                                                                          ): void;
                                                                                                                          (destination: Table, callback: JobMetadataCallback): void;
                                                                                                                          };

                                                                                                                            method copyFrom

                                                                                                                            copyFrom: {
                                                                                                                            (
                                                                                                                            sourceTables: Table | Table[],
                                                                                                                            metadata?: CopyTableMetadata
                                                                                                                            ): Promise<JobMetadataResponse>;
                                                                                                                            (
                                                                                                                            sourceTables: Table | Table[],
                                                                                                                            metadata: CopyTableMetadata,
                                                                                                                            callback: JobMetadataCallback
                                                                                                                            ): void;
                                                                                                                            (sourceTables: Table | Table[], callback: JobMetadataCallback): void;
                                                                                                                            };

                                                                                                                              method createCopyFromJob

                                                                                                                              createCopyFromJob: {
                                                                                                                              (
                                                                                                                              source: Table | Table[],
                                                                                                                              metadata?: CopyTableMetadata
                                                                                                                              ): Promise<JobResponse>;
                                                                                                                              (
                                                                                                                              source: Table | Table[],
                                                                                                                              metadata: CopyTableMetadata,
                                                                                                                              callback: JobCallback
                                                                                                                              ): void;
                                                                                                                              (source: Table | Table[], callback: JobCallback): void;
                                                                                                                              };

                                                                                                                                method createCopyJob

                                                                                                                                createCopyJob: {
                                                                                                                                (destination: Table, metadata?: CreateCopyJobMetadata): Promise<JobResponse>;
                                                                                                                                (
                                                                                                                                destination: Table,
                                                                                                                                metadata: CopyTableMetadata,
                                                                                                                                callback: JobCallback
                                                                                                                                ): void;
                                                                                                                                (destination: Table, callback: JobCallback): void;
                                                                                                                                };

                                                                                                                                  method createExtractJob

                                                                                                                                  createExtractJob: {
                                                                                                                                  (destination: File, options?: CreateExtractJobOptions): Promise<JobResponse>;
                                                                                                                                  (
                                                                                                                                  destination: File,
                                                                                                                                  options: CreateExtractJobOptions,
                                                                                                                                  callback: JobCallback
                                                                                                                                  ): void;
                                                                                                                                  (destination: File, callback: JobCallback): void;
                                                                                                                                  };

                                                                                                                                    method createLoadJob

                                                                                                                                    createLoadJob: {
                                                                                                                                    (source: string | File, metadata?: JobLoadMetadata): Promise<JobResponse>;
                                                                                                                                    (
                                                                                                                                    source: string | File,
                                                                                                                                    metadata: JobLoadMetadata,
                                                                                                                                    callback: JobCallback
                                                                                                                                    ): void;
                                                                                                                                    (source: string | File, callback: JobCallback): void;
                                                                                                                                    };

                                                                                                                                      method createQueryJob

                                                                                                                                      createQueryJob: {
                                                                                                                                      (options: Query): Promise<JobResponse>;
                                                                                                                                      (options: Query, callback: JobCallback): void;
                                                                                                                                      };

                                                                                                                                        method createQueryStream

                                                                                                                                        createQueryStream: (query: Query) => any;

                                                                                                                                        method createSchemaFromString_

                                                                                                                                        static createSchemaFromString_: (str: string) => TableSchema;
                                                                                                                                        • Convert a comma-separated name:type string to a table schema object.

                                                                                                                                          Parameter str

                                                                                                                                          Comma-separated schema string.

                                                                                                                                          Returns

                                                                                                                                          {object} Table schema in the format the API expects.

                                                                                                                                        method createWriteStream

                                                                                                                                        createWriteStream: (metadata: JobLoadMetadata | string) => any;
                                                                                                                                        • Load data into your table from a readable stream of AVRO, CSV, JSON, ORC, or PARQUET data.

                                                                                                                                          Parameter metadata

                                                                                                                                          Metadata to set with the load operation. The metadata object should be in the format of the [configuration.load](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad) property of a Jobs resource. If a string is given, it will be used as the filetype.

                                                                                                                                          Parameter

                                                                                                                                          {string} [metadata.jobId] Custom job id.

                                                                                                                                          Parameter

                                                                                                                                          {string} [metadata.jobPrefix] Prefix to apply to the job id.

                                                                                                                                          Returns

                                                                                                                                          {WritableStream}

                                                                                                                                          Throws

                                                                                                                                          {Error} If source format isn't recognized.

                                                                                                                                          Example 1

                                                                                                                                          const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); const dataset = bigquery.dataset('my-dataset'); const table = dataset.table('my-table');

                                                                                                                                          //- // Load data from a CSV file. //- const request = require('request');

                                                                                                                                          const csvUrl = 'http://goo.gl/kSE7z6';

                                                                                                                                          const metadata = { allowJaggedRows: true, skipLeadingRows: 1 };

                                                                                                                                          request.get(csvUrl) .pipe(table.createWriteStream(metadata)) .on('job', (job) => { // job is a Job object that can be used to check the status of the // request. }) .on('complete', (job) => { // The job has completed successfully. });

                                                                                                                                          //- // Load data from a JSON file. //- const fs = require('fs');

                                                                                                                                          fs.createReadStream('./test/testdata/testfile.json') .pipe(table.createWriteStream('json')) .on('job', (job) => { // job is a Job object that can be used to check the status of the // request. }) .on('complete', (job) => { // The job has completed successfully. });

                                                                                                                                          See Also

                                                                                                                                        method createWriteStream_

                                                                                                                                        createWriteStream_: (metadata: JobLoadMetadata | string) => any;
                                                                                                                                        • Creates a write stream. Unlike the public version, this will not automatically poll the underlying job.

                                                                                                                                          Parameter metadata

                                                                                                                                          Metadata to set with the load operation. The metadata object should be in the format of the [configuration.load](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad) property of a Jobs resource. If a string is given, it will be used as the filetype.

                                                                                                                                          Parameter

                                                                                                                                          {string} [metadata.jobId] Custom job id.

                                                                                                                                          Parameter

                                                                                                                                          {string} [metadata.jobPrefix] Prefix to apply to the job id.

                                                                                                                                          Returns

                                                                                                                                          {WritableStream}

                                                                                                                                        method encodeValue_

                                                                                                                                        static encodeValue_: (value?: {} | null) => {} | null;
                                                                                                                                        • Convert a row entry from native types to their encoded types that the API expects.

                                                                                                                                          Parameter value

                                                                                                                                          The value to be converted.

                                                                                                                                          Returns

                                                                                                                                          {*} The converted value.

                                                                                                                                        method extract

                                                                                                                                        extract: {
                                                                                                                                        (
                                                                                                                                        destination: File,
                                                                                                                                        options?: CreateExtractJobOptions
                                                                                                                                        ): Promise<JobMetadataResponse>;
                                                                                                                                        (
                                                                                                                                        destination: File,
                                                                                                                                        options: CreateExtractJobOptions,
                                                                                                                                        callback?: JobMetadataCallback
                                                                                                                                        ): void;
                                                                                                                                        (destination: File, callback?: JobMetadataCallback): void;
                                                                                                                                        };

                                                                                                                                          method formatMetadata_

                                                                                                                                          static formatMetadata_: (options: TableMetadata) => FormattedMetadata;

                                                                                                                                          method getIamPolicy

                                                                                                                                          getIamPolicy: {
                                                                                                                                          (
                                                                                                                                          optionsOrCallback?: GetPolicyOptions | PolicyCallback
                                                                                                                                          ): Promise<PolicyResponse>;
                                                                                                                                          (options: bigquery.IGetPolicyOptions, callback: PolicyCallback): void;
                                                                                                                                          };

                                                                                                                                            method getRows

                                                                                                                                            getRows: {
                                                                                                                                            (options?: GetRowsOptions): Promise<RowsResponse>;
                                                                                                                                            (options: GetRowsOptions, callback: RowsCallback): void;
                                                                                                                                            (callback: RowsCallback): void;
                                                                                                                                            };

                                                                                                                                              method insert

                                                                                                                                              insert: {
                                                                                                                                              (
                                                                                                                                              rows: RowMetadata | RowMetadata[],
                                                                                                                                              options?: InsertRowsOptions
                                                                                                                                              ): Promise<InsertRowsResponse>;
                                                                                                                                              (rows: any, options: InsertRowsOptions, callback: InsertRowsCallback): void;
                                                                                                                                              (rows: any, callback: InsertRowsCallback): void;
                                                                                                                                              };

                                                                                                                                                method load

                                                                                                                                                load: {
                                                                                                                                                (
                                                                                                                                                source: string | File,
                                                                                                                                                metadata?: JobLoadMetadata
                                                                                                                                                ): Promise<JobMetadataResponse>;
                                                                                                                                                (
                                                                                                                                                source: string | File,
                                                                                                                                                metadata: JobLoadMetadata,
                                                                                                                                                callback: JobMetadataCallback
                                                                                                                                                ): void;
                                                                                                                                                (source: string | File, callback: JobMetadataCallback): void;
                                                                                                                                                };

                                                                                                                                                  method query

                                                                                                                                                  query: {
                                                                                                                                                  (query: Query): Promise<SimpleQueryRowsResponse>;
                                                                                                                                                  (query: string): Promise<SimpleQueryRowsResponse>;
                                                                                                                                                  (query: Query, callback: SimpleQueryRowsCallback): void;
                                                                                                                                                  };

                                                                                                                                                    method setIamPolicy

                                                                                                                                                    setIamPolicy: {
                                                                                                                                                    (policy: Policy, options?: SetPolicyOptions): Promise<PolicyResponse>;
                                                                                                                                                    (
                                                                                                                                                    policy: bigquery.IPolicy,
                                                                                                                                                    options: SetPolicyOptions,
                                                                                                                                                    callback: PolicyCallback
                                                                                                                                                    ): void;
                                                                                                                                                    (policy: bigquery.IPolicy, callback: PolicyCallback): void;
                                                                                                                                                    };

                                                                                                                                                      method setMetadata

                                                                                                                                                      setMetadata: {
                                                                                                                                                      (metadata: SetTableMetadataOptions): Promise<common.SetMetadataResponse>;
                                                                                                                                                      (metadata: TableMetadata, callback: any): void;
                                                                                                                                                      };

                                                                                                                                                        method testIamPermissions

                                                                                                                                                        testIamPermissions: {
                                                                                                                                                        (permissions: string | string[]): Promise<PermissionsResponse>;
                                                                                                                                                        (permissions: string | string[], callback: PermissionsCallback): void;
                                                                                                                                                        };

                                                                                                                                                          Interfaces

                                                                                                                                                          interface BigQueryDateOptions

                                                                                                                                                          interface BigQueryDateOptions {}

                                                                                                                                                            property day

                                                                                                                                                            day?: number | string;

                                                                                                                                                              property month

                                                                                                                                                              month?: number | string;

                                                                                                                                                                property year

                                                                                                                                                                year?: number | string;

                                                                                                                                                                  interface BigQueryDatetimeOptions

                                                                                                                                                                  interface BigQueryDatetimeOptions {}

                                                                                                                                                                    property day

                                                                                                                                                                    day?: string | number;

                                                                                                                                                                      property fractional

                                                                                                                                                                      fractional?: string | number;

                                                                                                                                                                        property hours

                                                                                                                                                                        hours?: string | number;

                                                                                                                                                                          property minutes

                                                                                                                                                                          minutes?: string | number;

                                                                                                                                                                            property month

                                                                                                                                                                            month?: string | number;

                                                                                                                                                                              property seconds

                                                                                                                                                                              seconds?: string | number;

                                                                                                                                                                                property year

                                                                                                                                                                                year?: string | number;

                                                                                                                                                                                  interface BigQueryOptions

                                                                                                                                                                                  interface BigQueryOptions extends common.GoogleAuthOptions {}

                                                                                                                                                                                    property apiEndpoint

                                                                                                                                                                                    apiEndpoint?: string;
                                                                                                                                                                                    • The API endpoint of the service used to make requests. Defaults to bigquery.googleapis.com.

                                                                                                                                                                                    property autoRetry

                                                                                                                                                                                    autoRetry?: boolean;

                                                                                                                                                                                      property location

                                                                                                                                                                                      location?: string;

                                                                                                                                                                                        property maxRetries

                                                                                                                                                                                        maxRetries?: number;

                                                                                                                                                                                          property userAgent

                                                                                                                                                                                          userAgent?: string;

                                                                                                                                                                                            interface BigQueryTimeOptions

                                                                                                                                                                                            interface BigQueryTimeOptions {}

                                                                                                                                                                                              property fractional

                                                                                                                                                                                              fractional?: number | string;

                                                                                                                                                                                                property hours

                                                                                                                                                                                                hours?: number | string;

                                                                                                                                                                                                  property minutes

                                                                                                                                                                                                  minutes?: number | string;

                                                                                                                                                                                                    property seconds

                                                                                                                                                                                                    seconds?: number | string;

                                                                                                                                                                                                      interface DatasetDeleteOptions

                                                                                                                                                                                                      interface DatasetDeleteOptions {}

                                                                                                                                                                                                        property force

                                                                                                                                                                                                        force?: boolean;

                                                                                                                                                                                                          interface DatasetOptions

                                                                                                                                                                                                          interface DatasetOptions {}

                                                                                                                                                                                                            property location

                                                                                                                                                                                                            location?: string;

                                                                                                                                                                                                              interface File

                                                                                                                                                                                                              interface File {}

                                                                                                                                                                                                                property bucket

                                                                                                                                                                                                                bucket: any;

                                                                                                                                                                                                                  property generation

                                                                                                                                                                                                                  generation?: number;

                                                                                                                                                                                                                    property kmsKeyName

                                                                                                                                                                                                                    kmsKeyName?: string;

                                                                                                                                                                                                                      property name

                                                                                                                                                                                                                      name: string;

                                                                                                                                                                                                                        property userProject

                                                                                                                                                                                                                        userProject?: string;

                                                                                                                                                                                                                          interface InsertRow

                                                                                                                                                                                                                          interface InsertRow {}

                                                                                                                                                                                                                            property insertId

                                                                                                                                                                                                                            insertId?: string;

                                                                                                                                                                                                                              property json

                                                                                                                                                                                                                              json?: bigquery.IJsonObject;

                                                                                                                                                                                                                                interface IntegerTypeCastOptions

                                                                                                                                                                                                                                interface IntegerTypeCastOptions {}

                                                                                                                                                                                                                                  property fields

                                                                                                                                                                                                                                  fields?: string | string[];

                                                                                                                                                                                                                                    property integerTypeCastFunction

                                                                                                                                                                                                                                    integerTypeCastFunction: Function;

                                                                                                                                                                                                                                      interface Json

                                                                                                                                                                                                                                      interface Json {}

                                                                                                                                                                                                                                        index signature

                                                                                                                                                                                                                                        [field: string]: string;

                                                                                                                                                                                                                                          interface PagedCallback

                                                                                                                                                                                                                                          interface PagedCallback<T, Q, R> {}

                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                            err: Error | null,
                                                                                                                                                                                                                                            resource?: T[] | null,
                                                                                                                                                                                                                                            nextQuery?: Q | null,
                                                                                                                                                                                                                                            response?: R | null
                                                                                                                                                                                                                                            ): void;

                                                                                                                                                                                                                                              interface PartialInsertFailure

                                                                                                                                                                                                                                              interface PartialInsertFailure {}

                                                                                                                                                                                                                                                property message

                                                                                                                                                                                                                                                message: string;

                                                                                                                                                                                                                                                  property reason

                                                                                                                                                                                                                                                  reason: string;

                                                                                                                                                                                                                                                    property row

                                                                                                                                                                                                                                                    row: RowMetadata;

                                                                                                                                                                                                                                                      interface ProvidedTypeStruct

                                                                                                                                                                                                                                                      interface ProvidedTypeStruct {}

                                                                                                                                                                                                                                                        index signature

                                                                                                                                                                                                                                                        [key: string]: string | ProvidedTypeArray | ProvidedTypeStruct;

                                                                                                                                                                                                                                                          interface RequestCallback

                                                                                                                                                                                                                                                          interface RequestCallback<T> {}

                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                            (err: Error | null, response?: T | null): void;

                                                                                                                                                                                                                                                              interface ResourceCallback

                                                                                                                                                                                                                                                              interface ResourceCallback<T, R> {}

                                                                                                                                                                                                                                                                call signature

                                                                                                                                                                                                                                                                (err: Error | null, resource?: T | null, response?: R | null): void;

                                                                                                                                                                                                                                                                  interface TableOptions

                                                                                                                                                                                                                                                                  interface TableOptions {}

                                                                                                                                                                                                                                                                    property location

                                                                                                                                                                                                                                                                    location?: string;

                                                                                                                                                                                                                                                                      Type Aliases

                                                                                                                                                                                                                                                                      type CancelCallback

                                                                                                                                                                                                                                                                      type CancelCallback = RequestCallback<bigquery.IJobCancelResponse>;

                                                                                                                                                                                                                                                                        type CancelResponse

                                                                                                                                                                                                                                                                        type CancelResponse = [bigquery.IJobCancelResponse];

                                                                                                                                                                                                                                                                          type CopyTableMetadata

                                                                                                                                                                                                                                                                          type CopyTableMetadata = JobRequest<bigquery.IJobConfigurationTableCopy>;

                                                                                                                                                                                                                                                                            type CreateCopyJobMetadata

                                                                                                                                                                                                                                                                            type CreateCopyJobMetadata = CopyTableMetadata;

                                                                                                                                                                                                                                                                              type CreateDatasetOptions

                                                                                                                                                                                                                                                                              type CreateDatasetOptions = bigquery.IDataset;

                                                                                                                                                                                                                                                                                type CreateExtractJobOptions

                                                                                                                                                                                                                                                                                type CreateExtractJobOptions = JobRequest<bigquery.IJobConfigurationExtract> & {
                                                                                                                                                                                                                                                                                format?: 'ML_TF_SAVED_MODEL' | 'ML_XGBOOST_BOOSTER';
                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                  type DatasetCallback

                                                                                                                                                                                                                                                                                  type DatasetCallback = ResourceCallback<Dataset, bigquery.IDataset>;

                                                                                                                                                                                                                                                                                    type DatasetResource

                                                                                                                                                                                                                                                                                    type DatasetResource = bigquery.IDataset;

                                                                                                                                                                                                                                                                                      type DatasetResponse

                                                                                                                                                                                                                                                                                      type DatasetResponse = [Dataset, bigquery.IDataset];

                                                                                                                                                                                                                                                                                        type DatasetsCallback

                                                                                                                                                                                                                                                                                        type DatasetsCallback = PagedCallback<
                                                                                                                                                                                                                                                                                        Dataset,
                                                                                                                                                                                                                                                                                        GetDatasetsOptions,
                                                                                                                                                                                                                                                                                        bigquery.IDatasetList
                                                                                                                                                                                                                                                                                        >;

                                                                                                                                                                                                                                                                                          type DatasetsResponse

                                                                                                                                                                                                                                                                                          type DatasetsResponse = PagedResponse<
                                                                                                                                                                                                                                                                                          Dataset,
                                                                                                                                                                                                                                                                                          GetDatasetsOptions,
                                                                                                                                                                                                                                                                                          bigquery.IDatasetList
                                                                                                                                                                                                                                                                                          >;

                                                                                                                                                                                                                                                                                            type FormattedMetadata

                                                                                                                                                                                                                                                                                            type FormattedMetadata = bigquery.ITable;

                                                                                                                                                                                                                                                                                              type GetDatasetsOptions

                                                                                                                                                                                                                                                                                              type GetDatasetsOptions = PagedRequest<bigquery.datasets.IListParams>;

                                                                                                                                                                                                                                                                                                type GetJobsCallback

                                                                                                                                                                                                                                                                                                type GetJobsCallback = PagedCallback<Job, GetJobsOptions, bigquery.IJobList>;

                                                                                                                                                                                                                                                                                                  type GetJobsOptions

                                                                                                                                                                                                                                                                                                  type GetJobsOptions = PagedRequest<bigquery.jobs.IListParams>;

                                                                                                                                                                                                                                                                                                    type GetJobsResponse

                                                                                                                                                                                                                                                                                                    type GetJobsResponse = PagedResponse<Job, GetJobsOptions, bigquery.IJobList>;

                                                                                                                                                                                                                                                                                                      type GetModelsCallback

                                                                                                                                                                                                                                                                                                      type GetModelsCallback = PagedCallback<
                                                                                                                                                                                                                                                                                                      Model,
                                                                                                                                                                                                                                                                                                      GetModelsOptions,
                                                                                                                                                                                                                                                                                                      bigquery.IListModelsResponse
                                                                                                                                                                                                                                                                                                      >;

                                                                                                                                                                                                                                                                                                        type GetModelsOptions

                                                                                                                                                                                                                                                                                                        type GetModelsOptions = PagedRequest<bigquery.models.IListParams>;

                                                                                                                                                                                                                                                                                                          type GetModelsResponse

                                                                                                                                                                                                                                                                                                          type GetModelsResponse = PagedResponse<
                                                                                                                                                                                                                                                                                                          Model,
                                                                                                                                                                                                                                                                                                          GetModelsOptions,
                                                                                                                                                                                                                                                                                                          bigquery.IListModelsResponse
                                                                                                                                                                                                                                                                                                          >;

                                                                                                                                                                                                                                                                                                            type GetPolicyOptions

                                                                                                                                                                                                                                                                                                            type GetPolicyOptions = bigquery.IGetPolicyOptions;

                                                                                                                                                                                                                                                                                                              type GetRoutinesCallback

                                                                                                                                                                                                                                                                                                              type GetRoutinesCallback = PagedCallback<
                                                                                                                                                                                                                                                                                                              Routine,
                                                                                                                                                                                                                                                                                                              GetRoutinesOptions,
                                                                                                                                                                                                                                                                                                              bigquery.IListRoutinesResponse
                                                                                                                                                                                                                                                                                                              >;

                                                                                                                                                                                                                                                                                                                type GetRoutinesOptions

                                                                                                                                                                                                                                                                                                                type GetRoutinesOptions = PagedRequest<bigquery.routines.IListParams>;

                                                                                                                                                                                                                                                                                                                  type GetRoutinesResponse

                                                                                                                                                                                                                                                                                                                  type GetRoutinesResponse = PagedResponse<
                                                                                                                                                                                                                                                                                                                  Routine,
                                                                                                                                                                                                                                                                                                                  GetRoutinesOptions,
                                                                                                                                                                                                                                                                                                                  bigquery.IListRoutinesResponse
                                                                                                                                                                                                                                                                                                                  >;

                                                                                                                                                                                                                                                                                                                    type GetRowsOptions

                                                                                                                                                                                                                                                                                                                    type GetRowsOptions = PagedRequest<bigquery.tabledata.IListParams> & {
                                                                                                                                                                                                                                                                                                                    wrapIntegers?: boolean | IntegerTypeCastOptions;
                                                                                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                                                                                      type GetTablesCallback

                                                                                                                                                                                                                                                                                                                      type GetTablesCallback = PagedCallback<Table, GetTablesOptions, bigquery.ITableList>;

                                                                                                                                                                                                                                                                                                                        type GetTablesOptions

                                                                                                                                                                                                                                                                                                                        type GetTablesOptions = PagedRequest<bigquery.tables.IListParams>;

                                                                                                                                                                                                                                                                                                                          type GetTablesResponse

                                                                                                                                                                                                                                                                                                                          type GetTablesResponse = PagedResponse<Table, GetTablesOptions, bigquery.ITableList>;

                                                                                                                                                                                                                                                                                                                            type InsertRowsCallback

                                                                                                                                                                                                                                                                                                                            type InsertRowsCallback = RequestCallback<
                                                                                                                                                                                                                                                                                                                            bigquery.ITableDataInsertAllResponse | bigquery.ITable
                                                                                                                                                                                                                                                                                                                            >;

                                                                                                                                                                                                                                                                                                                              type InsertRowsOptions

                                                                                                                                                                                                                                                                                                                              type InsertRowsOptions = bigquery.ITableDataInsertAllRequest & {
                                                                                                                                                                                                                                                                                                                              createInsertId?: boolean;
                                                                                                                                                                                                                                                                                                                              partialRetries?: number;
                                                                                                                                                                                                                                                                                                                              raw?: boolean;
                                                                                                                                                                                                                                                                                                                              schema?: string | {};
                                                                                                                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                                                                                                                type InsertRowsResponse

                                                                                                                                                                                                                                                                                                                                type InsertRowsResponse = [bigquery.ITableDataInsertAllResponse | bigquery.ITable];

                                                                                                                                                                                                                                                                                                                                  type IntegerTypeCastValue

                                                                                                                                                                                                                                                                                                                                  type IntegerTypeCastValue = {
                                                                                                                                                                                                                                                                                                                                  integerValue: string | number;
                                                                                                                                                                                                                                                                                                                                  schemaFieldName?: string;
                                                                                                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                                                                                                    type JobCallback

                                                                                                                                                                                                                                                                                                                                    type JobCallback = ResourceCallback<Job, bigquery.IJob>;

                                                                                                                                                                                                                                                                                                                                      type JobLoadMetadata

                                                                                                                                                                                                                                                                                                                                      type JobLoadMetadata = JobRequest<bigquery.IJobConfigurationLoad> & {
                                                                                                                                                                                                                                                                                                                                      format?: string;
                                                                                                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                                                                                                        type JobMetadata

                                                                                                                                                                                                                                                                                                                                        type JobMetadata = bigquery.IJob;

                                                                                                                                                                                                                                                                                                                                          type JobMetadataCallback

                                                                                                                                                                                                                                                                                                                                          type JobMetadataCallback = RequestCallback<JobMetadata>;

                                                                                                                                                                                                                                                                                                                                            type JobMetadataResponse

                                                                                                                                                                                                                                                                                                                                            type JobMetadataResponse = [JobMetadata];

                                                                                                                                                                                                                                                                                                                                              type JobOptions

                                                                                                                                                                                                                                                                                                                                              type JobOptions = JobRequest<JobMetadata>;

                                                                                                                                                                                                                                                                                                                                                type JobRequest

                                                                                                                                                                                                                                                                                                                                                type JobRequest<J> = J & {
                                                                                                                                                                                                                                                                                                                                                jobId?: string;
                                                                                                                                                                                                                                                                                                                                                jobPrefix?: string;
                                                                                                                                                                                                                                                                                                                                                location?: string;
                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                  type JobResponse

                                                                                                                                                                                                                                                                                                                                                  type JobResponse = [Job, bigquery.IJob];

                                                                                                                                                                                                                                                                                                                                                    type PagedRequest

                                                                                                                                                                                                                                                                                                                                                    type PagedRequest<P> = P & {
                                                                                                                                                                                                                                                                                                                                                    autoPaginate?: boolean;
                                                                                                                                                                                                                                                                                                                                                    maxApiCalls?: number;
                                                                                                                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                                                                                                                      type PagedResponse

                                                                                                                                                                                                                                                                                                                                                      type PagedResponse<T, Q, R> = [T[]] | [T[], Q | null, R];

                                                                                                                                                                                                                                                                                                                                                        type PermissionsCallback

                                                                                                                                                                                                                                                                                                                                                        type PermissionsCallback = RequestCallback<PermissionsResponse>;

                                                                                                                                                                                                                                                                                                                                                          type PermissionsResponse

                                                                                                                                                                                                                                                                                                                                                          type PermissionsResponse = [bigquery.ITestIamPermissionsResponse];

                                                                                                                                                                                                                                                                                                                                                            type Policy

                                                                                                                                                                                                                                                                                                                                                            type Policy = bigquery.IPolicy;

                                                                                                                                                                                                                                                                                                                                                              type PolicyCallback

                                                                                                                                                                                                                                                                                                                                                              type PolicyCallback = RequestCallback<PolicyResponse>;

                                                                                                                                                                                                                                                                                                                                                                type PolicyRequest

                                                                                                                                                                                                                                                                                                                                                                type PolicyRequest = bigquery.IGetIamPolicyRequest;

                                                                                                                                                                                                                                                                                                                                                                  type PolicyResponse

                                                                                                                                                                                                                                                                                                                                                                  type PolicyResponse = [Policy];

                                                                                                                                                                                                                                                                                                                                                                    type ProvidedTypeArray

                                                                                                                                                                                                                                                                                                                                                                    type ProvidedTypeArray = Array<ProvidedTypeStruct | string | []>;

                                                                                                                                                                                                                                                                                                                                                                      type Query

                                                                                                                                                                                                                                                                                                                                                                      type Query = JobRequest<bigquery.IJobConfigurationQuery> & {
                                                                                                                                                                                                                                                                                                                                                                      destination?: Table;
                                                                                                                                                                                                                                                                                                                                                                      params?:
                                                                                                                                                                                                                                                                                                                                                                      | any[]
                                                                                                                                                                                                                                                                                                                                                                      | {
                                                                                                                                                                                                                                                                                                                                                                      [param: string]: any;
                                                                                                                                                                                                                                                                                                                                                                      };
                                                                                                                                                                                                                                                                                                                                                                      dryRun?: boolean;
                                                                                                                                                                                                                                                                                                                                                                      labels?: {
                                                                                                                                                                                                                                                                                                                                                                      [label: string]: string;
                                                                                                                                                                                                                                                                                                                                                                      };
                                                                                                                                                                                                                                                                                                                                                                      types?:
                                                                                                                                                                                                                                                                                                                                                                      | string[]
                                                                                                                                                                                                                                                                                                                                                                      | string[][]
                                                                                                                                                                                                                                                                                                                                                                      | {
                                                                                                                                                                                                                                                                                                                                                                      [type: string]: string | string[];
                                                                                                                                                                                                                                                                                                                                                                      };
                                                                                                                                                                                                                                                                                                                                                                      job?: Job;
                                                                                                                                                                                                                                                                                                                                                                      maxResults?: number;
                                                                                                                                                                                                                                                                                                                                                                      jobTimeoutMs?: number;
                                                                                                                                                                                                                                                                                                                                                                      pageToken?: string;
                                                                                                                                                                                                                                                                                                                                                                      wrapIntegers?: boolean | IntegerTypeCastOptions;
                                                                                                                                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                                                                                                                                        type QueryOptions

                                                                                                                                                                                                                                                                                                                                                                        type QueryOptions = QueryResultsOptions;

                                                                                                                                                                                                                                                                                                                                                                          type QueryParameter

                                                                                                                                                                                                                                                                                                                                                                          type QueryParameter = bigquery.IQueryParameter;

                                                                                                                                                                                                                                                                                                                                                                            type QueryResultsOptions

                                                                                                                                                                                                                                                                                                                                                                            type QueryResultsOptions = {
                                                                                                                                                                                                                                                                                                                                                                            job?: Job;
                                                                                                                                                                                                                                                                                                                                                                            wrapIntegers?: boolean | IntegerTypeCastOptions;
                                                                                                                                                                                                                                                                                                                                                                            } & PagedRequest<bigquery.jobs.IGetQueryResultsParams>;

                                                                                                                                                                                                                                                                                                                                                                              type QueryRowsCallback

                                                                                                                                                                                                                                                                                                                                                                              type QueryRowsCallback = PagedCallback<
                                                                                                                                                                                                                                                                                                                                                                              RowMetadata,
                                                                                                                                                                                                                                                                                                                                                                              Query,
                                                                                                                                                                                                                                                                                                                                                                              bigquery.IGetQueryResultsResponse
                                                                                                                                                                                                                                                                                                                                                                              >;

                                                                                                                                                                                                                                                                                                                                                                                type QueryRowsResponse

                                                                                                                                                                                                                                                                                                                                                                                type QueryRowsResponse = PagedResponse<
                                                                                                                                                                                                                                                                                                                                                                                RowMetadata,
                                                                                                                                                                                                                                                                                                                                                                                Query,
                                                                                                                                                                                                                                                                                                                                                                                bigquery.IGetQueryResultsResponse
                                                                                                                                                                                                                                                                                                                                                                                >;

                                                                                                                                                                                                                                                                                                                                                                                  type QueryStreamOptions

                                                                                                                                                                                                                                                                                                                                                                                  type QueryStreamOptions = {
                                                                                                                                                                                                                                                                                                                                                                                  wrapIntegers?: boolean | IntegerTypeCastOptions;
                                                                                                                                                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                                                                                                                                                    type RoutineCallback

                                                                                                                                                                                                                                                                                                                                                                                    type RoutineCallback = ResourceCallback<Routine, bigquery.IRoutine>;

                                                                                                                                                                                                                                                                                                                                                                                      type RoutineMetadata

                                                                                                                                                                                                                                                                                                                                                                                      type RoutineMetadata = bigquery.IRoutine;

                                                                                                                                                                                                                                                                                                                                                                                        type RoutineResponse

                                                                                                                                                                                                                                                                                                                                                                                        type RoutineResponse = [Routine, bigquery.IRoutine];

                                                                                                                                                                                                                                                                                                                                                                                          type RowMetadata

                                                                                                                                                                                                                                                                                                                                                                                          type RowMetadata = any;

                                                                                                                                                                                                                                                                                                                                                                                            type RowsCallback

                                                                                                                                                                                                                                                                                                                                                                                            type RowsCallback = PagedCallback<
                                                                                                                                                                                                                                                                                                                                                                                            RowMetadata,
                                                                                                                                                                                                                                                                                                                                                                                            GetRowsOptions,
                                                                                                                                                                                                                                                                                                                                                                                            bigquery.ITableDataList | bigquery.ITable
                                                                                                                                                                                                                                                                                                                                                                                            >;

                                                                                                                                                                                                                                                                                                                                                                                              type RowsResponse

                                                                                                                                                                                                                                                                                                                                                                                              type RowsResponse = PagedResponse<
                                                                                                                                                                                                                                                                                                                                                                                              RowMetadata,
                                                                                                                                                                                                                                                                                                                                                                                              GetRowsOptions,
                                                                                                                                                                                                                                                                                                                                                                                              bigquery.ITableDataList | bigquery.ITable
                                                                                                                                                                                                                                                                                                                                                                                              >;

                                                                                                                                                                                                                                                                                                                                                                                                type SetPolicyOptions

                                                                                                                                                                                                                                                                                                                                                                                                type SetPolicyOptions = Omit<bigquery.ISetIamPolicyRequest, 'policy'>;

                                                                                                                                                                                                                                                                                                                                                                                                  type SetTableMetadataOptions

                                                                                                                                                                                                                                                                                                                                                                                                  type SetTableMetadataOptions = TableMetadata;

                                                                                                                                                                                                                                                                                                                                                                                                    type SimpleQueryRowsCallback

                                                                                                                                                                                                                                                                                                                                                                                                    type SimpleQueryRowsCallback = ResourceCallback<RowMetadata[], bigquery.IJob>;

                                                                                                                                                                                                                                                                                                                                                                                                      type SimpleQueryRowsResponse

                                                                                                                                                                                                                                                                                                                                                                                                      type SimpleQueryRowsResponse = [RowMetadata[], bigquery.IJob];

                                                                                                                                                                                                                                                                                                                                                                                                        type TableCallback

                                                                                                                                                                                                                                                                                                                                                                                                        type TableCallback = ResourceCallback<Table, bigquery.ITable>;

                                                                                                                                                                                                                                                                                                                                                                                                          type TableField

                                                                                                                                                                                                                                                                                                                                                                                                          type TableField = bigquery.ITableFieldSchema;

                                                                                                                                                                                                                                                                                                                                                                                                            type TableMetadata

                                                                                                                                                                                                                                                                                                                                                                                                            type TableMetadata = bigquery.ITable & {
                                                                                                                                                                                                                                                                                                                                                                                                            name?: string;
                                                                                                                                                                                                                                                                                                                                                                                                            schema?: string | TableField[] | TableSchema;
                                                                                                                                                                                                                                                                                                                                                                                                            partitioning?: string;
                                                                                                                                                                                                                                                                                                                                                                                                            view?: string | ViewDefinition;
                                                                                                                                                                                                                                                                                                                                                                                                            };

                                                                                                                                                                                                                                                                                                                                                                                                              type TableResponse

                                                                                                                                                                                                                                                                                                                                                                                                              type TableResponse = [Table, bigquery.ITable];

                                                                                                                                                                                                                                                                                                                                                                                                                type TableRow

                                                                                                                                                                                                                                                                                                                                                                                                                type TableRow = bigquery.ITableRow;

                                                                                                                                                                                                                                                                                                                                                                                                                  type TableRowField

                                                                                                                                                                                                                                                                                                                                                                                                                  type TableRowField = bigquery.ITableCell;

                                                                                                                                                                                                                                                                                                                                                                                                                    type TableRowValue

                                                                                                                                                                                                                                                                                                                                                                                                                    type TableRowValue = string | TableRow;

                                                                                                                                                                                                                                                                                                                                                                                                                      type TableSchema

                                                                                                                                                                                                                                                                                                                                                                                                                      type TableSchema = bigquery.ITableSchema;

                                                                                                                                                                                                                                                                                                                                                                                                                        type ValueType

                                                                                                                                                                                                                                                                                                                                                                                                                        type ValueType = bigquery.IQueryParameterType;

                                                                                                                                                                                                                                                                                                                                                                                                                          type ViewDefinition

                                                                                                                                                                                                                                                                                                                                                                                                                          type ViewDefinition = bigquery.IViewDefinition;

                                                                                                                                                                                                                                                                                                                                                                                                                            Package Files (7)

                                                                                                                                                                                                                                                                                                                                                                                                                            Dependencies (11)

                                                                                                                                                                                                                                                                                                                                                                                                                            Dev Dependencies (29)

                                                                                                                                                                                                                                                                                                                                                                                                                            Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                                                                            No peer dependencies.

                                                                                                                                                                                                                                                                                                                                                                                                                            Badge

                                                                                                                                                                                                                                                                                                                                                                                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                                                                                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@google-cloud/bigquery.

                                                                                                                                                                                                                                                                                                                                                                                                                            • Markdown
                                                                                                                                                                                                                                                                                                                                                                                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@google-cloud/bigquery)
                                                                                                                                                                                                                                                                                                                                                                                                                            • HTML
                                                                                                                                                                                                                                                                                                                                                                                                                              <a href="https://www.jsdocs.io/package/@google-cloud/bigquery"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>