Socket
Socket
Sign inDemoInstall

@google-cloud/bigquery

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/bigquery

Google BigQuery Client Library for Node.js


Version published
Weekly downloads
689K
decreased by-5.43%
Maintainers
1
Weekly downloads
 
Created

What is @google-cloud/bigquery?

@google-cloud/bigquery is a Node.js client library for Google BigQuery, a fully-managed, serverless data warehouse that enables scalable analysis over petabytes of data. This package allows you to interact with BigQuery to run queries, manage datasets, tables, and jobs, and perform data manipulations.

What are @google-cloud/bigquery's main functionalities?

Running Queries

This feature allows you to run SQL queries against your BigQuery datasets. The code sample demonstrates how to run a simple query to select names and ages from a table where the age is greater than 30.

const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
async function query() {
  const query = 'SELECT name, age FROM `my-dataset.my-table` WHERE age > 30';
  const options = { query: query, location: 'US' };
  const [rows] = await bigquery.query(options);
  console.log('Rows:', rows);
}
query();

Managing Datasets

This feature allows you to create and manage datasets in BigQuery. The code sample demonstrates how to create a new dataset named 'my_new_dataset'.

const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
async function createDataset() {
  const [dataset] = await bigquery.createDataset('my_new_dataset');
  console.log(`Dataset ${dataset.id} created.`);
}
createDataset();

Managing Tables

This feature allows you to create and manage tables within datasets. The code sample demonstrates how to create a new table named 'my_new_table' within the 'my_new_dataset' dataset.

const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
async function createTable() {
  const dataset = bigquery.dataset('my_new_dataset');
  const [table] = await dataset.createTable('my_new_table');
  console.log(`Table ${table.id} created.`);
}
createTable();

Loading Data

This feature allows you to load data from various sources into BigQuery tables. The code sample demonstrates how to load data from a local CSV file into a table named 'my_new_table' within the 'my_new_dataset' dataset.

const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
async function loadData() {
  const dataset = bigquery.dataset('my_new_dataset');
  const table = dataset.table('my_new_table');
  const [job] = await table.load('local-file.csv');
  console.log(`Job ${job.id} completed.`);
}
loadData();

Other packages similar to @google-cloud/bigquery

Keywords

FAQs

Package last updated on 06 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc