Created
August 9, 2021 11:10
-
-
Save ensargunesdogdu/834765f8fc40e9e49fa244ee03e8dc8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import the Google Cloud client library using default credentials | |
const {BigQuery} = require('@google-cloud/bigquery'); | |
const bigquery = new BigQuery(); | |
async function query() { | |
const query = "SELECT * FROM \`$TABLE_NAME\` LIMIT 1000"; | |
const options = { | |
query: query, | |
// Location must match that of the dataset(s) referenced in the query. | |
location: 'europe-west4', | |
}; | |
const [job] = await bigquery.createQueryJob(options); | |
console.log(`Job ${job.id} started.`); | |
const [rows] = await job.getQueryResults(); | |
console.log('Rows:'); | |
rows.forEach(row => console.log(row)); | |
} | |
query(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment