Last active
February 4, 2018 09:43
-
-
Save rominirani/5c39fb5d09a47d9933e937b77eb81366 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const bigquery = require('@google-cloud/bigquery')({ | |
projectId: 'your-project-id', | |
keyFilename: 'key.json' | |
}); | |
const sqlQuery = "SELECT total_amount, pickup_datetime, trip_distance FROM 'nyc-tlc.yellow.trips' ORDER BY total_amount DESC LIMIT 1;"; | |
const options = { | |
query: sqlQuery, | |
timeoutMs: 10000, | |
useLegacySql: false, | |
}; | |
bigquery | |
.query(options) | |
.then(results => { | |
const rows = results[0]; | |
console.log('Rows:'); | |
rows.forEach(row => console.log(row)); | |
}) | |
.catch(err => { | |
console.error('ERROR:', err); | |
});` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment