SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Google BigQuery
Analytics 読書会#1
2014/08/13(Wed)
tagomoris
BigQueryと俺
2014/08/13(Wed)
tagomoris
appengine ja hackathon
#6 in 2010/07/31
kazunori -san says: 「BQまじすごい」
ペーパーを眺めてあーだこーだ言う
with @ashigeru 先生
COUNT(DISTINCT val) 問題
http://d.hatena.ne.jp/kazunori_279/20100527/1274950030
そして時は流れ
someday in Dec 2013
tagomoris:「なんか面白趣味プロダクトのネタないかな」
kazunori:「Fluentd BigQueryプラグインほしい!」
tagomoris:「ガタッ!」
fluent-plugin-bigquery爆誕
当初streaming insertのAPI制限がきつかった
buffer pluginも書いてカリカリチューン
fluent-plugin-buffer-lightening
今となってはだいぶ緩い
fluent-plugin-bigquery
メンテナ募集中!
閑話休題
Using the Command-Line Client
CLIも使えるよ
Pythonで書かれてるよ
コードが読めるのでBigQuery APIの使いか
たを学ぶのにもちょうべんり
Install and Setup (1)
Pythonは予め入れておけ、2.7だぞ
BigQuery clientのコードはGoogle codeにある
Google Cloud SDKにBigQuery clientも入って
るのでインストールはそっちから
本のAppEngineコードも試したければ言語にあ
わせたAppEngine SDKも入れよう
Install and Setup (2)
入れたらとりあえずGoogleアカウント認証
gcloud auth login
ブラウザでOAuth認証
実行端末に認証情報が保存される
project id の入力
Install and Setup (3)
権限は好きなときにrevokeできるよ
Webブラウザで
PC単位でなら: gcloud auth revoke
プロジェクト単位なら: gcloud config set
project <project_id>
複数project持ってるならデフォルトを選ぶこ
と
ここで一句
“gcloud components update” まじうざい
Using the Client (1)
bq と打てば何ができるかわかる、超べんり
bq [global flags] <command> [command flags]
[command argument]
bq --help と打てばオプションリストが出る、
超べんり
bq help <command> でヘルプが出る、最高
Using the Client (2)
bq ls コマンドで何があるかわかる、べんり
project id list: bq ls -p
datasets list: bq ls
tables list: bq ls <dataset_name>
recent job list: bq ls -j
--format で整形できる、まじべんり
Using the Client (3)
CLIだとprojectの違うアクセス設定されている
datasetとかが表示できない
でも名前がわかってれば中身は見られる
bq ls publicdata:samples
この本の後のほうで残りのコマンドも試すよ
Service Account Access (1)
Google個人アカウントじゃなくてService
Accountというやつも使えるよ
private keyだけで認証できる、べんり
サンプルコードとか自分で書いたコードを実
行するときにとくにべんり
Service Account Access (2)
$HOME/.bigqueryrc にGoogleアカウント設定
がある(ある?)
このファイルはCLI global flagsのリスト
CLIでの指定は設定ファイルのを上書きする
Service Account Access (3)
Service Account設定は別ファイルに作る
<service-account-id>@developer.gserviceaccount.com
$HOME/.bigquery.<service-account-id>
service_account = <service-account-id>@...
service_account_credential_file = TOKEN_PATH
service_account_private_key_file = PKEY_PATH
project_id = PROJECT_ID
Service Account Access (4)
この章のダウンロードコンテンツ:
設定ファイル作成用便利スクリプト
(以下省略、はいはい便利便利)
python-setuptools / pip を忘れるな!
Service Account Access (5)
bq --bigqueryrc=$HOME/.bigqueryrc.foo ls
なんか言われたら easy_install pyOpenSSl
It’s not typo
system pythonに入れられなかったら
PYTHONPATH
export $BIGQUERYRC=PATH もちょうべんり
おしまい

Contenu connexe

Plus de SATOSHI TAGOMORI

Plus de SATOSHI TAGOMORI (20)

Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive Operations
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the World
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: Bigdam
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise Business
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd Season
 
Fluentd 101
Fluentd 101Fluentd 101
Fluentd 101
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT To
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In Ruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud Service
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
 
How to Make Norikra Perfect
How to Make Norikra PerfectHow to Make Norikra Perfect
How to Make Norikra Perfect
 
Distributed Logging Architecture in Container Era
Distributed Logging Architecture in Container EraDistributed Logging Architecture in Container Era
Distributed Logging Architecture in Container Era
 
Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
 
Overview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data ServiceOverview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data Service
 
Hive dirty/beautiful hacks in TD
Hive dirty/beautiful hacks in TDHive dirty/beautiful hacks in TD
Hive dirty/beautiful hacks in TD
 

Dernier

Dernier (11)

論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 

BigQuery読書会#1資料

  • 3. appengine ja hackathon #6 in 2010/07/31 kazunori -san says: 「BQまじすごい」 ペーパーを眺めてあーだこーだ言う with @ashigeru 先生 COUNT(DISTINCT val) 問題 http://d.hatena.ne.jp/kazunori_279/20100527/1274950030
  • 5. someday in Dec 2013 tagomoris:「なんか面白趣味プロダクトのネタないかな」 kazunori:「Fluentd BigQueryプラグインほしい!」 tagomoris:「ガタッ!」
  • 9. Using the Command-Line Client CLIも使えるよ Pythonで書かれてるよ コードが読めるのでBigQuery APIの使いか たを学ぶのにもちょうべんり
  • 10. Install and Setup (1) Pythonは予め入れておけ、2.7だぞ BigQuery clientのコードはGoogle codeにある Google Cloud SDKにBigQuery clientも入って るのでインストールはそっちから 本のAppEngineコードも試したければ言語にあ わせたAppEngine SDKも入れよう
  • 11. Install and Setup (2) 入れたらとりあえずGoogleアカウント認証 gcloud auth login ブラウザでOAuth認証 実行端末に認証情報が保存される project id の入力
  • 12. Install and Setup (3) 権限は好きなときにrevokeできるよ Webブラウザで PC単位でなら: gcloud auth revoke プロジェクト単位なら: gcloud config set project <project_id> 複数project持ってるならデフォルトを選ぶこ と
  • 14. Using the Client (1) bq と打てば何ができるかわかる、超べんり bq [global flags] <command> [command flags] [command argument] bq --help と打てばオプションリストが出る、 超べんり bq help <command> でヘルプが出る、最高
  • 15. Using the Client (2) bq ls コマンドで何があるかわかる、べんり project id list: bq ls -p datasets list: bq ls tables list: bq ls <dataset_name> recent job list: bq ls -j --format で整形できる、まじべんり
  • 16. Using the Client (3) CLIだとprojectの違うアクセス設定されている datasetとかが表示できない でも名前がわかってれば中身は見られる bq ls publicdata:samples この本の後のほうで残りのコマンドも試すよ
  • 17. Service Account Access (1) Google個人アカウントじゃなくてService Accountというやつも使えるよ private keyだけで認証できる、べんり サンプルコードとか自分で書いたコードを実 行するときにとくにべんり
  • 18. Service Account Access (2) $HOME/.bigqueryrc にGoogleアカウント設定 がある(ある?) このファイルはCLI global flagsのリスト CLIでの指定は設定ファイルのを上書きする
  • 19. Service Account Access (3) Service Account設定は別ファイルに作る <service-account-id>@developer.gserviceaccount.com $HOME/.bigquery.<service-account-id> service_account = <service-account-id>@... service_account_credential_file = TOKEN_PATH service_account_private_key_file = PKEY_PATH project_id = PROJECT_ID
  • 20. Service Account Access (4) この章のダウンロードコンテンツ: 設定ファイル作成用便利スクリプト (以下省略、はいはい便利便利) python-setuptools / pip を忘れるな!
  • 21. Service Account Access (5) bq --bigqueryrc=$HOME/.bigqueryrc.foo ls なんか言われたら easy_install pyOpenSSl It’s not typo system pythonに入れられなかったら PYTHONPATH export $BIGQUERYRC=PATH もちょうべんり