SlideShare a Scribd company logo
Simon @ MiCloud
We are...
The APAC Partner of Google
前情提要
很久很久以前...
Node.js inTaiwan
HTTP://OpenNodes.arecord.us
OR
Sample
Copy
Run!
時代不同,⾯面對資料的態度也不同...
● 存得起來的,叫做Storage (儲存)!
● 看得到的,叫做Data (資料)!
● 看得懂的,叫做Information (資訊)!
● ⽤用得出來的,才能夠叫做Intelligent
(智慧)
和沛科技 CEO & Founder - 翟本喬
看似無意義的log
不要⼩小看群眾的⼒力量....
Google BigQuery
吸引⼈人的地⽅方.....
Top 1 - JavaScript / Node.js
select repository language from
372211 259329 223470
Tools
Auth
Req?
API
SDK Web
App
Service
Node.js是...
● 輕鬆接軌...
● 簡單了解...
● 輕量...
● 效能...
天下武功,唯快不破...
絕世武功秘笈
Node.js & Oauth & Google
Authenticate with
Oauth2.0
Google Oauth2
Web Server Application Service Account
Request token
Authorization
code
Exchange code
for token
Token response
Use token to
call Google API
Your App Google
Servers
User login !
& consent
Use
r
Create and
sign JWT
Use JWT to
request token
Token response
Use token to
call Google API
Server
App
Google
Servers
google-api-utility模組開發歷程
透過初始化設定之後,
即可以直接進⾏行api呼叫動作
!
1. 設定檔抽離
2. 結合request模組進⾏行API呼叫
3. Access Token cache
google-api-utility module
基本資訊
● https://github.com/peihsinsu/google-api-utility
安裝
● npm install google-api-utility
操作
● apiutil.init(config)
● apiutil.request(options, callback)
var auth = require('google-api-utility')

auth.init({

scope: 'https://www.googleapis.com/auth/bigquery https://
www.googleapis.com/auth/cloud-platform',

client_secret: '/path-to-client_secret.json',

key_pem: '/path-to-key.pem'

});
使⽤用範例 - 初始化
此處需要綁定所欲呼叫的API
相關授權之Scope位置
設定client_secret.json
與相關pem檔案位置,供jwt
運算使⽤用
使⽤用範例 - 呼叫BigQuery
var request = auth.request;
var bqurl = 'https://www.googleapis.com/bigquery/v2/projects/%s/
datasets';request({

url: util.format(bqurl, project),

method: 'GET'

}, function(err, req, doc){

// implements

});
同原request模組操作⽅方式
結合原request模組之
function,供api呼叫使⽤用
Google API Explore HTTPS://developers.google.com/apis-explorer/
Google API Explore - Query
Google API Explore - Auth
Operation Scope
Google API Explore - Response
Idea...
● bigquery.init({...configurations...})
● bigquery.[what].[do](...)
- bigquery.dataset.list(....)
- bigquery.table.load(..., callback)
bigquery module
基本資訊
● https://github.com/peihsinsu/bigquery
安裝
● npm install bigquery
操作
● bigquery.init(config)
● bigquery.[category].[operation](options, callback)
重新包裝 - bigquery模組
var bq = require('bigquery')

, prjId = 'your-bigquery-project-id';
bq.init({

client_secret: '/path/to/client_secret.json',

key_pem: '/path-to-key.pem'

});
bq.dataset.list(prjId, function(e,r,d){

if(e) console.log(e);

console.log(JSON.stringify(d));

});
bigquery模組可參考:https://github.com/peihsinsu/bigquery
透過bq呼叫某個操作之下的function
Source Code...
var util = require('util')
, auth = require('google-api-utility')
, request = auth.request
, _ = require('underscore')
exports.init = auth.init;
exports.job = {
token: '',
listds : function(project, cb){
var bqurl = 'https://www.googleapis.com/bigquery/v2/projects/%s/datasets';
request({
url: util.format(bqurl, project),
method: 'GET'
}, cb?cb:auth.commonCb);
}, … (skip)
}
封裝相同類別的api在⼀一起!
ex: job相關的放在job物件中
應⽤用.... sql2bq
sql2bq module
基本資訊
● https://github.com/micloud/sql2bq
安裝
● npm install sql2bq -g
操作
● sql2bq-init
● sql2bq-load -q [SQL] -t [table]
Google IO - When Bigquery meeet Node.js
Google’s Node.js SDK
Operation with googleapis
var googleapis = require('googleapis');
!
var jwt = new googleapis.auth.JWT(
'429100748......hv3@developer.gserviceaccount.com',
'/path/to/key.pem',
null,
[
'https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/cloud-platform'
]);
Operation with googleapis
jwt.authorize(function(err, tokens) {
googleapis.discover('bigquery', 'v2').execute(function(e,client) {
if(e)
console.log(e);
else
client.bigquery.datasets.list(param).withAuthClient(jwt)
.execute(
function(err, response) {
if(err) console.log(err);
console.log(JSON.stringify(response));
});
});
});
應⽤用... gapis
gapis module
基本資訊
● https://github.com/peihsinsu/gapis
安裝
● npm install gapis -g
操作
● gcli -d project=[PROJECT_ID] -f [API FUNCTION]
NOT ONLY Node.js Love JavaScript…..
Google IO - When Bigquery meeet Node.js
The fancy integrate with Sheet
More and more chart….
Charting in Apps Script
http://micloud.tw

More Related Content

Viewers also liked (20)

PDF
html5 & phonegap
Caesar Chi
 
PDF
中華電信 教育訓練
謝 宗穎
 
PDF
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
謝 宗穎
 
PDF
GCPUG.TW - 2015活動回顧
Simon Su
 
PDF
Web development, from git flow to github flow
Caesar Chi
 
PDF
JCConf 2015 - Google Dataflow 在雲端大資料處理的應用
Simon Su
 
PDF
Docker with Cloud Service GCPUG
Caesar Chi
 
PDF
GCP - GCE, Cloud SQL, Cloud Storage, BigQuery Basic Training
Simon Su
 
PDF
JCConf 2016 - Google Dataflow 小試
Simon Su
 
PDF
Brocade - Stingray Application Firewall
Simon Su
 
PDF
Facebook Pixel
Chen Liwei
 
PDF
An indepth look at Google BigQuery Architecture by Felipe Hoffa of Google
Data Con LA
 
PDF
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
 
PDF
遠端團隊專案建立與管理 remote team management 2016
Caesar Chi
 
PDF
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
Simon Su
 
PDF
從失敗中學習打造技術團隊
Caesar Chi
 
PDF
Exploring BigData with Google BigQuery
Dharmesh Vaya
 
PDF
Introduction To Apache Pig at WHUG
Adam Kawa
 
PDF
Introduce Angular2 & render & firebase flow
Caesar Chi
 
PDF
我編譯故我在:誰說 Node.js 程式不能編成 binary
Fred Chien
 
html5 & phonegap
Caesar Chi
 
中華電信 教育訓練
謝 宗穎
 
為 Node.js 專案打造專屬管家進行開發流程整合及健康檢測
謝 宗穎
 
GCPUG.TW - 2015活動回顧
Simon Su
 
Web development, from git flow to github flow
Caesar Chi
 
JCConf 2015 - Google Dataflow 在雲端大資料處理的應用
Simon Su
 
Docker with Cloud Service GCPUG
Caesar Chi
 
GCP - GCE, Cloud SQL, Cloud Storage, BigQuery Basic Training
Simon Su
 
JCConf 2016 - Google Dataflow 小試
Simon Su
 
Brocade - Stingray Application Firewall
Simon Su
 
Facebook Pixel
Chen Liwei
 
An indepth look at Google BigQuery Architecture by Felipe Hoffa of Google
Data Con LA
 
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
 
遠端團隊專案建立與管理 remote team management 2016
Caesar Chi
 
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
Simon Su
 
從失敗中學習打造技術團隊
Caesar Chi
 
Exploring BigData with Google BigQuery
Dharmesh Vaya
 
Introduction To Apache Pig at WHUG
Adam Kawa
 
Introduce Angular2 & render & firebase flow
Caesar Chi
 
我編譯故我在:誰說 Node.js 程式不能編成 binary
Fred Chien
 

Similar to Google IO - When Bigquery meeet Node.js (11)

PDF
JsConf 2014 - Google BigQuery API Node.js實作記錄
Simon Su
 
PDF
Node.js 與 google cloud storage
onlinemad
 
PDF
Google api應用入門
Simon Su
 
PDF
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
PDF
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
PDF
Google cloud storage 講個祕訣
onlinemad
 
PDF
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
PPTX
API Services: Building State-of-the-Art APIs
Apigee | Google Cloud
 
PDF
From zero to Google APIs: Beyond search & AI... leverage all of Google
wesley chun
 
PDF
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
PDF
Image archive, analysis & report generation with Google Cloud
wesley chun
 
JsConf 2014 - Google BigQuery API Node.js實作記錄
Simon Su
 
Node.js 與 google cloud storage
onlinemad
 
Google api應用入門
Simon Su
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Google cloud storage 講個祕訣
onlinemad
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
API Services: Building State-of-the-Art APIs
Apigee | Google Cloud
 
From zero to Google APIs: Beyond search & AI... leverage all of Google
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
Image archive, analysis & report generation with Google Cloud
wesley chun
 
Ad

More from Simon Su (20)

PDF
Kubernetes Basic Operation
Simon Su
 
PDF
Google IoT Core 初體驗
Simon Su
 
PDF
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
Simon Su
 
PDF
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
Simon Su
 
PDF
Google Cloud Platform Special Training
Simon Su
 
PDF
GCE Windows Serial Console Usage Guide
Simon Su
 
PDF
GCPNext17' Extend 開始GCP了嗎?
Simon Su
 
PDF
Try Cloud Spanner
Simon Su
 
PDF
Google Cloud Monitoring
Simon Su
 
PDF
Google Cloud Computing compares GCE, GAE and GKE
Simon Su
 
PDF
JCConf 2016 - Dataflow Workshop Labs
Simon Su
 
PDF
JCConf2016 - Dataflow Workshop Setup
Simon Su
 
PDF
Docker in Action
Simon Su
 
PDF
Google I/O 2016 Recap - Google Cloud Platform News Update
Simon Su
 
PDF
IThome DevOps Summit - IoT、docker與DevOps
Simon Su
 
PDF
Google Cloud Platform Introduction - 2016Q3
Simon Su
 
PDF
Google I/O Extended 2016 - 台北場活動回顧
Simon Su
 
PPTX
GCS - Access Control Lists (中文)
Simon Su
 
PDF
Google Cloud Platform - for Mobile Solutions
Simon Su
 
PDF
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
Simon Su
 
Kubernetes Basic Operation
Simon Su
 
Google IoT Core 初體驗
Simon Su
 
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
Simon Su
 
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
Simon Su
 
Google Cloud Platform Special Training
Simon Su
 
GCE Windows Serial Console Usage Guide
Simon Su
 
GCPNext17' Extend 開始GCP了嗎?
Simon Su
 
Try Cloud Spanner
Simon Su
 
Google Cloud Monitoring
Simon Su
 
Google Cloud Computing compares GCE, GAE and GKE
Simon Su
 
JCConf 2016 - Dataflow Workshop Labs
Simon Su
 
JCConf2016 - Dataflow Workshop Setup
Simon Su
 
Docker in Action
Simon Su
 
Google I/O 2016 Recap - Google Cloud Platform News Update
Simon Su
 
IThome DevOps Summit - IoT、docker與DevOps
Simon Su
 
Google Cloud Platform Introduction - 2016Q3
Simon Su
 
Google I/O Extended 2016 - 台北場活動回顧
Simon Su
 
GCS - Access Control Lists (中文)
Simon Su
 
Google Cloud Platform - for Mobile Solutions
Simon Su
 
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
Simon Su
 
Ad

Recently uploaded (20)

PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Français Patch Tuesday - Juillet
Ivanti
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PPTX
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Français Patch Tuesday - Juillet
Ivanti
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 

Google IO - When Bigquery meeet Node.js