Skip to content

Node.js quickstart

npm install @google-cloud/bigquery
import { BigQuery } from "@google-cloud/bigquery";

process.env.BIGQUERY_EMULATOR_HOST = "localhost:9050";

const bigquery = new BigQuery({
  projectId: "my-project",
  apiEndpoint: "http://localhost:9050",
});

await bigquery.createDataset("sales");

const [rows] = await bigquery.query(
  "SELECT COUNT(*) AS n FROM sales.orders",
);
console.log(rows);

See the Node.js client reference for the full API surface. All operations supported by the REST backend work against bqemulator. See the compatibility matrix.