Skip to content

Latest commit

 

History

History
136 lines (97 loc) · 4.84 KB

README.md

File metadata and controls

136 lines (97 loc) · 4.84 KB

Google Cloud Platform logo

Google BigQuery Node.js Samples

BigQuery is Google's fully managed, petabyte scale, low cost analytics data warehouse.

Table of Contents

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Create A Simple Application With the API

View the documentation or the source code.

Run the sample:

node getting_started

Datasets

View the documentation or the source code.

Usage: node datasets --help

Commands:
  create <name>       Create a new dataset.
  delete <datasetId>  Delete the specified dataset.
  list                List datasets in the authenticated project.
  size <datasetId>    Calculate the size of the specified dataset.

Options:
  --projectId, -p  Optionally specify the project ID to use.
                                                                         [string]
  --help           Show help                                            [boolean]

Examples:
  node datasets create my_dataset                     Create a new dataset named "my_dataset".
  node datasets delete my_dataset                     Delete "my_dataset".
  node datasets list                                  List datasets.
  node datasets list -p bigquery-public-data          List datasets in a project other than the
                                                      authenticated project.
  node datasets size my_dataset                       Calculate the size of "my_dataset".
  node datasets size hacker_news -p                   Calculate the size of
  bigquery-public-data                                "bigquery-public-data:hacker_news".

For more information, see https://cloud.google.com/bigquery/docs

Queries

View the documentation or the source code.

Usage: node queries --help

Commands:
  sync <query>   Run a synchronous query.
  async <query>  Start an asynchronous query.
  poll <jobId>   Get the status of a job.

Options:
  --help  Show help                                            [boolean]

Examples:
  node queries sync "SELECT * FROM publicdata:samples.natality LIMIT 5;"
  node queries async "SELECT * FROM publicdata:samples.natality LIMIT 5;"
  node queries poll 12345

For more information, see https://cloud.google.com/bigquery/docs

Tables

View the documentation or the source code.

Usage: node tables --help

Commands:
  create <dataset> <table>                  Create a new table in the specified dataset.
  list <dataset>                            List tables in the specified dataset.
  delete <dataset> <table>                  Delete a table in the specified dataset.
  import <dataset> <table> <file>           Import data from a local file or a Google Cloud Storage
                                            file into BigQuery.
  export <dataset> <table> <bucket> <file>  Export a table from BigQuery to Google Cloud Storage.

Options:
  --help  Show help                                                                        [boolean]

Examples:
  node tables create my_dataset my_table              Create table "my_table" in "my_dataset".
  node tables list my_dataset                         List tables in "my_dataset".
  node tables delete my_dataset my_table              Delete "my_table" from "my_dataset".
  node tables import my_dataset my_table ./data.csv   Import a local file into a table.
  node tables import my_dataset my_table data.csv     Import a GCS file into a table.
  --bucket my-bucket
  node tables export my_dataset my_table my-bucket    Export my_dataset:my_table to
  my-file                                             gcs://my-bucket/my-file as raw CSV
  node tables export my_dataset my_table my-bucket    Export my_dataset:my_table to
  my-file -f JSON --gzip                              gcs://my-bucket/my-file as gzipped JSON

For more information, see https://cloud.google.com/bigquery/docs